971bdb23-3ff6-43eb-b422-1c30165a3663.json 341 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401
  1. {
  2. "__type__": "cc.EffectAsset",
  3. "_name": "particles/builtin-particle-gpu",
  4. "_objFlags": 0,
  5. "__editorExtras__": {},
  6. "_native": "",
  7. "techniques": [
  8. {
  9. "name": "add",
  10. "passes": [
  11. {
  12. "rasterizerState": {
  13. "cullMode": 0
  14. },
  15. "blendState": {
  16. "targets": [
  17. {
  18. "blend": true,
  19. "blendSrc": 2,
  20. "blendDst": 1,
  21. "blendSrcAlpha": 2,
  22. "blendDstAlpha": 1
  23. }
  24. ]
  25. },
  26. "program": "particles/builtin-particle-gpu|builtin/internal/particle-vs-gpu:gpvs_main|tinted-fs:add",
  27. "depthStencilState": {
  28. "depthTest": true,
  29. "depthWrite": false
  30. },
  31. "properties": {
  32. "mainTexture": {
  33. "value": "grey",
  34. "type": 28
  35. },
  36. "mainTiling_Offset": {
  37. "value": [
  38. 1,
  39. 1,
  40. 0,
  41. 0
  42. ],
  43. "type": 16
  44. },
  45. "tintColor": {
  46. "value": [
  47. 0.5,
  48. 0.5,
  49. 0.5,
  50. 0.5
  51. ],
  52. "editor": {
  53. "type": "color"
  54. },
  55. "type": 16
  56. }
  57. }
  58. },
  59. {
  60. "phase": "deferred-forward",
  61. "rasterizerState": {
  62. "cullMode": 0
  63. },
  64. "blendState": {
  65. "targets": [
  66. {
  67. "blend": true,
  68. "blendSrc": 2,
  69. "blendDst": 1,
  70. "blendSrcAlpha": 2,
  71. "blendDstAlpha": 1
  72. }
  73. ]
  74. },
  75. "propertyIndex": 0,
  76. "program": "particles/builtin-particle-gpu|builtin/internal/particle-vs-gpu:gpvs_main|tinted-fs:add",
  77. "depthStencilState": {
  78. "depthTest": true,
  79. "depthWrite": false
  80. }
  81. }
  82. ]
  83. },
  84. {
  85. "name": "alpha-blend",
  86. "passes": [
  87. {
  88. "rasterizerState": {
  89. "cullMode": 0
  90. },
  91. "blendState": {
  92. "targets": [
  93. {
  94. "blend": true,
  95. "blendSrc": 2,
  96. "blendDst": 4,
  97. "blendSrcAlpha": 0,
  98. "blendDstAlpha": 1,
  99. "blendAlphaEq": 4
  100. }
  101. ]
  102. },
  103. "program": "particles/builtin-particle-gpu|builtin/internal/particle-vs-gpu:gpvs_main|tinted-fs:add",
  104. "depthStencilState": {
  105. "depthTest": true,
  106. "depthWrite": false
  107. },
  108. "properties": {
  109. "mainTexture": {
  110. "value": "grey",
  111. "type": 28
  112. },
  113. "mainTiling_Offset": {
  114. "value": [
  115. 1,
  116. 1,
  117. 0,
  118. 0
  119. ],
  120. "type": 16
  121. },
  122. "tintColor": {
  123. "value": [
  124. 0.5,
  125. 0.5,
  126. 0.5,
  127. 0.5
  128. ],
  129. "editor": {
  130. "type": "color"
  131. },
  132. "type": 16
  133. }
  134. }
  135. },
  136. {
  137. "phase": "deferred-forward",
  138. "rasterizerState": {
  139. "cullMode": 0
  140. },
  141. "blendState": {
  142. "targets": [
  143. {
  144. "blend": true,
  145. "blendSrc": 2,
  146. "blendDst": 4,
  147. "blendSrcAlpha": 0,
  148. "blendDstAlpha": 1,
  149. "blendAlphaEq": 4
  150. }
  151. ]
  152. },
  153. "propertyIndex": 0,
  154. "program": "particles/builtin-particle-gpu|builtin/internal/particle-vs-gpu:gpvs_main|tinted-fs:add",
  155. "depthStencilState": {
  156. "depthTest": true,
  157. "depthWrite": false
  158. }
  159. }
  160. ]
  161. },
  162. {
  163. "name": "add-multiply",
  164. "passes": [
  165. {
  166. "rasterizerState": {
  167. "cullMode": 0
  168. },
  169. "blendState": {
  170. "targets": [
  171. {
  172. "blend": true,
  173. "blendSrc": 7,
  174. "blendDst": 1,
  175. "blendSrcAlpha": 0,
  176. "blendDstAlpha": 3
  177. }
  178. ]
  179. },
  180. "program": "particles/builtin-particle-gpu|builtin/internal/particle-vs-gpu:gpvs_main|tinted-fs:multiply",
  181. "depthStencilState": {
  182. "depthTest": true,
  183. "depthWrite": false
  184. },
  185. "properties": {
  186. "mainTexture": {
  187. "value": "grey",
  188. "type": 28
  189. },
  190. "mainTiling_Offset": {
  191. "value": [
  192. 1,
  193. 1,
  194. 0,
  195. 0
  196. ],
  197. "type": 16
  198. },
  199. "tintColor": {
  200. "value": [
  201. 0.5,
  202. 0.5,
  203. 0.5,
  204. 0.5
  205. ],
  206. "editor": {
  207. "type": "color"
  208. },
  209. "type": 16
  210. }
  211. }
  212. },
  213. {
  214. "phase": "deferred-forward",
  215. "rasterizerState": {
  216. "cullMode": 0
  217. },
  218. "blendState": {
  219. "targets": [
  220. {
  221. "blend": true,
  222. "blendSrc": 7,
  223. "blendDst": 1,
  224. "blendSrcAlpha": 0,
  225. "blendDstAlpha": 3
  226. }
  227. ]
  228. },
  229. "propertyIndex": 0,
  230. "program": "particles/builtin-particle-gpu|builtin/internal/particle-vs-gpu:gpvs_main|tinted-fs:multiply",
  231. "depthStencilState": {
  232. "depthTest": true,
  233. "depthWrite": false
  234. }
  235. }
  236. ]
  237. },
  238. {
  239. "name": "add-smooth",
  240. "passes": [
  241. {
  242. "rasterizerState": {
  243. "cullMode": 0
  244. },
  245. "blendState": {
  246. "targets": [
  247. {
  248. "blend": true,
  249. "blendSrc": 2,
  250. "blendDst": 1,
  251. "blendSrcAlpha": 2,
  252. "blendDstAlpha": 1
  253. }
  254. ]
  255. },
  256. "program": "particles/builtin-particle-gpu|builtin/internal/particle-vs-gpu:gpvs_main|no-tint-fs:addSmooth",
  257. "depthStencilState": {
  258. "depthTest": true,
  259. "depthWrite": false
  260. },
  261. "properties": {
  262. "mainTexture": {
  263. "value": "grey",
  264. "type": 28
  265. },
  266. "mainTiling_Offset": {
  267. "value": [
  268. 1,
  269. 1,
  270. 0,
  271. 0
  272. ],
  273. "type": 16
  274. }
  275. }
  276. },
  277. {
  278. "phase": "deferred-forward",
  279. "rasterizerState": {
  280. "cullMode": 0
  281. },
  282. "blendState": {
  283. "targets": [
  284. {
  285. "blend": true,
  286. "blendSrc": 2,
  287. "blendDst": 1,
  288. "blendSrcAlpha": 2,
  289. "blendDstAlpha": 1
  290. }
  291. ]
  292. },
  293. "propertyIndex": 0,
  294. "program": "particles/builtin-particle-gpu|builtin/internal/particle-vs-gpu:gpvs_main|no-tint-fs:addSmooth",
  295. "depthStencilState": {
  296. "depthTest": true,
  297. "depthWrite": false
  298. }
  299. }
  300. ]
  301. },
  302. {
  303. "name": "premultiply-blend",
  304. "passes": [
  305. {
  306. "rasterizerState": {
  307. "cullMode": 0
  308. },
  309. "blendState": {
  310. "targets": [
  311. {
  312. "blend": true,
  313. "blendSrc": 2,
  314. "blendDst": 4,
  315. "blendSrcAlpha": 0,
  316. "blendDstAlpha": 1,
  317. "blendAlphaEq": 4
  318. }
  319. ]
  320. },
  321. "program": "particles/builtin-particle-gpu|builtin/internal/particle-vs-gpu:gpvs_main|no-tint-fs:premultiplied",
  322. "depthStencilState": {
  323. "depthTest": true,
  324. "depthWrite": false
  325. },
  326. "properties": {
  327. "mainTexture": {
  328. "value": "grey",
  329. "type": 28
  330. },
  331. "mainTiling_Offset": {
  332. "value": [
  333. 1,
  334. 1,
  335. 0,
  336. 0
  337. ],
  338. "type": 16
  339. }
  340. }
  341. },
  342. {
  343. "phase": "deferred-forward",
  344. "rasterizerState": {
  345. "cullMode": 0
  346. },
  347. "blendState": {
  348. "targets": [
  349. {
  350. "blend": true,
  351. "blendSrc": 2,
  352. "blendDst": 4,
  353. "blendSrcAlpha": 0,
  354. "blendDstAlpha": 1,
  355. "blendAlphaEq": 4
  356. }
  357. ]
  358. },
  359. "propertyIndex": 0,
  360. "program": "particles/builtin-particle-gpu|builtin/internal/particle-vs-gpu:gpvs_main|no-tint-fs:premultiplied",
  361. "depthStencilState": {
  362. "depthTest": true,
  363. "depthWrite": false
  364. }
  365. }
  366. ]
  367. }
  368. ],
  369. "shaders": [
  370. {
  371. "blocks": [
  372. {
  373. "name": "Constants",
  374. "members": [
  375. {
  376. "name": "mainTiling_Offset",
  377. "type": 16,
  378. "count": 1
  379. },
  380. {
  381. "name": "frameTile_velLenScale",
  382. "type": 16,
  383. "count": 1
  384. },
  385. {
  386. "name": "scale",
  387. "type": 16,
  388. "count": 1
  389. },
  390. {
  391. "name": "nodeRotation",
  392. "type": 16,
  393. "count": 1
  394. }
  395. ],
  396. "defines": [],
  397. "stageFlags": 1,
  398. "binding": 0
  399. },
  400. {
  401. "name": "SampleConstants",
  402. "members": [
  403. {
  404. "name": "u_sampleInfo",
  405. "type": 16,
  406. "count": 1
  407. }
  408. ],
  409. "defines": [],
  410. "stageFlags": 1,
  411. "binding": 1
  412. },
  413. {
  414. "name": "TickConstants",
  415. "members": [
  416. {
  417. "name": "u_worldRot",
  418. "type": 16,
  419. "count": 1
  420. },
  421. {
  422. "name": "u_timeDelta",
  423. "type": 16,
  424. "count": 1
  425. }
  426. ],
  427. "defines": [],
  428. "stageFlags": 1,
  429. "binding": 2
  430. },
  431. {
  432. "name": "ColorConstant",
  433. "members": [
  434. {
  435. "name": "u_color_mode",
  436. "type": 5,
  437. "count": 1
  438. }
  439. ],
  440. "defines": [
  441. "COLOR_OVER_TIME_MODULE_ENABLE"
  442. ],
  443. "stageFlags": 1,
  444. "binding": 3
  445. },
  446. {
  447. "name": "RotationConstant",
  448. "members": [
  449. {
  450. "name": "u_rotation_mode",
  451. "type": 5,
  452. "count": 1
  453. }
  454. ],
  455. "defines": [
  456. "ROTATION_OVER_TIME_MODULE_ENABLE"
  457. ],
  458. "stageFlags": 1,
  459. "binding": 4
  460. },
  461. {
  462. "name": "SizeConstant",
  463. "members": [
  464. {
  465. "name": "u_size_mode",
  466. "type": 5,
  467. "count": 1
  468. }
  469. ],
  470. "defines": [
  471. "SIZE_OVER_TIME_MODULE_ENABLE"
  472. ],
  473. "stageFlags": 1,
  474. "binding": 5
  475. },
  476. {
  477. "name": "ForceConstant",
  478. "members": [
  479. {
  480. "name": "u_force_mode",
  481. "type": 5,
  482. "count": 1
  483. },
  484. {
  485. "name": "u_force_space",
  486. "type": 5,
  487. "count": 1
  488. }
  489. ],
  490. "defines": [
  491. "FORCE_OVER_TIME_MODULE_ENABLE"
  492. ],
  493. "stageFlags": 1,
  494. "binding": 6
  495. },
  496. {
  497. "name": "VelocityConstant",
  498. "members": [
  499. {
  500. "name": "u_velocity_mode",
  501. "type": 5,
  502. "count": 1
  503. },
  504. {
  505. "name": "u_velocity_space",
  506. "type": 5,
  507. "count": 1
  508. }
  509. ],
  510. "defines": [
  511. "VELOCITY_OVER_TIME_MODULE_ENABLE"
  512. ],
  513. "stageFlags": 1,
  514. "binding": 7
  515. },
  516. {
  517. "name": "AnimationConstant",
  518. "members": [
  519. {
  520. "name": "u_anim_info",
  521. "type": 16,
  522. "count": 1
  523. }
  524. ],
  525. "defines": [
  526. "TEXTURE_ANIMATION_MODULE_ENABLE"
  527. ],
  528. "stageFlags": 1,
  529. "binding": 8
  530. },
  531. {
  532. "name": "FragConstants",
  533. "members": [
  534. {
  535. "name": "tintColor",
  536. "type": 16,
  537. "count": 1
  538. }
  539. ],
  540. "defines": [],
  541. "stageFlags": 16,
  542. "binding": 9
  543. }
  544. ],
  545. "samplerTextures": [
  546. {
  547. "name": "color_over_time_tex0",
  548. "type": 28,
  549. "count": 1,
  550. "defines": [
  551. "COLOR_OVER_TIME_MODULE_ENABLE"
  552. ],
  553. "stageFlags": 1,
  554. "binding": 10
  555. },
  556. {
  557. "name": "rotation_over_time_tex0",
  558. "type": 28,
  559. "count": 1,
  560. "defines": [
  561. "ROTATION_OVER_TIME_MODULE_ENABLE"
  562. ],
  563. "stageFlags": 1,
  564. "binding": 11
  565. },
  566. {
  567. "name": "size_over_time_tex0",
  568. "type": 28,
  569. "count": 1,
  570. "defines": [
  571. "SIZE_OVER_TIME_MODULE_ENABLE"
  572. ],
  573. "stageFlags": 1,
  574. "binding": 12
  575. },
  576. {
  577. "name": "force_over_time_tex0",
  578. "type": 28,
  579. "count": 1,
  580. "defines": [
  581. "FORCE_OVER_TIME_MODULE_ENABLE"
  582. ],
  583. "stageFlags": 1,
  584. "binding": 13
  585. },
  586. {
  587. "name": "velocity_over_time_tex0",
  588. "type": 28,
  589. "count": 1,
  590. "defines": [
  591. "VELOCITY_OVER_TIME_MODULE_ENABLE"
  592. ],
  593. "stageFlags": 1,
  594. "binding": 14
  595. },
  596. {
  597. "name": "texture_animation_tex0",
  598. "type": 28,
  599. "count": 1,
  600. "defines": [
  601. "TEXTURE_ANIMATION_MODULE_ENABLE"
  602. ],
  603. "stageFlags": 1,
  604. "binding": 15
  605. },
  606. {
  607. "name": "mainTexture",
  608. "type": 28,
  609. "count": 1,
  610. "defines": [],
  611. "stageFlags": 16,
  612. "binding": 16
  613. }
  614. ],
  615. "samplers": [],
  616. "textures": [],
  617. "buffers": [],
  618. "images": [],
  619. "subpassInputs": [],
  620. "attributes": [
  621. {
  622. "name": "a_position_starttime",
  623. "defines": [],
  624. "format": 44,
  625. "location": 0
  626. },
  627. {
  628. "name": "a_color",
  629. "defines": [],
  630. "format": 44,
  631. "location": 1
  632. },
  633. {
  634. "name": "a_dir_life",
  635. "defines": [],
  636. "format": 44,
  637. "location": 2
  638. },
  639. {
  640. "name": "a_rndSeed",
  641. "defines": [],
  642. "format": 11,
  643. "location": 3
  644. },
  645. {
  646. "name": "a_size_uv",
  647. "defines": [
  648. "!CC_INSTANCE_PARTICLE"
  649. ],
  650. "format": 44,
  651. "location": 4
  652. },
  653. {
  654. "name": "a_rotation_uv",
  655. "defines": [
  656. "!CC_INSTANCE_PARTICLE"
  657. ],
  658. "format": 44,
  659. "location": 5
  660. },
  661. {
  662. "name": "a_size_fid",
  663. "defines": [
  664. "CC_INSTANCE_PARTICLE"
  665. ],
  666. "format": 44,
  667. "location": 6
  668. },
  669. {
  670. "name": "a_rotation",
  671. "defines": [
  672. "CC_INSTANCE_PARTICLE"
  673. ],
  674. "format": 32,
  675. "location": 7
  676. },
  677. {
  678. "name": "a_uv",
  679. "defines": [
  680. "CC_INSTANCE_PARTICLE"
  681. ],
  682. "format": 32,
  683. "location": 8
  684. },
  685. {
  686. "name": "a_texCoord",
  687. "defines": [
  688. "CC_RENDER_MODE"
  689. ],
  690. "format": 32,
  691. "location": 9
  692. },
  693. {
  694. "name": "a_texCoord3",
  695. "defines": [
  696. "CC_RENDER_MODE"
  697. ],
  698. "format": 32,
  699. "location": 10
  700. },
  701. {
  702. "name": "a_normal",
  703. "defines": [
  704. "CC_RENDER_MODE"
  705. ],
  706. "format": 32,
  707. "location": 11
  708. },
  709. {
  710. "name": "a_color1",
  711. "defines": [
  712. "CC_RENDER_MODE"
  713. ],
  714. "format": 44,
  715. "location": 12
  716. }
  717. ],
  718. "varyings": [
  719. {
  720. "name": "uv",
  721. "type": 14,
  722. "count": 1,
  723. "defines": [],
  724. "stageFlags": 17,
  725. "location": 0
  726. },
  727. {
  728. "name": "color",
  729. "type": 16,
  730. "count": 1,
  731. "defines": [],
  732. "stageFlags": 17,
  733. "location": 1
  734. }
  735. ],
  736. "fragColors": [
  737. {
  738. "name": "cc_FragColor",
  739. "typename": "vec4",
  740. "type": 16,
  741. "count": 1,
  742. "defines": [],
  743. "stageFlags": 16,
  744. "location": 0
  745. }
  746. ],
  747. "descriptors": [
  748. {
  749. "rate": 0,
  750. "blocks": [
  751. {
  752. "tags": {
  753. "builtin": "local"
  754. },
  755. "name": "CCLocal",
  756. "members": [
  757. {
  758. "name": "cc_matWorld",
  759. "typename": "mat4",
  760. "type": 25,
  761. "count": 1,
  762. "precision": "highp "
  763. },
  764. {
  765. "name": "cc_matWorldIT",
  766. "typename": "mat4",
  767. "type": 25,
  768. "count": 1,
  769. "precision": "highp "
  770. },
  771. {
  772. "name": "cc_lightingMapUVParam",
  773. "typename": "vec4",
  774. "type": 16,
  775. "count": 1,
  776. "precision": "highp "
  777. },
  778. {
  779. "name": "cc_localShadowBias",
  780. "typename": "vec4",
  781. "type": 16,
  782. "count": 1,
  783. "precision": "highp "
  784. },
  785. {
  786. "name": "cc_reflectionProbeData1",
  787. "typename": "vec4",
  788. "type": 16,
  789. "count": 1,
  790. "precision": "highp "
  791. },
  792. {
  793. "name": "cc_reflectionProbeData2",
  794. "typename": "vec4",
  795. "type": 16,
  796. "count": 1,
  797. "precision": "highp "
  798. },
  799. {
  800. "name": "cc_reflectionProbeBlendData1",
  801. "typename": "vec4",
  802. "type": 16,
  803. "count": 1,
  804. "precision": "highp "
  805. },
  806. {
  807. "name": "cc_reflectionProbeBlendData2",
  808. "typename": "vec4",
  809. "type": 16,
  810. "count": 1,
  811. "precision": "highp "
  812. }
  813. ],
  814. "defines": [],
  815. "stageFlags": 1
  816. }
  817. ],
  818. "samplerTextures": [],
  819. "samplers": [],
  820. "textures": [],
  821. "buffers": [],
  822. "images": [],
  823. "subpassInputs": []
  824. },
  825. {
  826. "rate": 1,
  827. "blocks": [
  828. {
  829. "name": "Constants",
  830. "members": [
  831. {
  832. "name": "mainTiling_Offset",
  833. "type": 16,
  834. "count": 1
  835. },
  836. {
  837. "name": "frameTile_velLenScale",
  838. "type": 16,
  839. "count": 1
  840. },
  841. {
  842. "name": "scale",
  843. "type": 16,
  844. "count": 1
  845. },
  846. {
  847. "name": "nodeRotation",
  848. "type": 16,
  849. "count": 1
  850. }
  851. ],
  852. "defines": [],
  853. "stageFlags": 1,
  854. "binding": 0
  855. },
  856. {
  857. "name": "SampleConstants",
  858. "members": [
  859. {
  860. "name": "u_sampleInfo",
  861. "type": 16,
  862. "count": 1
  863. }
  864. ],
  865. "defines": [],
  866. "stageFlags": 1,
  867. "binding": 1
  868. },
  869. {
  870. "name": "TickConstants",
  871. "members": [
  872. {
  873. "name": "u_worldRot",
  874. "type": 16,
  875. "count": 1
  876. },
  877. {
  878. "name": "u_timeDelta",
  879. "type": 16,
  880. "count": 1
  881. }
  882. ],
  883. "defines": [],
  884. "stageFlags": 1,
  885. "binding": 2
  886. },
  887. {
  888. "name": "ColorConstant",
  889. "members": [
  890. {
  891. "name": "u_color_mode",
  892. "type": 5,
  893. "count": 1
  894. }
  895. ],
  896. "defines": [
  897. "COLOR_OVER_TIME_MODULE_ENABLE"
  898. ],
  899. "stageFlags": 1,
  900. "binding": 3
  901. },
  902. {
  903. "name": "RotationConstant",
  904. "members": [
  905. {
  906. "name": "u_rotation_mode",
  907. "type": 5,
  908. "count": 1
  909. }
  910. ],
  911. "defines": [
  912. "ROTATION_OVER_TIME_MODULE_ENABLE"
  913. ],
  914. "stageFlags": 1,
  915. "binding": 4
  916. },
  917. {
  918. "name": "SizeConstant",
  919. "members": [
  920. {
  921. "name": "u_size_mode",
  922. "type": 5,
  923. "count": 1
  924. }
  925. ],
  926. "defines": [
  927. "SIZE_OVER_TIME_MODULE_ENABLE"
  928. ],
  929. "stageFlags": 1,
  930. "binding": 5
  931. },
  932. {
  933. "name": "ForceConstant",
  934. "members": [
  935. {
  936. "name": "u_force_mode",
  937. "type": 5,
  938. "count": 1
  939. },
  940. {
  941. "name": "u_force_space",
  942. "type": 5,
  943. "count": 1
  944. }
  945. ],
  946. "defines": [
  947. "FORCE_OVER_TIME_MODULE_ENABLE"
  948. ],
  949. "stageFlags": 1,
  950. "binding": 6
  951. },
  952. {
  953. "name": "VelocityConstant",
  954. "members": [
  955. {
  956. "name": "u_velocity_mode",
  957. "type": 5,
  958. "count": 1
  959. },
  960. {
  961. "name": "u_velocity_space",
  962. "type": 5,
  963. "count": 1
  964. }
  965. ],
  966. "defines": [
  967. "VELOCITY_OVER_TIME_MODULE_ENABLE"
  968. ],
  969. "stageFlags": 1,
  970. "binding": 7
  971. },
  972. {
  973. "name": "AnimationConstant",
  974. "members": [
  975. {
  976. "name": "u_anim_info",
  977. "type": 16,
  978. "count": 1
  979. }
  980. ],
  981. "defines": [
  982. "TEXTURE_ANIMATION_MODULE_ENABLE"
  983. ],
  984. "stageFlags": 1,
  985. "binding": 8
  986. },
  987. {
  988. "name": "FragConstants",
  989. "members": [
  990. {
  991. "name": "tintColor",
  992. "type": 16,
  993. "count": 1
  994. }
  995. ],
  996. "defines": [],
  997. "stageFlags": 16,
  998. "binding": 9
  999. }
  1000. ],
  1001. "samplerTextures": [
  1002. {
  1003. "name": "color_over_time_tex0",
  1004. "type": 28,
  1005. "count": 1,
  1006. "defines": [
  1007. "COLOR_OVER_TIME_MODULE_ENABLE"
  1008. ],
  1009. "stageFlags": 1,
  1010. "binding": 10
  1011. },
  1012. {
  1013. "name": "rotation_over_time_tex0",
  1014. "type": 28,
  1015. "count": 1,
  1016. "defines": [
  1017. "ROTATION_OVER_TIME_MODULE_ENABLE"
  1018. ],
  1019. "stageFlags": 1,
  1020. "binding": 11
  1021. },
  1022. {
  1023. "name": "size_over_time_tex0",
  1024. "type": 28,
  1025. "count": 1,
  1026. "defines": [
  1027. "SIZE_OVER_TIME_MODULE_ENABLE"
  1028. ],
  1029. "stageFlags": 1,
  1030. "binding": 12
  1031. },
  1032. {
  1033. "name": "force_over_time_tex0",
  1034. "type": 28,
  1035. "count": 1,
  1036. "defines": [
  1037. "FORCE_OVER_TIME_MODULE_ENABLE"
  1038. ],
  1039. "stageFlags": 1,
  1040. "binding": 13
  1041. },
  1042. {
  1043. "name": "velocity_over_time_tex0",
  1044. "type": 28,
  1045. "count": 1,
  1046. "defines": [
  1047. "VELOCITY_OVER_TIME_MODULE_ENABLE"
  1048. ],
  1049. "stageFlags": 1,
  1050. "binding": 14
  1051. },
  1052. {
  1053. "name": "texture_animation_tex0",
  1054. "type": 28,
  1055. "count": 1,
  1056. "defines": [
  1057. "TEXTURE_ANIMATION_MODULE_ENABLE"
  1058. ],
  1059. "stageFlags": 1,
  1060. "binding": 15
  1061. },
  1062. {
  1063. "name": "mainTexture",
  1064. "type": 28,
  1065. "count": 1,
  1066. "defines": [],
  1067. "stageFlags": 16,
  1068. "binding": 16
  1069. }
  1070. ],
  1071. "samplers": [],
  1072. "textures": [],
  1073. "buffers": [],
  1074. "images": [],
  1075. "subpassInputs": []
  1076. },
  1077. {
  1078. "rate": 2,
  1079. "blocks": [],
  1080. "samplerTextures": [],
  1081. "samplers": [],
  1082. "textures": [],
  1083. "buffers": [],
  1084. "images": [],
  1085. "subpassInputs": []
  1086. },
  1087. {
  1088. "rate": 3,
  1089. "blocks": [
  1090. {
  1091. "tags": {
  1092. "builtin": "global"
  1093. },
  1094. "name": "CCGlobal",
  1095. "members": [
  1096. {
  1097. "name": "cc_time",
  1098. "typename": "vec4",
  1099. "type": 16,
  1100. "count": 1,
  1101. "precision": "highp "
  1102. },
  1103. {
  1104. "name": "cc_screenSize",
  1105. "typename": "vec4",
  1106. "type": 16,
  1107. "count": 1,
  1108. "precision": "mediump "
  1109. },
  1110. {
  1111. "name": "cc_nativeSize",
  1112. "typename": "vec4",
  1113. "type": 16,
  1114. "count": 1,
  1115. "precision": "mediump "
  1116. },
  1117. {
  1118. "name": "cc_probeInfo",
  1119. "typename": "vec4",
  1120. "type": 16,
  1121. "count": 1,
  1122. "precision": "mediump "
  1123. },
  1124. {
  1125. "name": "cc_debug_view_mode",
  1126. "typename": "vec4",
  1127. "type": 16,
  1128. "count": 1,
  1129. "precision": "mediump "
  1130. }
  1131. ],
  1132. "defines": [],
  1133. "stageFlags": 17
  1134. },
  1135. {
  1136. "tags": {
  1137. "builtin": "global"
  1138. },
  1139. "name": "CCCamera",
  1140. "members": [
  1141. {
  1142. "name": "cc_matView",
  1143. "typename": "mat4",
  1144. "type": 25,
  1145. "count": 1,
  1146. "precision": "highp "
  1147. },
  1148. {
  1149. "name": "cc_matViewInv",
  1150. "typename": "mat4",
  1151. "type": 25,
  1152. "count": 1,
  1153. "precision": "highp "
  1154. },
  1155. {
  1156. "name": "cc_matProj",
  1157. "typename": "mat4",
  1158. "type": 25,
  1159. "count": 1,
  1160. "precision": "highp "
  1161. },
  1162. {
  1163. "name": "cc_matProjInv",
  1164. "typename": "mat4",
  1165. "type": 25,
  1166. "count": 1,
  1167. "precision": "highp "
  1168. },
  1169. {
  1170. "name": "cc_matViewProj",
  1171. "typename": "mat4",
  1172. "type": 25,
  1173. "count": 1,
  1174. "precision": "highp "
  1175. },
  1176. {
  1177. "name": "cc_matViewProjInv",
  1178. "typename": "mat4",
  1179. "type": 25,
  1180. "count": 1,
  1181. "precision": "highp "
  1182. },
  1183. {
  1184. "name": "cc_cameraPos",
  1185. "typename": "vec4",
  1186. "type": 16,
  1187. "count": 1,
  1188. "precision": "highp "
  1189. },
  1190. {
  1191. "name": "cc_surfaceTransform",
  1192. "typename": "vec4",
  1193. "type": 16,
  1194. "count": 1,
  1195. "precision": "mediump "
  1196. },
  1197. {
  1198. "name": "cc_screenScale",
  1199. "typename": "vec4",
  1200. "type": 16,
  1201. "count": 1,
  1202. "precision": "mediump "
  1203. },
  1204. {
  1205. "name": "cc_exposure",
  1206. "typename": "vec4",
  1207. "type": 16,
  1208. "count": 1,
  1209. "precision": "mediump "
  1210. },
  1211. {
  1212. "name": "cc_mainLitDir",
  1213. "typename": "vec4",
  1214. "type": 16,
  1215. "count": 1,
  1216. "precision": "mediump "
  1217. },
  1218. {
  1219. "name": "cc_mainLitColor",
  1220. "typename": "vec4",
  1221. "type": 16,
  1222. "count": 1,
  1223. "precision": "mediump "
  1224. },
  1225. {
  1226. "name": "cc_ambientSky",
  1227. "typename": "vec4",
  1228. "type": 16,
  1229. "count": 1,
  1230. "precision": "mediump "
  1231. },
  1232. {
  1233. "name": "cc_ambientGround",
  1234. "typename": "vec4",
  1235. "type": 16,
  1236. "count": 1,
  1237. "precision": "mediump "
  1238. },
  1239. {
  1240. "name": "cc_fogColor",
  1241. "typename": "vec4",
  1242. "type": 16,
  1243. "count": 1,
  1244. "precision": "mediump "
  1245. },
  1246. {
  1247. "name": "cc_fogBase",
  1248. "typename": "vec4",
  1249. "type": 16,
  1250. "count": 1,
  1251. "precision": "mediump "
  1252. },
  1253. {
  1254. "name": "cc_fogAdd",
  1255. "typename": "vec4",
  1256. "type": 16,
  1257. "count": 1,
  1258. "precision": "mediump "
  1259. },
  1260. {
  1261. "name": "cc_nearFar",
  1262. "typename": "vec4",
  1263. "type": 16,
  1264. "count": 1,
  1265. "precision": "mediump "
  1266. },
  1267. {
  1268. "name": "cc_viewPort",
  1269. "typename": "vec4",
  1270. "type": 16,
  1271. "count": 1,
  1272. "precision": "mediump "
  1273. }
  1274. ],
  1275. "defines": [],
  1276. "stageFlags": 17
  1277. }
  1278. ],
  1279. "samplerTextures": [],
  1280. "samplers": [],
  1281. "textures": [],
  1282. "buffers": [],
  1283. "images": [],
  1284. "subpassInputs": []
  1285. }
  1286. ],
  1287. "hash": 2859307513,
  1288. "glsl4": {
  1289. "vert": "\nprecision mediump float;\nvec4 quaternionFromAxis (vec3 xAxis,vec3 yAxis,vec3 zAxis){\n mat3 m = mat3(xAxis,yAxis,zAxis);\n float trace = m[0][0] + m[1][1] + m[2][2];\n vec4 quat;\n if (trace > 0.) {\n float s = 0.5 / sqrt(trace + 1.0);\n quat.w = 0.25 / s;\n quat.x = (m[2][1] - m[1][2]) * s;\n quat.y = (m[0][2] - m[2][0]) * s;\n quat.z = (m[1][0] - m[0][1]) * s;\n } else if ((m[0][0] > m[1][1]) && (m[0][0] > m[2][2])) {\n float s = 2.0 * sqrt(1.0 + m[0][0] - m[1][1] - m[2][2]);\n quat.w = (m[2][1] - m[1][2]) / s;\n quat.x = 0.25 * s;\n quat.y = (m[0][1] + m[1][0]) / s;\n quat.z = (m[0][2] + m[2][0]) / s;\n } else if (m[1][1] > m[2][2]) {\n float s = 2.0 * sqrt(1.0 + m[1][1] - m[0][0] - m[2][2]);\n quat.w = (m[0][2] - m[2][0]) / s;\n quat.x = (m[0][1] + m[1][0]) / s;\n quat.y = 0.25 * s;\n quat.z = (m[1][2] + m[2][1]) / s;\n } else {\n float s = 2.0 * sqrt(1.0 + m[2][2] - m[0][0] - m[1][1]);\n quat.w = (m[1][0] - m[0][1]) / s;\n quat.x = (m[0][2] + m[2][0]) / s;\n quat.y = (m[1][2] + m[2][1]) / s;\n quat.z = 0.25 * s;\n }\n float len = quat.x * quat.x + quat.y * quat.y + quat.z * quat.z + quat.w * quat.w;\n if (len > 0.) {\n len = 1. / sqrt(len);\n quat.x = quat.x * len;\n quat.y = quat.y * len;\n quat.z = quat.z * len;\n quat.w = quat.w * len;\n }\n return quat;\n}\nvec4 quaternionFromEuler (vec3 angle){\n float x = angle.x / 2.;\n float y = angle.y / 2.;\n float z = angle.z / 2.;\n float sx = sin(x);\n float cx = cos(x);\n float sy = sin(y);\n float cy = cos(y);\n float sz = sin(z);\n float cz = cos(z);\n vec4 quat = vec4(0);\n quat.x = sx * cy * cz + cx * sy * sz;\n quat.y = cx * sy * cz + sx * cy * sz;\n quat.z = cx * cy * sz - sx * sy * cz;\n quat.w = cx * cy * cz - sx * sy * sz;\n return quat;\n}\nmat4 matrixFromRT (vec4 q, vec3 p){\n float x2 = q.x + q.x;\n float y2 = q.y + q.y;\n float z2 = q.z + q.z;\n float xx = q.x * x2;\n float xy = q.x * y2;\n float xz = q.x * z2;\n float yy = q.y * y2;\n float yz = q.y * z2;\n float zz = q.z * z2;\n float wx = q.w * x2;\n float wy = q.w * y2;\n float wz = q.w * z2;\n return mat4(\n 1. - (yy + zz), xy + wz, xz - wy, 0,\n xy - wz, 1. - (xx + zz), yz + wx, 0,\n xz + wy, yz - wx, 1. - (xx + yy), 0,\n p.x, p.y, p.z, 1\n );\n}\nmat4 matFromRTS (vec4 q, vec3 t, vec3 s){\n float x = q.x, y = q.y, z = q.z, w = q.w;\n float x2 = x + x;\n float y2 = y + y;\n float z2 = z + z;\n float xx = x * x2;\n float xy = x * y2;\n float xz = x * z2;\n float yy = y * y2;\n float yz = y * z2;\n float zz = z * z2;\n float wx = w * x2;\n float wy = w * y2;\n float wz = w * z2;\n float sx = s.x;\n float sy = s.y;\n float sz = s.z;\n return mat4((1. - (yy + zz)) * sx, (xy + wz) * sx, (xz - wy) * sx, 0,\n (xy - wz) * sy, (1. - (xx + zz)) * sy, (yz + wx) * sy, 0,\n (xz + wy) * sz, (yz - wx) * sz, (1. - (xx + yy)) * sz, 0,\n t.x, t.y, t.z, 1);\n}\nvec4 quatMultiply (vec4 a, vec4 b){\n vec4 quat;\n quat.x = a.x * b.w + a.w * b.x + a.y * b.z - a.z * b.y;\n quat.y = a.y * b.w + a.w * b.y + a.z * b.x - a.x * b.z;\n quat.z = a.z * b.w + a.w * b.z + a.x * b.y - a.y * b.x;\n quat.w = a.w * b.w - a.x * b.x - a.y * b.y - a.z * b.z;\n return quat;\n}\nvoid rotateVecFromQuat (inout vec3 v, vec4 q){\n float ix = q.w * v.x + q.y * v.z - q.z * v.y;\n float iy = q.w * v.y + q.z * v.x - q.x * v.z;\n float iz = q.w * v.z + q.x * v.y - q.y * v.x;\n float iw = -q.x * v.x - q.y * v.y - q.z * v.z;\n v.x = ix * q.w + iw * -q.x + iy * -q.z - iz * -q.y;\n v.y = iy * q.w + iw * -q.y + iz * -q.x - ix * -q.z;\n v.z = iz * q.w + iw * -q.z + ix * -q.y - iy * -q.x;\n}\nvec3 rotateInLocalSpace (vec3 pos, vec3 xAxis, vec3 yAxis, vec3 zAxis, vec4 q){\n vec4 viewQuat = quaternionFromAxis(xAxis, yAxis, zAxis);\n vec4 rotQuat = quatMultiply(viewQuat, q);\n rotateVecFromQuat(pos, rotQuat);\n return pos;\n}\nmat3 quatToMat3(vec4 q) {\n vec3 m0 = vec3(\n 1.0 - 2.0 * q.y * q.y - 2.0 * q.z * q.z,\n 2.0 * q.x * q.y + 2.0 * q.w * q.z,\n 2.0 * q.x * q.z - 2.0 * q.w * q.y);\n\tvec3 m1 = vec3(\n 2.0 * q.x * q.y - 2.0 * q.w * q.z,\n 1.0 - 2.0 * q.x * q.x - 2.0 * q.z * q.z,\n 2.0 * q.y * q.z + 2.0 * q.w * q.x);\n\tvec3 m2 = vec3(\n 2.0 * q.x * q.z + 2.0 * q.w * q.y,\n 2.0 * q.y * q.z - 2.0 * q.w * q.x,\n 1.0 - 2.0 * q.x * q.x - 2.0 * q.y * q.y);\n return mat3(m0, m1, m2);\n}\nvec4 mat3ToQuat(mat3 mat) {\n float tr = mat[0][0] + mat[1][1] + mat[2][2];\n\tfloat qw, qx, qy, qz;\n if (tr > 0.0) {\n float S = sqrt(tr + 1.0) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = 0.25 * S;\n\t qx = (mat[1][2] - mat[2][1]) * invS;\n\t qy = (mat[2][0] - mat[0][2]) * invS;\n\t qz = (mat[0][1] - mat[1][0]) * invS;\n } else if ((mat[0][0] > mat[1][1])&&(mat[0][0] > mat[2][2])) {\n float S = sqrt(1.0 + mat[0][0] - mat[1][1] - mat[2][2]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[1][2] - mat[2][1]) * invS;\n\t qx = 0.25 * S;\n\t qy = (mat[1][0] + mat[0][1]) * invS;\n\t qz = (mat[2][0] + mat[0][2]) * invS;\n } else if (mat[1][1] > mat[2][2]) {\n\t float S = sqrt(1.0 + mat[1][1] - mat[0][0] - mat[2][2]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[2][0] - mat[0][2]) * invS;\n\t qx = (mat[1][0] + mat[0][1]) * invS;\n\t qy = 0.25 * S;\n\t qz = (mat[2][1] + mat[1][2]) * invS;\n } else {\n\t float S = sqrt(1.0 + mat[2][2] - mat[0][0] - mat[1][1]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[0][1] - mat[1][0]) * invS;\n\t qx = (mat[2][0] + mat[0][2]) * invS;\n\t qy = (mat[2][1] + mat[1][2]) * invS;\n\t qz = 0.25 * S;\n }\n return vec4(qx, qy, qz, qw);\n}\nvec4 eulerToQuat(vec3 euler) {\n vec3 er = euler * 0.5;\n float x = er.x, y = er.y, z = er.z;\n float sx = sin(x);\n float cx = cos(x);\n float sy = sin(y);\n float cy = cos(y);\n float sz = sin(z);\n float cz = cos(z);\n vec4 quat;\n quat.x = sx * cy * cz + cx * sy * sz;\n quat.y = cx * sy * cz + sx * cy * sz;\n quat.z = cx * cy * sz - sx * sy * cz;\n quat.w = cx * cy * cz - sx * sy * sz;\n return quat;\n}\nlayout(set = 1, binding = 0) uniform Constants {\n vec4 mainTiling_Offset;\n vec4 frameTile_velLenScale;\n vec4 scale;\n vec4 nodeRotation;\n};\nlayout(set = 0, binding = 0) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(set = 0, binding = 1) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nlayout(set = 2, binding = 0) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n};\nlayout(location = 0) out mediump vec2 uv;\nlayout(location = 1) out mediump vec4 color;\nvoid computeVertPos (inout vec4 pos, vec2 vertOffset, vec4 q, vec3 s\n#if CC_RENDER_MODE == 0 || CC_RENDER_MODE == 3\n , mat4 viewInv\n#endif\n#if CC_RENDER_MODE == 1\n , vec3 eye\n , vec4 velocity\n , float velocityScale\n , float lengthScale\n , float xIndex\n#endif\n) {\n#if CC_RENDER_MODE == 0\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n vec3 camX = normalize(vec3(viewInv[0][0], viewInv[1][0], viewInv[2][0]));\n vec3 camY = normalize(vec3(viewInv[0][1], viewInv[1][1], viewInv[2][1]));\n vec3 camZ = normalize(vec3(viewInv[0][2], viewInv[1][2], viewInv[2][2]));\n pos.xyz += rotateInLocalSpace(viewSpaceVert, camX, camY, camZ, q);\n#elif CC_RENDER_MODE == 1\n vec3 camRight = normalize(cross(pos.xyz - eye, velocity.xyz)) * s.x;\n vec3 camUp = velocity.xyz * velocityScale + normalize(velocity.xyz) * lengthScale * s.y;\n pos.xyz += (camRight * abs(vertOffset.x) * sign(vertOffset.y)) - camUp * xIndex;\n#elif CC_RENDER_MODE == 2\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n vec3 camX = vec3(1, 0, 0);\n vec3 camY = vec3(0, 0, -1);\n pos.xyz += rotateInLocalSpace(viewSpaceVert, camX, camY, cross(camX, camY), q);\n#elif CC_RENDER_MODE == 3\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n rotateVecFromQuat(viewSpaceVert, q);\n vec3 camX = normalize(vec3(cc_matView[0][0], cc_matView[1][0], cc_matView[2][0]));\n vec3 camY = vec3(0, 1, 0);\n vec3 offset = camX * viewSpaceVert.x + camY * viewSpaceVert.y;\n pos.xyz += offset;\n#else\n pos.x += vertOffset.x;\n pos.y += vertOffset.y;\n#endif\n}\nvec2 computeUV (float frameIndex, vec2 vertIndex, vec2 frameTile){\n vec2 aniUV = vec2(0, floor(frameIndex * frameTile.y));\n aniUV.x = floor(frameIndex * frameTile.x * frameTile.y - aniUV.y * frameTile.x);\n#if CC_RENDER_MODE != 4\n vertIndex.y = 1. - vertIndex.y;\n#endif\n return (aniUV.xy + vertIndex) / vec2(frameTile.x, frameTile.y);\n}\nlayout(set = 1, binding = 1) uniform SampleConstants {\n vec4 u_sampleInfo;\n};\nlayout(set = 1, binding = 2) uniform TickConstants {\n vec4 u_worldRot;\n vec4 u_timeDelta;\n};\nlayout(location = 0) in vec4 a_position_starttime;\nlayout(location = 1) in vec4 a_color;\nlayout(location = 2) in vec4 a_dir_life;\nlayout(location = 3) in float a_rndSeed;\n#if !CC_INSTANCE_PARTICLE\n layout(location = 4) in vec4 a_size_uv;\n layout(location = 5) in vec4 a_rotation_uv;\n#endif\n#if CC_INSTANCE_PARTICLE\n layout(location = 6) in vec4 a_size_fid;\n layout(location = 7) in vec3 a_rotation;\n layout(location = 8) in vec3 a_uv;\n#endif\n#if CC_RENDER_MODE == 4\n layout(location = 9) in vec3 a_texCoord;\n layout(location = 10) in vec3 a_texCoord3;\n layout(location = 11) in vec3 a_normal;\n layout(location = 12) in vec4 a_color1;\n#endif\nvec3 unpackCurveData (sampler2D tex, vec2 coord) {\n vec4 a = texture(tex, coord);\n vec4 b = texture(tex, coord + u_sampleInfo.y);\n float c = fract(coord.x * u_sampleInfo.x);\n return mix(a.xyz, b.xyz, c);\n}\nvec3 unpackCurveData (sampler2D tex, vec2 coord, out float w) {\n vec4 a = texture(tex, coord);\n vec4 b = texture(tex, coord + u_sampleInfo.y);\n float c = fract(coord.x * u_sampleInfo.x);\n w = mix(a.w, b.w, c);\n return mix(a.xyz, b.xyz, c);\n}\nfloat pseudoRandom(float x) {\n#if USE_VK_SHADER\n float o = x;\n x = mod(x - 1.0, 2.0) - 1.0;\n float freqVar = 10.16640753482;\n float y = sin(freqVar * floor(o * 0.5 - 0.5));\n float v = max(0.0, 1.0-abs(x));\n v *= 0.7071067812;\n v = y < 0.0 ? -v : v;\n return v;\n#endif\n#if !USE_VK_SHADER\n float seed = mod(x, 233280.);\n float q = (seed * 9301. + 49297.) / 233280.;\n return fract(q);\n#endif\n}\n#if COLOR_OVER_TIME_MODULE_ENABLE\n layout(set = 1, binding = 10) uniform sampler2D color_over_time_tex0;\n layout(set = 1, binding = 3) uniform ColorConstant {\n int u_color_mode;\n };\n#endif\n#if ROTATION_OVER_TIME_MODULE_ENABLE\n layout(set = 1, binding = 11) uniform sampler2D rotation_over_time_tex0;\n layout(set = 1, binding = 4) uniform RotationConstant {\n int u_rotation_mode;\n };\n#endif\n#if SIZE_OVER_TIME_MODULE_ENABLE\n layout(set = 1, binding = 12) uniform sampler2D size_over_time_tex0;\n layout(set = 1, binding = 5) uniform SizeConstant {\n int u_size_mode;\n };\n#endif\n#if FORCE_OVER_TIME_MODULE_ENABLE\n layout(set = 1, binding = 13) uniform sampler2D force_over_time_tex0;\n layout(set = 1, binding = 6) uniform ForceConstant {\n int u_force_mode;\n int u_force_space;\n };\n#endif\n#if VELOCITY_OVER_TIME_MODULE_ENABLE\n layout(set = 1, binding = 14) uniform sampler2D velocity_over_time_tex0;\n layout(set = 1, binding = 7) uniform VelocityConstant {\n int u_velocity_mode;\n int u_velocity_space;\n };\n#endif\n#if TEXTURE_ANIMATION_MODULE_ENABLE\n layout(set = 1, binding = 15) uniform sampler2D texture_animation_tex0;\n layout(set = 1, binding = 8) uniform AnimationConstant {\n vec4 u_anim_info;\n };\n#endif\nfloat repeat (float t, float length) {\n return t - floor(t / length) * length;\n}\nvec4 rotateQuat (vec4 p, vec4 q) {\n vec3 iv = cross(q.xyz, p.xyz) + q.w * p.xyz;\n vec3 res = p.xyz + 2.0 * cross(q.xyz, iv);\n return vec4(res.xyz, p.w);\n}\nvec4 gpvs_main () {\n float activeTime = u_timeDelta.x - a_position_starttime.w;\n float normalizedTime = clamp(activeTime / a_dir_life.w, 0.0, 1.0);\n vec2 timeCoord0 = vec2(normalizedTime, 0.);\n vec2 timeCoord1 = vec2(normalizedTime, 1.);\n #if CC_RENDER_MODE == 4\n vec2 vertIdx = vec2(a_texCoord.x, a_texCoord.y);\n #endif\n #if CC_RENDER_MODE != 4\n #if !CC_INSTANCE_PARTICLE\n vec2 vertIdx = vec2(a_size_uv.w, a_rotation_uv.w);\n #endif\n #if CC_INSTANCE_PARTICLE\n vec2 vertIdx = a_uv.xy;\n #endif\n #endif\n vec4 velocity = vec4(a_dir_life.xyz, 0.);\n vec4 pos = vec4(a_position_starttime.xyz, 1.);\n #if !CC_INSTANCE_PARTICLE\n vec3 size = a_size_uv.xyz;\n #endif\n #if CC_INSTANCE_PARTICLE\n vec3 size = a_size_fid.xyz;\n #endif\n #if SIZE_OVER_TIME_MODULE_ENABLE\n if (u_size_mode == 1) {\n size *= unpackCurveData(size_over_time_tex0, timeCoord0);\n } else {\n vec3 size_0 = unpackCurveData(size_over_time_tex0, timeCoord0);\n vec3 size_1 = unpackCurveData(size_over_time_tex0, timeCoord1);\n float factor_s = pseudoRandom(a_rndSeed + 39825.);\n size *= mix(size_0, size_1, factor_s);\n }\n #endif\n vec3 compScale = scale.xyz * size;\n #if FORCE_OVER_TIME_MODULE_ENABLE\n vec3 forceAnim = vec3(0.);\n if (u_force_mode == 1) {\n forceAnim = unpackCurveData(force_over_time_tex0, timeCoord0);\n } else {\n vec3 force_0 = unpackCurveData(force_over_time_tex0, timeCoord0);\n vec3 force_1 = unpackCurveData(force_over_time_tex0, timeCoord1);\n float factor_f = pseudoRandom(a_rndSeed + 212165.);\n forceAnim = mix(force_0, force_1, factor_f);\n }\n vec4 forceTrack = vec4(forceAnim, 0.);\n if (u_force_space == 0) {\n forceTrack = rotateQuat(forceTrack, u_worldRot);\n }\n velocity.xyz += forceTrack.xyz;\n #endif\n #if VELOCITY_OVER_TIME_MODULE_ENABLE\n float speedModifier0 = 1.;\n float speedModifier1 = 1.;\n vec3 velocityAnim = vec3(0.);\n if (u_velocity_mode == 1) {\n velocityAnim = unpackCurveData(velocity_over_time_tex0, timeCoord0, speedModifier0);\n } else {\n vec3 vectory_0 = unpackCurveData(velocity_over_time_tex0, timeCoord0, speedModifier0);\n vec3 vectory_1 = unpackCurveData(velocity_over_time_tex0, timeCoord1, speedModifier1);\n float factor_v = pseudoRandom(a_rndSeed + 197866.);\n velocityAnim = mix(vectory_0, vectory_1, factor_v);\n speedModifier0 = mix(speedModifier0, speedModifier1, factor_v);\n }\n vec4 velocityTrack = vec4(velocityAnim, 0.);\n if (u_velocity_space == 0) {\n velocityTrack = rotateQuat(velocityTrack, u_worldRot);\n }\n velocity.xyz += velocityTrack.xyz;\n velocity.xyz *= speedModifier0;\n #endif\n pos.xyz += velocity.xyz * normalizedTime * a_dir_life.w;\n #if !CC_USE_WORLD_SPACE\n pos = cc_matWorld * pos;\n #if CC_RENDER_MODE == 1\n velocity = rotateQuat(velocity, u_worldRot);\n #endif\n #endif\n #if !CC_INSTANCE_PARTICLE\n vec3 startRotation = a_rotation_uv.xyz;\n #endif\n #if CC_INSTANCE_PARTICLE\n vec3 startRotation = a_rotation;\n #endif\n #if CC_RENDER_MODE != 4\n #if CC_RENDER_MODE == 0\n vec3 rotEuler = startRotation.xyz;\n #elif CC_RENDER_MODE == 1\n vec3 rotEuler = vec3(0.);\n #endif\n #if CC_RENDER_MODE != 0 && CC_RENDER_MODE != 1\n vec3 rotEuler = vec3(0., 0., startRotation.z);\n #endif\n vec4 rot = quaternionFromEuler(rotEuler);\n #endif\n #if CC_RENDER_MODE == 4\n vec4 rot = quaternionFromEuler(startRotation);\n #endif\n #if ROTATION_OVER_TIME_MODULE_ENABLE\n if (u_rotation_mode == 1) {\n vec3 euler = unpackCurveData(rotation_over_time_tex0, timeCoord0) * normalizedTime * a_dir_life.w;\n vec4 quat = eulerToQuat(euler);\n mat3 mLocal = quatToMat3(quat);\n mat3 mStart = quatToMat3(rot);\n rot = mat3ToQuat(mStart * mLocal);\n } else {\n vec3 rotation_0 = unpackCurveData(rotation_over_time_tex0, timeCoord0);\n vec3 rotation_1 = unpackCurveData(rotation_over_time_tex0, timeCoord1);\n float factor_r = pseudoRandom(a_rndSeed + 125292.);\n vec3 euler = mix(rotation_0, rotation_1, factor_r) * normalizedTime * a_dir_life.w;\n #if CC_RENDER_MODE == 3 || CC_RENDER_MODE == 2\n euler = vec3(0.0, 0.0, euler.z);\n #endif\n vec4 quat = eulerToQuat(euler);\n mat3 mLocal = quatToMat3(quat);\n mat3 mStart = quatToMat3(rot);\n rot = mat3ToQuat(mStart * mLocal);\n }\n #endif\n #if COLOR_OVER_TIME_MODULE_ENABLE\n if (u_color_mode == 1) {\n color = a_color * texture(color_over_time_tex0, timeCoord0);\n } else {\n vec4 color_0 = texture(color_over_time_tex0, timeCoord0);\n vec4 color_1 = texture(color_over_time_tex0, timeCoord1);\n float factor_c = pseudoRandom(a_rndSeed + 91041.);\n color = a_color * mix(color_0, color_1, factor_c);\n }\n #endif\n #if !COLOR_OVER_TIME_MODULE_ENABLE\n color = a_color;\n #endif\n #if CC_RENDER_MODE != 4\n vec2 cornerOffset = vec2((vertIdx - 0.5));\n #if CC_RENDER_MODE == 1\n rot = vec4(0.0, 0.0, 0.0, 1.0);\n #endif\n computeVertPos(pos, cornerOffset, rot, compScale\n #if CC_RENDER_MODE == 0 || CC_RENDER_MODE == 3\n , cc_matViewInv\n #endif\n #if CC_RENDER_MODE == 1\n , cc_cameraPos.xyz\n , velocity\n , frameTile_velLenScale.z\n , frameTile_velLenScale.w\n #if !CC_INSTANCE_PARTICLE\n , a_size_uv.w\n #endif\n #if CC_INSTANCE_PARTICLE\n , a_uv.x\n #endif\n #endif\n );\n #endif\n #if CC_RENDER_MODE == 4\n mat3 rotMat = quatToMat3(rot);\n mat3 nodeMat = quatToMat3(nodeRotation);\n rotMat = nodeMat * rotMat;\n rot = mat3ToQuat(rotMat);\n mat4 xformNoScale = matrixFromRT(rot, pos.xyz);\n mat4 xform = matFromRTS(rot, pos.xyz, compScale);\n pos = xform * vec4(a_texCoord3, 1);\n vec4 normal = xformNoScale * vec4(a_normal, 0);\n color *= a_color1;\n #endif\n pos = cc_matViewProj * pos;\n float frameIndex = 0.;\n #if TEXTURE_ANIMATION_MODULE_ENABLE\n float startFrame = 0.;\n vec3 frameInfo = vec3(0.);\n if (int(u_anim_info.x) == 1) {\n frameInfo = unpackCurveData(texture_animation_tex0, timeCoord0);\n } else {\n vec3 frameInfo0 = unpackCurveData(texture_animation_tex0, timeCoord0);\n vec3 frameInfo1 = unpackCurveData(texture_animation_tex0, timeCoord1);\n float factor_t = pseudoRandom(a_rndSeed + 90794.);\n frameInfo = mix(frameInfo0, frameInfo1, factor_t);\n }\n startFrame = frameInfo.x / u_anim_info.y;\n float EPSILON = 1e-6;\n frameIndex = repeat(u_anim_info.z * (frameInfo.y + startFrame), 1. + EPSILON);\n #endif\n uv = computeUV(frameIndex, vertIdx, frameTile_velLenScale.xy) * mainTiling_Offset.xy + mainTiling_Offset.zw;\n return pos;\n}\nvoid main() { gl_Position = gpvs_main(); }",
  1290. "frag": "\nprecision mediump float;\nlayout(set = 0, binding = 0) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(set = 0, binding = 1) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nvec4 CCFragOutput (vec4 color) {\n return color;\n}\nlayout(location = 0) in vec2 uv;\nlayout(location = 1) in vec4 color;\nlayout(set = 1, binding = 16) uniform sampler2D mainTexture;\nlayout(set = 1, binding = 9) uniform FragConstants {\n vec4 tintColor;\n};\nvec4 add () {\n vec4 col = 2.0 * color * tintColor * texture(mainTexture, uv);\n return CCFragOutput(col);\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = add(); }"
  1291. },
  1292. "glsl3": {
  1293. "vert": "\nprecision mediump float;\nvec4 quaternionFromAxis (vec3 xAxis,vec3 yAxis,vec3 zAxis){\n mat3 m = mat3(xAxis,yAxis,zAxis);\n float trace = m[0][0] + m[1][1] + m[2][2];\n vec4 quat;\n if (trace > 0.) {\n float s = 0.5 / sqrt(trace + 1.0);\n quat.w = 0.25 / s;\n quat.x = (m[2][1] - m[1][2]) * s;\n quat.y = (m[0][2] - m[2][0]) * s;\n quat.z = (m[1][0] - m[0][1]) * s;\n } else if ((m[0][0] > m[1][1]) && (m[0][0] > m[2][2])) {\n float s = 2.0 * sqrt(1.0 + m[0][0] - m[1][1] - m[2][2]);\n quat.w = (m[2][1] - m[1][2]) / s;\n quat.x = 0.25 * s;\n quat.y = (m[0][1] + m[1][0]) / s;\n quat.z = (m[0][2] + m[2][0]) / s;\n } else if (m[1][1] > m[2][2]) {\n float s = 2.0 * sqrt(1.0 + m[1][1] - m[0][0] - m[2][2]);\n quat.w = (m[0][2] - m[2][0]) / s;\n quat.x = (m[0][1] + m[1][0]) / s;\n quat.y = 0.25 * s;\n quat.z = (m[1][2] + m[2][1]) / s;\n } else {\n float s = 2.0 * sqrt(1.0 + m[2][2] - m[0][0] - m[1][1]);\n quat.w = (m[1][0] - m[0][1]) / s;\n quat.x = (m[0][2] + m[2][0]) / s;\n quat.y = (m[1][2] + m[2][1]) / s;\n quat.z = 0.25 * s;\n }\n float len = quat.x * quat.x + quat.y * quat.y + quat.z * quat.z + quat.w * quat.w;\n if (len > 0.) {\n len = 1. / sqrt(len);\n quat.x = quat.x * len;\n quat.y = quat.y * len;\n quat.z = quat.z * len;\n quat.w = quat.w * len;\n }\n return quat;\n}\nvec4 quaternionFromEuler (vec3 angle){\n float x = angle.x / 2.;\n float y = angle.y / 2.;\n float z = angle.z / 2.;\n float sx = sin(x);\n float cx = cos(x);\n float sy = sin(y);\n float cy = cos(y);\n float sz = sin(z);\n float cz = cos(z);\n vec4 quat = vec4(0);\n quat.x = sx * cy * cz + cx * sy * sz;\n quat.y = cx * sy * cz + sx * cy * sz;\n quat.z = cx * cy * sz - sx * sy * cz;\n quat.w = cx * cy * cz - sx * sy * sz;\n return quat;\n}\nmat4 matrixFromRT (vec4 q, vec3 p){\n float x2 = q.x + q.x;\n float y2 = q.y + q.y;\n float z2 = q.z + q.z;\n float xx = q.x * x2;\n float xy = q.x * y2;\n float xz = q.x * z2;\n float yy = q.y * y2;\n float yz = q.y * z2;\n float zz = q.z * z2;\n float wx = q.w * x2;\n float wy = q.w * y2;\n float wz = q.w * z2;\n return mat4(\n 1. - (yy + zz), xy + wz, xz - wy, 0,\n xy - wz, 1. - (xx + zz), yz + wx, 0,\n xz + wy, yz - wx, 1. - (xx + yy), 0,\n p.x, p.y, p.z, 1\n );\n}\nmat4 matFromRTS (vec4 q, vec3 t, vec3 s){\n float x = q.x, y = q.y, z = q.z, w = q.w;\n float x2 = x + x;\n float y2 = y + y;\n float z2 = z + z;\n float xx = x * x2;\n float xy = x * y2;\n float xz = x * z2;\n float yy = y * y2;\n float yz = y * z2;\n float zz = z * z2;\n float wx = w * x2;\n float wy = w * y2;\n float wz = w * z2;\n float sx = s.x;\n float sy = s.y;\n float sz = s.z;\n return mat4((1. - (yy + zz)) * sx, (xy + wz) * sx, (xz - wy) * sx, 0,\n (xy - wz) * sy, (1. - (xx + zz)) * sy, (yz + wx) * sy, 0,\n (xz + wy) * sz, (yz - wx) * sz, (1. - (xx + yy)) * sz, 0,\n t.x, t.y, t.z, 1);\n}\nvec4 quatMultiply (vec4 a, vec4 b){\n vec4 quat;\n quat.x = a.x * b.w + a.w * b.x + a.y * b.z - a.z * b.y;\n quat.y = a.y * b.w + a.w * b.y + a.z * b.x - a.x * b.z;\n quat.z = a.z * b.w + a.w * b.z + a.x * b.y - a.y * b.x;\n quat.w = a.w * b.w - a.x * b.x - a.y * b.y - a.z * b.z;\n return quat;\n}\nvoid rotateVecFromQuat (inout vec3 v, vec4 q){\n float ix = q.w * v.x + q.y * v.z - q.z * v.y;\n float iy = q.w * v.y + q.z * v.x - q.x * v.z;\n float iz = q.w * v.z + q.x * v.y - q.y * v.x;\n float iw = -q.x * v.x - q.y * v.y - q.z * v.z;\n v.x = ix * q.w + iw * -q.x + iy * -q.z - iz * -q.y;\n v.y = iy * q.w + iw * -q.y + iz * -q.x - ix * -q.z;\n v.z = iz * q.w + iw * -q.z + ix * -q.y - iy * -q.x;\n}\nvec3 rotateInLocalSpace (vec3 pos, vec3 xAxis, vec3 yAxis, vec3 zAxis, vec4 q){\n vec4 viewQuat = quaternionFromAxis(xAxis, yAxis, zAxis);\n vec4 rotQuat = quatMultiply(viewQuat, q);\n rotateVecFromQuat(pos, rotQuat);\n return pos;\n}\nmat3 quatToMat3(vec4 q) {\n vec3 m0 = vec3(\n 1.0 - 2.0 * q.y * q.y - 2.0 * q.z * q.z,\n 2.0 * q.x * q.y + 2.0 * q.w * q.z,\n 2.0 * q.x * q.z - 2.0 * q.w * q.y);\n\tvec3 m1 = vec3(\n 2.0 * q.x * q.y - 2.0 * q.w * q.z,\n 1.0 - 2.0 * q.x * q.x - 2.0 * q.z * q.z,\n 2.0 * q.y * q.z + 2.0 * q.w * q.x);\n\tvec3 m2 = vec3(\n 2.0 * q.x * q.z + 2.0 * q.w * q.y,\n 2.0 * q.y * q.z - 2.0 * q.w * q.x,\n 1.0 - 2.0 * q.x * q.x - 2.0 * q.y * q.y);\n return mat3(m0, m1, m2);\n}\nvec4 mat3ToQuat(mat3 mat) {\n float tr = mat[0][0] + mat[1][1] + mat[2][2];\n\tfloat qw, qx, qy, qz;\n if (tr > 0.0) {\n float S = sqrt(tr + 1.0) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = 0.25 * S;\n\t qx = (mat[1][2] - mat[2][1]) * invS;\n\t qy = (mat[2][0] - mat[0][2]) * invS;\n\t qz = (mat[0][1] - mat[1][0]) * invS;\n } else if ((mat[0][0] > mat[1][1])&&(mat[0][0] > mat[2][2])) {\n float S = sqrt(1.0 + mat[0][0] - mat[1][1] - mat[2][2]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[1][2] - mat[2][1]) * invS;\n\t qx = 0.25 * S;\n\t qy = (mat[1][0] + mat[0][1]) * invS;\n\t qz = (mat[2][0] + mat[0][2]) * invS;\n } else if (mat[1][1] > mat[2][2]) {\n\t float S = sqrt(1.0 + mat[1][1] - mat[0][0] - mat[2][2]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[2][0] - mat[0][2]) * invS;\n\t qx = (mat[1][0] + mat[0][1]) * invS;\n\t qy = 0.25 * S;\n\t qz = (mat[2][1] + mat[1][2]) * invS;\n } else {\n\t float S = sqrt(1.0 + mat[2][2] - mat[0][0] - mat[1][1]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[0][1] - mat[1][0]) * invS;\n\t qx = (mat[2][0] + mat[0][2]) * invS;\n\t qy = (mat[2][1] + mat[1][2]) * invS;\n\t qz = 0.25 * S;\n }\n return vec4(qx, qy, qz, qw);\n}\nvec4 eulerToQuat(vec3 euler) {\n vec3 er = euler * 0.5;\n float x = er.x, y = er.y, z = er.z;\n float sx = sin(x);\n float cx = cos(x);\n float sy = sin(y);\n float cy = cos(y);\n float sz = sin(z);\n float cz = cos(z);\n vec4 quat;\n quat.x = sx * cy * cz + cx * sy * sz;\n quat.y = cx * sy * cz + sx * cy * sz;\n quat.z = cx * cy * sz - sx * sy * cz;\n quat.w = cx * cy * cz - sx * sy * sz;\n return quat;\n}\nlayout(std140) uniform Constants {\n vec4 mainTiling_Offset;\n vec4 frameTile_velLenScale;\n vec4 scale;\n vec4 nodeRotation;\n};\nlayout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nlayout(std140) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n};\nout mediump vec2 uv;\nout mediump vec4 color;\nvoid computeVertPos (inout vec4 pos, vec2 vertOffset, vec4 q, vec3 s\n#if CC_RENDER_MODE == 0 || CC_RENDER_MODE == 3\n , mat4 viewInv\n#endif\n#if CC_RENDER_MODE == 1\n , vec3 eye\n , vec4 velocity\n , float velocityScale\n , float lengthScale\n , float xIndex\n#endif\n) {\n#if CC_RENDER_MODE == 0\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n vec3 camX = normalize(vec3(viewInv[0][0], viewInv[1][0], viewInv[2][0]));\n vec3 camY = normalize(vec3(viewInv[0][1], viewInv[1][1], viewInv[2][1]));\n vec3 camZ = normalize(vec3(viewInv[0][2], viewInv[1][2], viewInv[2][2]));\n pos.xyz += rotateInLocalSpace(viewSpaceVert, camX, camY, camZ, q);\n#elif CC_RENDER_MODE == 1\n vec3 camRight = normalize(cross(pos.xyz - eye, velocity.xyz)) * s.x;\n vec3 camUp = velocity.xyz * velocityScale + normalize(velocity.xyz) * lengthScale * s.y;\n pos.xyz += (camRight * abs(vertOffset.x) * sign(vertOffset.y)) - camUp * xIndex;\n#elif CC_RENDER_MODE == 2\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n vec3 camX = vec3(1, 0, 0);\n vec3 camY = vec3(0, 0, -1);\n pos.xyz += rotateInLocalSpace(viewSpaceVert, camX, camY, cross(camX, camY), q);\n#elif CC_RENDER_MODE == 3\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n rotateVecFromQuat(viewSpaceVert, q);\n vec3 camX = normalize(vec3(cc_matView[0][0], cc_matView[1][0], cc_matView[2][0]));\n vec3 camY = vec3(0, 1, 0);\n vec3 offset = camX * viewSpaceVert.x + camY * viewSpaceVert.y;\n pos.xyz += offset;\n#else\n pos.x += vertOffset.x;\n pos.y += vertOffset.y;\n#endif\n}\nvec2 computeUV (float frameIndex, vec2 vertIndex, vec2 frameTile){\n vec2 aniUV = vec2(0, floor(frameIndex * frameTile.y));\n aniUV.x = floor(frameIndex * frameTile.x * frameTile.y - aniUV.y * frameTile.x);\n#if CC_RENDER_MODE != 4\n vertIndex.y = 1. - vertIndex.y;\n#endif\n return (aniUV.xy + vertIndex) / vec2(frameTile.x, frameTile.y);\n}\nlayout(std140) uniform SampleConstants {\n vec4 u_sampleInfo;\n};\nlayout(std140) uniform TickConstants {\n vec4 u_worldRot;\n vec4 u_timeDelta;\n};\nin vec4 a_position_starttime;\nin vec4 a_color;\nin vec4 a_dir_life;\nin float a_rndSeed;\n#if !CC_INSTANCE_PARTICLE\n in vec4 a_size_uv;\n in vec4 a_rotation_uv;\n#endif\n#if CC_INSTANCE_PARTICLE\n in vec4 a_size_fid;\n in vec3 a_rotation;\n in vec3 a_uv;\n#endif\n#if CC_RENDER_MODE == 4\n in vec3 a_texCoord;\n in vec3 a_texCoord3;\n in vec3 a_normal;\n in vec4 a_color1;\n#endif\nvec3 unpackCurveData (sampler2D tex, vec2 coord) {\n vec4 a = texture(tex, coord);\n vec4 b = texture(tex, coord + u_sampleInfo.y);\n float c = fract(coord.x * u_sampleInfo.x);\n return mix(a.xyz, b.xyz, c);\n}\nvec3 unpackCurveData (sampler2D tex, vec2 coord, out float w) {\n vec4 a = texture(tex, coord);\n vec4 b = texture(tex, coord + u_sampleInfo.y);\n float c = fract(coord.x * u_sampleInfo.x);\n w = mix(a.w, b.w, c);\n return mix(a.xyz, b.xyz, c);\n}\nfloat pseudoRandom(float x) {\n#if USE_VK_SHADER\n float o = x;\n x = mod(x - 1.0, 2.0) - 1.0;\n float freqVar = 10.16640753482;\n float y = sin(freqVar * floor(o * 0.5 - 0.5));\n float v = max(0.0, 1.0-abs(x));\n v *= 0.7071067812;\n v = y < 0.0 ? -v : v;\n return v;\n#endif\n#if !USE_VK_SHADER\n float seed = mod(x, 233280.);\n float q = (seed * 9301. + 49297.) / 233280.;\n return fract(q);\n#endif\n}\n#if COLOR_OVER_TIME_MODULE_ENABLE\n uniform sampler2D color_over_time_tex0;\n layout(std140) uniform ColorConstant {\n int u_color_mode;\n };\n#endif\n#if ROTATION_OVER_TIME_MODULE_ENABLE\n uniform sampler2D rotation_over_time_tex0;\n layout(std140) uniform RotationConstant {\n int u_rotation_mode;\n };\n#endif\n#if SIZE_OVER_TIME_MODULE_ENABLE\n uniform sampler2D size_over_time_tex0;\n layout(std140) uniform SizeConstant {\n int u_size_mode;\n };\n#endif\n#if FORCE_OVER_TIME_MODULE_ENABLE\n uniform sampler2D force_over_time_tex0;\n layout(std140) uniform ForceConstant {\n int u_force_mode;\n int u_force_space;\n };\n#endif\n#if VELOCITY_OVER_TIME_MODULE_ENABLE\n uniform sampler2D velocity_over_time_tex0;\n layout(std140) uniform VelocityConstant {\n int u_velocity_mode;\n int u_velocity_space;\n };\n#endif\n#if TEXTURE_ANIMATION_MODULE_ENABLE\n uniform sampler2D texture_animation_tex0;\n layout(std140) uniform AnimationConstant {\n vec4 u_anim_info;\n };\n#endif\nfloat repeat (float t, float length) {\n return t - floor(t / length) * length;\n}\nvec4 rotateQuat (vec4 p, vec4 q) {\n vec3 iv = cross(q.xyz, p.xyz) + q.w * p.xyz;\n vec3 res = p.xyz + 2.0 * cross(q.xyz, iv);\n return vec4(res.xyz, p.w);\n}\nvec4 gpvs_main () {\n float activeTime = u_timeDelta.x - a_position_starttime.w;\n float normalizedTime = clamp(activeTime / a_dir_life.w, 0.0, 1.0);\n vec2 timeCoord0 = vec2(normalizedTime, 0.);\n vec2 timeCoord1 = vec2(normalizedTime, 1.);\n #if CC_RENDER_MODE == 4\n vec2 vertIdx = vec2(a_texCoord.x, a_texCoord.y);\n #endif\n #if CC_RENDER_MODE != 4\n #if !CC_INSTANCE_PARTICLE\n vec2 vertIdx = vec2(a_size_uv.w, a_rotation_uv.w);\n #endif\n #if CC_INSTANCE_PARTICLE\n vec2 vertIdx = a_uv.xy;\n #endif\n #endif\n vec4 velocity = vec4(a_dir_life.xyz, 0.);\n vec4 pos = vec4(a_position_starttime.xyz, 1.);\n #if !CC_INSTANCE_PARTICLE\n vec3 size = a_size_uv.xyz;\n #endif\n #if CC_INSTANCE_PARTICLE\n vec3 size = a_size_fid.xyz;\n #endif\n #if SIZE_OVER_TIME_MODULE_ENABLE\n if (u_size_mode == 1) {\n size *= unpackCurveData(size_over_time_tex0, timeCoord0);\n } else {\n vec3 size_0 = unpackCurveData(size_over_time_tex0, timeCoord0);\n vec3 size_1 = unpackCurveData(size_over_time_tex0, timeCoord1);\n float factor_s = pseudoRandom(a_rndSeed + 39825.);\n size *= mix(size_0, size_1, factor_s);\n }\n #endif\n vec3 compScale = scale.xyz * size;\n #if FORCE_OVER_TIME_MODULE_ENABLE\n vec3 forceAnim = vec3(0.);\n if (u_force_mode == 1) {\n forceAnim = unpackCurveData(force_over_time_tex0, timeCoord0);\n } else {\n vec3 force_0 = unpackCurveData(force_over_time_tex0, timeCoord0);\n vec3 force_1 = unpackCurveData(force_over_time_tex0, timeCoord1);\n float factor_f = pseudoRandom(a_rndSeed + 212165.);\n forceAnim = mix(force_0, force_1, factor_f);\n }\n vec4 forceTrack = vec4(forceAnim, 0.);\n if (u_force_space == 0) {\n forceTrack = rotateQuat(forceTrack, u_worldRot);\n }\n velocity.xyz += forceTrack.xyz;\n #endif\n #if VELOCITY_OVER_TIME_MODULE_ENABLE\n float speedModifier0 = 1.;\n float speedModifier1 = 1.;\n vec3 velocityAnim = vec3(0.);\n if (u_velocity_mode == 1) {\n velocityAnim = unpackCurveData(velocity_over_time_tex0, timeCoord0, speedModifier0);\n } else {\n vec3 vectory_0 = unpackCurveData(velocity_over_time_tex0, timeCoord0, speedModifier0);\n vec3 vectory_1 = unpackCurveData(velocity_over_time_tex0, timeCoord1, speedModifier1);\n float factor_v = pseudoRandom(a_rndSeed + 197866.);\n velocityAnim = mix(vectory_0, vectory_1, factor_v);\n speedModifier0 = mix(speedModifier0, speedModifier1, factor_v);\n }\n vec4 velocityTrack = vec4(velocityAnim, 0.);\n if (u_velocity_space == 0) {\n velocityTrack = rotateQuat(velocityTrack, u_worldRot);\n }\n velocity.xyz += velocityTrack.xyz;\n velocity.xyz *= speedModifier0;\n #endif\n pos.xyz += velocity.xyz * normalizedTime * a_dir_life.w;\n #if !CC_USE_WORLD_SPACE\n pos = cc_matWorld * pos;\n #if CC_RENDER_MODE == 1\n velocity = rotateQuat(velocity, u_worldRot);\n #endif\n #endif\n #if !CC_INSTANCE_PARTICLE\n vec3 startRotation = a_rotation_uv.xyz;\n #endif\n #if CC_INSTANCE_PARTICLE\n vec3 startRotation = a_rotation;\n #endif\n #if CC_RENDER_MODE != 4\n #if CC_RENDER_MODE == 0\n vec3 rotEuler = startRotation.xyz;\n #elif CC_RENDER_MODE == 1\n vec3 rotEuler = vec3(0.);\n #endif\n #if CC_RENDER_MODE != 0 && CC_RENDER_MODE != 1\n vec3 rotEuler = vec3(0., 0., startRotation.z);\n #endif\n vec4 rot = quaternionFromEuler(rotEuler);\n #endif\n #if CC_RENDER_MODE == 4\n vec4 rot = quaternionFromEuler(startRotation);\n #endif\n #if ROTATION_OVER_TIME_MODULE_ENABLE\n if (u_rotation_mode == 1) {\n vec3 euler = unpackCurveData(rotation_over_time_tex0, timeCoord0) * normalizedTime * a_dir_life.w;\n vec4 quat = eulerToQuat(euler);\n mat3 mLocal = quatToMat3(quat);\n mat3 mStart = quatToMat3(rot);\n rot = mat3ToQuat(mStart * mLocal);\n } else {\n vec3 rotation_0 = unpackCurveData(rotation_over_time_tex0, timeCoord0);\n vec3 rotation_1 = unpackCurveData(rotation_over_time_tex0, timeCoord1);\n float factor_r = pseudoRandom(a_rndSeed + 125292.);\n vec3 euler = mix(rotation_0, rotation_1, factor_r) * normalizedTime * a_dir_life.w;\n #if CC_RENDER_MODE == 3 || CC_RENDER_MODE == 2\n euler = vec3(0.0, 0.0, euler.z);\n #endif\n vec4 quat = eulerToQuat(euler);\n mat3 mLocal = quatToMat3(quat);\n mat3 mStart = quatToMat3(rot);\n rot = mat3ToQuat(mStart * mLocal);\n }\n #endif\n #if COLOR_OVER_TIME_MODULE_ENABLE\n if (u_color_mode == 1) {\n color = a_color * texture(color_over_time_tex0, timeCoord0);\n } else {\n vec4 color_0 = texture(color_over_time_tex0, timeCoord0);\n vec4 color_1 = texture(color_over_time_tex0, timeCoord1);\n float factor_c = pseudoRandom(a_rndSeed + 91041.);\n color = a_color * mix(color_0, color_1, factor_c);\n }\n #endif\n #if !COLOR_OVER_TIME_MODULE_ENABLE\n color = a_color;\n #endif\n #if CC_RENDER_MODE != 4\n vec2 cornerOffset = vec2((vertIdx - 0.5));\n #if CC_RENDER_MODE == 1\n rot = vec4(0.0, 0.0, 0.0, 1.0);\n #endif\n computeVertPos(pos, cornerOffset, rot, compScale\n #if CC_RENDER_MODE == 0 || CC_RENDER_MODE == 3\n , cc_matViewInv\n #endif\n #if CC_RENDER_MODE == 1\n , cc_cameraPos.xyz\n , velocity\n , frameTile_velLenScale.z\n , frameTile_velLenScale.w\n #if !CC_INSTANCE_PARTICLE\n , a_size_uv.w\n #endif\n #if CC_INSTANCE_PARTICLE\n , a_uv.x\n #endif\n #endif\n );\n #endif\n #if CC_RENDER_MODE == 4\n mat3 rotMat = quatToMat3(rot);\n mat3 nodeMat = quatToMat3(nodeRotation);\n rotMat = nodeMat * rotMat;\n rot = mat3ToQuat(rotMat);\n mat4 xformNoScale = matrixFromRT(rot, pos.xyz);\n mat4 xform = matFromRTS(rot, pos.xyz, compScale);\n pos = xform * vec4(a_texCoord3, 1);\n vec4 normal = xformNoScale * vec4(a_normal, 0);\n color *= a_color1;\n #endif\n pos = cc_matViewProj * pos;\n float frameIndex = 0.;\n #if TEXTURE_ANIMATION_MODULE_ENABLE\n float startFrame = 0.;\n vec3 frameInfo = vec3(0.);\n if (int(u_anim_info.x) == 1) {\n frameInfo = unpackCurveData(texture_animation_tex0, timeCoord0);\n } else {\n vec3 frameInfo0 = unpackCurveData(texture_animation_tex0, timeCoord0);\n vec3 frameInfo1 = unpackCurveData(texture_animation_tex0, timeCoord1);\n float factor_t = pseudoRandom(a_rndSeed + 90794.);\n frameInfo = mix(frameInfo0, frameInfo1, factor_t);\n }\n startFrame = frameInfo.x / u_anim_info.y;\n float EPSILON = 1e-6;\n frameIndex = repeat(u_anim_info.z * (frameInfo.y + startFrame), 1. + EPSILON);\n #endif\n uv = computeUV(frameIndex, vertIdx, frameTile_velLenScale.xy) * mainTiling_Offset.xy + mainTiling_Offset.zw;\n return pos;\n}\nvoid main() { gl_Position = gpvs_main(); }",
  1294. "frag": "\nprecision mediump float;\nlayout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nvec4 CCFragOutput (vec4 color) {\n return color;\n}\nin vec2 uv;\nin vec4 color;\nuniform sampler2D mainTexture;\nlayout(std140) uniform FragConstants {\n vec4 tintColor;\n};\nvec4 add () {\n vec4 col = 2.0 * color * tintColor * texture(mainTexture, uv);\n return CCFragOutput(col);\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = add(); }"
  1295. },
  1296. "glsl1": {
  1297. "vert": "\nprecision mediump float;\nvec4 quaternionFromAxis (vec3 xAxis,vec3 yAxis,vec3 zAxis){\n mat3 m = mat3(xAxis,yAxis,zAxis);\n float trace = m[0][0] + m[1][1] + m[2][2];\n vec4 quat;\n if (trace > 0.) {\n float s = 0.5 / sqrt(trace + 1.0);\n quat.w = 0.25 / s;\n quat.x = (m[2][1] - m[1][2]) * s;\n quat.y = (m[0][2] - m[2][0]) * s;\n quat.z = (m[1][0] - m[0][1]) * s;\n } else if ((m[0][0] > m[1][1]) && (m[0][0] > m[2][2])) {\n float s = 2.0 * sqrt(1.0 + m[0][0] - m[1][1] - m[2][2]);\n quat.w = (m[2][1] - m[1][2]) / s;\n quat.x = 0.25 * s;\n quat.y = (m[0][1] + m[1][0]) / s;\n quat.z = (m[0][2] + m[2][0]) / s;\n } else if (m[1][1] > m[2][2]) {\n float s = 2.0 * sqrt(1.0 + m[1][1] - m[0][0] - m[2][2]);\n quat.w = (m[0][2] - m[2][0]) / s;\n quat.x = (m[0][1] + m[1][0]) / s;\n quat.y = 0.25 * s;\n quat.z = (m[1][2] + m[2][1]) / s;\n } else {\n float s = 2.0 * sqrt(1.0 + m[2][2] - m[0][0] - m[1][1]);\n quat.w = (m[1][0] - m[0][1]) / s;\n quat.x = (m[0][2] + m[2][0]) / s;\n quat.y = (m[1][2] + m[2][1]) / s;\n quat.z = 0.25 * s;\n }\n float len = quat.x * quat.x + quat.y * quat.y + quat.z * quat.z + quat.w * quat.w;\n if (len > 0.) {\n len = 1. / sqrt(len);\n quat.x = quat.x * len;\n quat.y = quat.y * len;\n quat.z = quat.z * len;\n quat.w = quat.w * len;\n }\n return quat;\n}\nvec4 quaternionFromEuler (vec3 angle){\n float x = angle.x / 2.;\n float y = angle.y / 2.;\n float z = angle.z / 2.;\n float sx = sin(x);\n float cx = cos(x);\n float sy = sin(y);\n float cy = cos(y);\n float sz = sin(z);\n float cz = cos(z);\n vec4 quat = vec4(0);\n quat.x = sx * cy * cz + cx * sy * sz;\n quat.y = cx * sy * cz + sx * cy * sz;\n quat.z = cx * cy * sz - sx * sy * cz;\n quat.w = cx * cy * cz - sx * sy * sz;\n return quat;\n}\nmat4 matrixFromRT (vec4 q, vec3 p){\n float x2 = q.x + q.x;\n float y2 = q.y + q.y;\n float z2 = q.z + q.z;\n float xx = q.x * x2;\n float xy = q.x * y2;\n float xz = q.x * z2;\n float yy = q.y * y2;\n float yz = q.y * z2;\n float zz = q.z * z2;\n float wx = q.w * x2;\n float wy = q.w * y2;\n float wz = q.w * z2;\n return mat4(\n 1. - (yy + zz), xy + wz, xz - wy, 0,\n xy - wz, 1. - (xx + zz), yz + wx, 0,\n xz + wy, yz - wx, 1. - (xx + yy), 0,\n p.x, p.y, p.z, 1\n );\n}\nmat4 matFromRTS (vec4 q, vec3 t, vec3 s){\n float x = q.x, y = q.y, z = q.z, w = q.w;\n float x2 = x + x;\n float y2 = y + y;\n float z2 = z + z;\n float xx = x * x2;\n float xy = x * y2;\n float xz = x * z2;\n float yy = y * y2;\n float yz = y * z2;\n float zz = z * z2;\n float wx = w * x2;\n float wy = w * y2;\n float wz = w * z2;\n float sx = s.x;\n float sy = s.y;\n float sz = s.z;\n return mat4((1. - (yy + zz)) * sx, (xy + wz) * sx, (xz - wy) * sx, 0,\n (xy - wz) * sy, (1. - (xx + zz)) * sy, (yz + wx) * sy, 0,\n (xz + wy) * sz, (yz - wx) * sz, (1. - (xx + yy)) * sz, 0,\n t.x, t.y, t.z, 1);\n}\nvec4 quatMultiply (vec4 a, vec4 b){\n vec4 quat;\n quat.x = a.x * b.w + a.w * b.x + a.y * b.z - a.z * b.y;\n quat.y = a.y * b.w + a.w * b.y + a.z * b.x - a.x * b.z;\n quat.z = a.z * b.w + a.w * b.z + a.x * b.y - a.y * b.x;\n quat.w = a.w * b.w - a.x * b.x - a.y * b.y - a.z * b.z;\n return quat;\n}\nvoid rotateVecFromQuat (inout vec3 v, vec4 q){\n float ix = q.w * v.x + q.y * v.z - q.z * v.y;\n float iy = q.w * v.y + q.z * v.x - q.x * v.z;\n float iz = q.w * v.z + q.x * v.y - q.y * v.x;\n float iw = -q.x * v.x - q.y * v.y - q.z * v.z;\n v.x = ix * q.w + iw * -q.x + iy * -q.z - iz * -q.y;\n v.y = iy * q.w + iw * -q.y + iz * -q.x - ix * -q.z;\n v.z = iz * q.w + iw * -q.z + ix * -q.y - iy * -q.x;\n}\nvec3 rotateInLocalSpace (vec3 pos, vec3 xAxis, vec3 yAxis, vec3 zAxis, vec4 q){\n vec4 viewQuat = quaternionFromAxis(xAxis, yAxis, zAxis);\n vec4 rotQuat = quatMultiply(viewQuat, q);\n rotateVecFromQuat(pos, rotQuat);\n return pos;\n}\nmat3 quatToMat3(vec4 q) {\n vec3 m0 = vec3(\n 1.0 - 2.0 * q.y * q.y - 2.0 * q.z * q.z,\n 2.0 * q.x * q.y + 2.0 * q.w * q.z,\n 2.0 * q.x * q.z - 2.0 * q.w * q.y);\n\tvec3 m1 = vec3(\n 2.0 * q.x * q.y - 2.0 * q.w * q.z,\n 1.0 - 2.0 * q.x * q.x - 2.0 * q.z * q.z,\n 2.0 * q.y * q.z + 2.0 * q.w * q.x);\n\tvec3 m2 = vec3(\n 2.0 * q.x * q.z + 2.0 * q.w * q.y,\n 2.0 * q.y * q.z - 2.0 * q.w * q.x,\n 1.0 - 2.0 * q.x * q.x - 2.0 * q.y * q.y);\n return mat3(m0, m1, m2);\n}\nvec4 mat3ToQuat(mat3 mat) {\n float tr = mat[0][0] + mat[1][1] + mat[2][2];\n\tfloat qw, qx, qy, qz;\n if (tr > 0.0) {\n float S = sqrt(tr + 1.0) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = 0.25 * S;\n\t qx = (mat[1][2] - mat[2][1]) * invS;\n\t qy = (mat[2][0] - mat[0][2]) * invS;\n\t qz = (mat[0][1] - mat[1][0]) * invS;\n } else if ((mat[0][0] > mat[1][1])&&(mat[0][0] > mat[2][2])) {\n float S = sqrt(1.0 + mat[0][0] - mat[1][1] - mat[2][2]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[1][2] - mat[2][1]) * invS;\n\t qx = 0.25 * S;\n\t qy = (mat[1][0] + mat[0][1]) * invS;\n\t qz = (mat[2][0] + mat[0][2]) * invS;\n } else if (mat[1][1] > mat[2][2]) {\n\t float S = sqrt(1.0 + mat[1][1] - mat[0][0] - mat[2][2]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[2][0] - mat[0][2]) * invS;\n\t qx = (mat[1][0] + mat[0][1]) * invS;\n\t qy = 0.25 * S;\n\t qz = (mat[2][1] + mat[1][2]) * invS;\n } else {\n\t float S = sqrt(1.0 + mat[2][2] - mat[0][0] - mat[1][1]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[0][1] - mat[1][0]) * invS;\n\t qx = (mat[2][0] + mat[0][2]) * invS;\n\t qy = (mat[2][1] + mat[1][2]) * invS;\n\t qz = 0.25 * S;\n }\n return vec4(qx, qy, qz, qw);\n}\nvec4 eulerToQuat(vec3 euler) {\n vec3 er = euler * 0.5;\n float x = er.x, y = er.y, z = er.z;\n float sx = sin(x);\n float cx = cos(x);\n float sy = sin(y);\n float cy = cos(y);\n float sz = sin(z);\n float cz = cos(z);\n vec4 quat;\n quat.x = sx * cy * cz + cx * sy * sz;\n quat.y = cx * sy * cz + sx * cy * sz;\n quat.z = cx * cy * sz - sx * sy * cz;\n quat.w = cx * cy * cz - sx * sy * sz;\n return quat;\n}\n uniform vec4 mainTiling_Offset;\n uniform vec4 frameTile_velLenScale;\n uniform vec4 scale;\n uniform vec4 nodeRotation;\nuniform highp mat4 cc_matView;\n uniform highp mat4 cc_matViewInv;\n uniform highp mat4 cc_matViewProj;\n uniform highp vec4 cc_cameraPos;\nuniform highp mat4 cc_matWorld;\nvarying mediump vec2 uv;\nvarying mediump vec4 color;\nvoid computeVertPos (inout vec4 pos, vec2 vertOffset, vec4 q, vec3 s\n#if CC_RENDER_MODE == 0 || CC_RENDER_MODE == 3\n , mat4 viewInv\n#endif\n#if CC_RENDER_MODE == 1\n , vec3 eye\n , vec4 velocity\n , float velocityScale\n , float lengthScale\n , float xIndex\n#endif\n) {\n#if CC_RENDER_MODE == 0\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n vec3 camX = normalize(vec3(viewInv[0][0], viewInv[1][0], viewInv[2][0]));\n vec3 camY = normalize(vec3(viewInv[0][1], viewInv[1][1], viewInv[2][1]));\n vec3 camZ = normalize(vec3(viewInv[0][2], viewInv[1][2], viewInv[2][2]));\n pos.xyz += rotateInLocalSpace(viewSpaceVert, camX, camY, camZ, q);\n#elif CC_RENDER_MODE == 1\n vec3 camRight = normalize(cross(pos.xyz - eye, velocity.xyz)) * s.x;\n vec3 camUp = velocity.xyz * velocityScale + normalize(velocity.xyz) * lengthScale * s.y;\n pos.xyz += (camRight * abs(vertOffset.x) * sign(vertOffset.y)) - camUp * xIndex;\n#elif CC_RENDER_MODE == 2\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n vec3 camX = vec3(1, 0, 0);\n vec3 camY = vec3(0, 0, -1);\n pos.xyz += rotateInLocalSpace(viewSpaceVert, camX, camY, cross(camX, camY), q);\n#elif CC_RENDER_MODE == 3\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n rotateVecFromQuat(viewSpaceVert, q);\n vec3 camX = normalize(vec3(cc_matView[0][0], cc_matView[1][0], cc_matView[2][0]));\n vec3 camY = vec3(0, 1, 0);\n vec3 offset = camX * viewSpaceVert.x + camY * viewSpaceVert.y;\n pos.xyz += offset;\n#else\n pos.x += vertOffset.x;\n pos.y += vertOffset.y;\n#endif\n}\nvec2 computeUV (float frameIndex, vec2 vertIndex, vec2 frameTile){\n vec2 aniUV = vec2(0, floor(frameIndex * frameTile.y));\n aniUV.x = floor(frameIndex * frameTile.x * frameTile.y - aniUV.y * frameTile.x);\n#if CC_RENDER_MODE != 4\n vertIndex.y = 1. - vertIndex.y;\n#endif\n return (aniUV.xy + vertIndex) / vec2(frameTile.x, frameTile.y);\n}\n uniform vec4 u_sampleInfo;\n uniform vec4 u_worldRot;\n uniform vec4 u_timeDelta;\nattribute vec4 a_position_starttime;\nattribute vec4 a_color;\nattribute vec4 a_dir_life;\nattribute float a_rndSeed;\n#if !CC_INSTANCE_PARTICLE\n attribute vec4 a_size_uv;\n attribute vec4 a_rotation_uv;\n#endif\n#if CC_INSTANCE_PARTICLE\n attribute vec4 a_size_fid;\n attribute vec3 a_rotation;\n attribute vec3 a_uv;\n#endif\n#if CC_RENDER_MODE == 4\n attribute vec3 a_texCoord;\n attribute vec3 a_texCoord3;\n attribute vec3 a_normal;\n attribute vec4 a_color1;\n#endif\nvec3 unpackCurveData (sampler2D tex, vec2 coord) {\n vec4 a = texture2D(tex, coord);\n vec4 b = texture2D(tex, coord + u_sampleInfo.y);\n float c = fract(coord.x * u_sampleInfo.x);\n return mix(a.xyz, b.xyz, c);\n}\nvec3 unpackCurveData (sampler2D tex, vec2 coord, out float w) {\n vec4 a = texture2D(tex, coord);\n vec4 b = texture2D(tex, coord + u_sampleInfo.y);\n float c = fract(coord.x * u_sampleInfo.x);\n w = mix(a.w, b.w, c);\n return mix(a.xyz, b.xyz, c);\n}\nfloat pseudoRandom(float x) {\n#if USE_VK_SHADER\n float o = x;\n x = mod(x - 1.0, 2.0) - 1.0;\n float freqVar = 10.16640753482;\n float y = sin(freqVar * floor(o * 0.5 - 0.5));\n float v = max(0.0, 1.0-abs(x));\n v *= 0.7071067812;\n v = y < 0.0 ? -v : v;\n return v;\n#endif\n#if !USE_VK_SHADER\n float seed = mod(x, 233280.);\n float q = (seed * 9301. + 49297.) / 233280.;\n return fract(q);\n#endif\n}\n#if COLOR_OVER_TIME_MODULE_ENABLE\n uniform sampler2D color_over_time_tex0;\n uniform int u_color_mode;\n#endif\n#if ROTATION_OVER_TIME_MODULE_ENABLE\n uniform sampler2D rotation_over_time_tex0;\n uniform int u_rotation_mode;\n#endif\n#if SIZE_OVER_TIME_MODULE_ENABLE\n uniform sampler2D size_over_time_tex0;\n uniform int u_size_mode;\n#endif\n#if FORCE_OVER_TIME_MODULE_ENABLE\n uniform sampler2D force_over_time_tex0;\n uniform int u_force_mode;\n uniform int u_force_space;\n#endif\n#if VELOCITY_OVER_TIME_MODULE_ENABLE\n uniform sampler2D velocity_over_time_tex0;\n uniform int u_velocity_mode;\n uniform int u_velocity_space;\n#endif\n#if TEXTURE_ANIMATION_MODULE_ENABLE\n uniform sampler2D texture_animation_tex0;\n uniform vec4 u_anim_info;\n#endif\nfloat repeat (float t, float length) {\n return t - floor(t / length) * length;\n}\nvec4 rotateQuat (vec4 p, vec4 q) {\n vec3 iv = cross(q.xyz, p.xyz) + q.w * p.xyz;\n vec3 res = p.xyz + 2.0 * cross(q.xyz, iv);\n return vec4(res.xyz, p.w);\n}\nvec4 gpvs_main () {\n float activeTime = u_timeDelta.x - a_position_starttime.w;\n float normalizedTime = clamp(activeTime / a_dir_life.w, 0.0, 1.0);\n vec2 timeCoord0 = vec2(normalizedTime, 0.);\n vec2 timeCoord1 = vec2(normalizedTime, 1.);\n #if CC_RENDER_MODE == 4\n vec2 vertIdx = vec2(a_texCoord.x, a_texCoord.y);\n #endif\n #if CC_RENDER_MODE != 4\n #if !CC_INSTANCE_PARTICLE\n vec2 vertIdx = vec2(a_size_uv.w, a_rotation_uv.w);\n #endif\n #if CC_INSTANCE_PARTICLE\n vec2 vertIdx = a_uv.xy;\n #endif\n #endif\n vec4 velocity = vec4(a_dir_life.xyz, 0.);\n vec4 pos = vec4(a_position_starttime.xyz, 1.);\n #if !CC_INSTANCE_PARTICLE\n vec3 size = a_size_uv.xyz;\n #endif\n #if CC_INSTANCE_PARTICLE\n vec3 size = a_size_fid.xyz;\n #endif\n #if SIZE_OVER_TIME_MODULE_ENABLE\n if (u_size_mode == 1) {\n size *= unpackCurveData(size_over_time_tex0, timeCoord0);\n } else {\n vec3 size_0 = unpackCurveData(size_over_time_tex0, timeCoord0);\n vec3 size_1 = unpackCurveData(size_over_time_tex0, timeCoord1);\n float factor_s = pseudoRandom(a_rndSeed + 39825.);\n size *= mix(size_0, size_1, factor_s);\n }\n #endif\n vec3 compScale = scale.xyz * size;\n #if FORCE_OVER_TIME_MODULE_ENABLE\n vec3 forceAnim = vec3(0.);\n if (u_force_mode == 1) {\n forceAnim = unpackCurveData(force_over_time_tex0, timeCoord0);\n } else {\n vec3 force_0 = unpackCurveData(force_over_time_tex0, timeCoord0);\n vec3 force_1 = unpackCurveData(force_over_time_tex0, timeCoord1);\n float factor_f = pseudoRandom(a_rndSeed + 212165.);\n forceAnim = mix(force_0, force_1, factor_f);\n }\n vec4 forceTrack = vec4(forceAnim, 0.);\n if (u_force_space == 0) {\n forceTrack = rotateQuat(forceTrack, u_worldRot);\n }\n velocity.xyz += forceTrack.xyz;\n #endif\n #if VELOCITY_OVER_TIME_MODULE_ENABLE\n float speedModifier0 = 1.;\n float speedModifier1 = 1.;\n vec3 velocityAnim = vec3(0.);\n if (u_velocity_mode == 1) {\n velocityAnim = unpackCurveData(velocity_over_time_tex0, timeCoord0, speedModifier0);\n } else {\n vec3 vectory_0 = unpackCurveData(velocity_over_time_tex0, timeCoord0, speedModifier0);\n vec3 vectory_1 = unpackCurveData(velocity_over_time_tex0, timeCoord1, speedModifier1);\n float factor_v = pseudoRandom(a_rndSeed + 197866.);\n velocityAnim = mix(vectory_0, vectory_1, factor_v);\n speedModifier0 = mix(speedModifier0, speedModifier1, factor_v);\n }\n vec4 velocityTrack = vec4(velocityAnim, 0.);\n if (u_velocity_space == 0) {\n velocityTrack = rotateQuat(velocityTrack, u_worldRot);\n }\n velocity.xyz += velocityTrack.xyz;\n velocity.xyz *= speedModifier0;\n #endif\n pos.xyz += velocity.xyz * normalizedTime * a_dir_life.w;\n #if !CC_USE_WORLD_SPACE\n pos = cc_matWorld * pos;\n #if CC_RENDER_MODE == 1\n velocity = rotateQuat(velocity, u_worldRot);\n #endif\n #endif\n #if !CC_INSTANCE_PARTICLE\n vec3 startRotation = a_rotation_uv.xyz;\n #endif\n #if CC_INSTANCE_PARTICLE\n vec3 startRotation = a_rotation;\n #endif\n #if CC_RENDER_MODE != 4\n #if CC_RENDER_MODE == 0\n vec3 rotEuler = startRotation.xyz;\n #elif CC_RENDER_MODE == 1\n vec3 rotEuler = vec3(0.);\n #endif\n #if CC_RENDER_MODE != 0 && CC_RENDER_MODE != 1\n vec3 rotEuler = vec3(0., 0., startRotation.z);\n #endif\n vec4 rot = quaternionFromEuler(rotEuler);\n #endif\n #if CC_RENDER_MODE == 4\n vec4 rot = quaternionFromEuler(startRotation);\n #endif\n #if ROTATION_OVER_TIME_MODULE_ENABLE\n if (u_rotation_mode == 1) {\n vec3 euler = unpackCurveData(rotation_over_time_tex0, timeCoord0) * normalizedTime * a_dir_life.w;\n vec4 quat = eulerToQuat(euler);\n mat3 mLocal = quatToMat3(quat);\n mat3 mStart = quatToMat3(rot);\n rot = mat3ToQuat(mStart * mLocal);\n } else {\n vec3 rotation_0 = unpackCurveData(rotation_over_time_tex0, timeCoord0);\n vec3 rotation_1 = unpackCurveData(rotation_over_time_tex0, timeCoord1);\n float factor_r = pseudoRandom(a_rndSeed + 125292.);\n vec3 euler = mix(rotation_0, rotation_1, factor_r) * normalizedTime * a_dir_life.w;\n #if CC_RENDER_MODE == 3 || CC_RENDER_MODE == 2\n euler = vec3(0.0, 0.0, euler.z);\n #endif\n vec4 quat = eulerToQuat(euler);\n mat3 mLocal = quatToMat3(quat);\n mat3 mStart = quatToMat3(rot);\n rot = mat3ToQuat(mStart * mLocal);\n }\n #endif\n #if COLOR_OVER_TIME_MODULE_ENABLE\n if (u_color_mode == 1) {\n color = a_color * texture2D(color_over_time_tex0, timeCoord0);\n } else {\n vec4 color_0 = texture2D(color_over_time_tex0, timeCoord0);\n vec4 color_1 = texture2D(color_over_time_tex0, timeCoord1);\n float factor_c = pseudoRandom(a_rndSeed + 91041.);\n color = a_color * mix(color_0, color_1, factor_c);\n }\n #endif\n #if !COLOR_OVER_TIME_MODULE_ENABLE\n color = a_color;\n #endif\n #if CC_RENDER_MODE != 4\n vec2 cornerOffset = vec2((vertIdx - 0.5));\n #if CC_RENDER_MODE == 1\n rot = vec4(0.0, 0.0, 0.0, 1.0);\n #endif\n computeVertPos(pos, cornerOffset, rot, compScale\n #if CC_RENDER_MODE == 0 || CC_RENDER_MODE == 3\n , cc_matViewInv\n #endif\n #if CC_RENDER_MODE == 1\n , cc_cameraPos.xyz\n , velocity\n , frameTile_velLenScale.z\n , frameTile_velLenScale.w\n #if !CC_INSTANCE_PARTICLE\n , a_size_uv.w\n #endif\n #if CC_INSTANCE_PARTICLE\n , a_uv.x\n #endif\n #endif\n );\n #endif\n #if CC_RENDER_MODE == 4\n mat3 rotMat = quatToMat3(rot);\n mat3 nodeMat = quatToMat3(nodeRotation);\n rotMat = nodeMat * rotMat;\n rot = mat3ToQuat(rotMat);\n mat4 xformNoScale = matrixFromRT(rot, pos.xyz);\n mat4 xform = matFromRTS(rot, pos.xyz, compScale);\n pos = xform * vec4(a_texCoord3, 1);\n vec4 normal = xformNoScale * vec4(a_normal, 0);\n color *= a_color1;\n #endif\n pos = cc_matViewProj * pos;\n float frameIndex = 0.;\n #if TEXTURE_ANIMATION_MODULE_ENABLE\n float startFrame = 0.;\n vec3 frameInfo = vec3(0.);\n if (int(u_anim_info.x) == 1) {\n frameInfo = unpackCurveData(texture_animation_tex0, timeCoord0);\n } else {\n vec3 frameInfo0 = unpackCurveData(texture_animation_tex0, timeCoord0);\n vec3 frameInfo1 = unpackCurveData(texture_animation_tex0, timeCoord1);\n float factor_t = pseudoRandom(a_rndSeed + 90794.);\n frameInfo = mix(frameInfo0, frameInfo1, factor_t);\n }\n startFrame = frameInfo.x / u_anim_info.y;\n float EPSILON = 1e-6;\n frameIndex = repeat(u_anim_info.z * (frameInfo.y + startFrame), 1. + EPSILON);\n #endif\n uv = computeUV(frameIndex, vertIdx, frameTile_velLenScale.xy) * mainTiling_Offset.xy + mainTiling_Offset.zw;\n return pos;\n}\nvoid main() { gl_Position = gpvs_main(); }",
  1298. "frag": "\nprecision mediump float;\nvec4 CCFragOutput (vec4 color) {\n return color;\n}\nvarying vec2 uv;\nvarying vec4 color;\nuniform sampler2D mainTexture;\n uniform vec4 tintColor;\nvec4 add () {\n vec4 col = 2.0 * color * tintColor * texture2D(mainTexture, uv);\n return CCFragOutput(col);\n}\nvoid main() { gl_FragColor = add(); }"
  1299. },
  1300. "builtins": {
  1301. "globals": {
  1302. "blocks": [
  1303. {
  1304. "name": "CCGlobal",
  1305. "defines": []
  1306. },
  1307. {
  1308. "name": "CCCamera",
  1309. "defines": []
  1310. }
  1311. ],
  1312. "samplerTextures": [],
  1313. "buffers": [],
  1314. "images": []
  1315. },
  1316. "locals": {
  1317. "blocks": [
  1318. {
  1319. "name": "CCLocal",
  1320. "defines": []
  1321. }
  1322. ],
  1323. "samplerTextures": [],
  1324. "buffers": [],
  1325. "images": []
  1326. },
  1327. "statistics": {
  1328. "CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS": 71,
  1329. "CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS": 43
  1330. }
  1331. },
  1332. "defines": [
  1333. {
  1334. "name": "CC_RENDER_MODE",
  1335. "type": "number",
  1336. "defines": [],
  1337. "range": [
  1338. 0,
  1339. 4
  1340. ]
  1341. },
  1342. {
  1343. "name": "CC_INSTANCE_PARTICLE",
  1344. "type": "boolean",
  1345. "defines": []
  1346. },
  1347. {
  1348. "name": "USE_VK_SHADER",
  1349. "type": "boolean",
  1350. "defines": []
  1351. },
  1352. {
  1353. "name": "COLOR_OVER_TIME_MODULE_ENABLE",
  1354. "type": "boolean",
  1355. "defines": []
  1356. },
  1357. {
  1358. "name": "ROTATION_OVER_TIME_MODULE_ENABLE",
  1359. "type": "boolean",
  1360. "defines": []
  1361. },
  1362. {
  1363. "name": "SIZE_OVER_TIME_MODULE_ENABLE",
  1364. "type": "boolean",
  1365. "defines": []
  1366. },
  1367. {
  1368. "name": "FORCE_OVER_TIME_MODULE_ENABLE",
  1369. "type": "boolean",
  1370. "defines": []
  1371. },
  1372. {
  1373. "name": "VELOCITY_OVER_TIME_MODULE_ENABLE",
  1374. "type": "boolean",
  1375. "defines": []
  1376. },
  1377. {
  1378. "name": "TEXTURE_ANIMATION_MODULE_ENABLE",
  1379. "type": "boolean",
  1380. "defines": []
  1381. },
  1382. {
  1383. "name": "CC_USE_WORLD_SPACE",
  1384. "type": "boolean",
  1385. "defines": []
  1386. }
  1387. ],
  1388. "name": "particles/builtin-particle-gpu|builtin/internal/particle-vs-gpu:gpvs_main|tinted-fs:add"
  1389. },
  1390. {
  1391. "blocks": [
  1392. {
  1393. "name": "Constants",
  1394. "members": [
  1395. {
  1396. "name": "mainTiling_Offset",
  1397. "type": 16,
  1398. "count": 1
  1399. },
  1400. {
  1401. "name": "frameTile_velLenScale",
  1402. "type": 16,
  1403. "count": 1
  1404. },
  1405. {
  1406. "name": "scale",
  1407. "type": 16,
  1408. "count": 1
  1409. },
  1410. {
  1411. "name": "nodeRotation",
  1412. "type": 16,
  1413. "count": 1
  1414. }
  1415. ],
  1416. "defines": [],
  1417. "stageFlags": 1,
  1418. "binding": 0
  1419. },
  1420. {
  1421. "name": "SampleConstants",
  1422. "members": [
  1423. {
  1424. "name": "u_sampleInfo",
  1425. "type": 16,
  1426. "count": 1
  1427. }
  1428. ],
  1429. "defines": [],
  1430. "stageFlags": 1,
  1431. "binding": 1
  1432. },
  1433. {
  1434. "name": "TickConstants",
  1435. "members": [
  1436. {
  1437. "name": "u_worldRot",
  1438. "type": 16,
  1439. "count": 1
  1440. },
  1441. {
  1442. "name": "u_timeDelta",
  1443. "type": 16,
  1444. "count": 1
  1445. }
  1446. ],
  1447. "defines": [],
  1448. "stageFlags": 1,
  1449. "binding": 2
  1450. },
  1451. {
  1452. "name": "ColorConstant",
  1453. "members": [
  1454. {
  1455. "name": "u_color_mode",
  1456. "type": 5,
  1457. "count": 1
  1458. }
  1459. ],
  1460. "defines": [
  1461. "COLOR_OVER_TIME_MODULE_ENABLE"
  1462. ],
  1463. "stageFlags": 1,
  1464. "binding": 3
  1465. },
  1466. {
  1467. "name": "RotationConstant",
  1468. "members": [
  1469. {
  1470. "name": "u_rotation_mode",
  1471. "type": 5,
  1472. "count": 1
  1473. }
  1474. ],
  1475. "defines": [
  1476. "ROTATION_OVER_TIME_MODULE_ENABLE"
  1477. ],
  1478. "stageFlags": 1,
  1479. "binding": 4
  1480. },
  1481. {
  1482. "name": "SizeConstant",
  1483. "members": [
  1484. {
  1485. "name": "u_size_mode",
  1486. "type": 5,
  1487. "count": 1
  1488. }
  1489. ],
  1490. "defines": [
  1491. "SIZE_OVER_TIME_MODULE_ENABLE"
  1492. ],
  1493. "stageFlags": 1,
  1494. "binding": 5
  1495. },
  1496. {
  1497. "name": "ForceConstant",
  1498. "members": [
  1499. {
  1500. "name": "u_force_mode",
  1501. "type": 5,
  1502. "count": 1
  1503. },
  1504. {
  1505. "name": "u_force_space",
  1506. "type": 5,
  1507. "count": 1
  1508. }
  1509. ],
  1510. "defines": [
  1511. "FORCE_OVER_TIME_MODULE_ENABLE"
  1512. ],
  1513. "stageFlags": 1,
  1514. "binding": 6
  1515. },
  1516. {
  1517. "name": "VelocityConstant",
  1518. "members": [
  1519. {
  1520. "name": "u_velocity_mode",
  1521. "type": 5,
  1522. "count": 1
  1523. },
  1524. {
  1525. "name": "u_velocity_space",
  1526. "type": 5,
  1527. "count": 1
  1528. }
  1529. ],
  1530. "defines": [
  1531. "VELOCITY_OVER_TIME_MODULE_ENABLE"
  1532. ],
  1533. "stageFlags": 1,
  1534. "binding": 7
  1535. },
  1536. {
  1537. "name": "AnimationConstant",
  1538. "members": [
  1539. {
  1540. "name": "u_anim_info",
  1541. "type": 16,
  1542. "count": 1
  1543. }
  1544. ],
  1545. "defines": [
  1546. "TEXTURE_ANIMATION_MODULE_ENABLE"
  1547. ],
  1548. "stageFlags": 1,
  1549. "binding": 8
  1550. },
  1551. {
  1552. "name": "FragConstants",
  1553. "members": [
  1554. {
  1555. "name": "tintColor",
  1556. "type": 16,
  1557. "count": 1
  1558. }
  1559. ],
  1560. "defines": [],
  1561. "stageFlags": 16,
  1562. "binding": 9
  1563. }
  1564. ],
  1565. "samplerTextures": [
  1566. {
  1567. "name": "color_over_time_tex0",
  1568. "type": 28,
  1569. "count": 1,
  1570. "defines": [
  1571. "COLOR_OVER_TIME_MODULE_ENABLE"
  1572. ],
  1573. "stageFlags": 1,
  1574. "binding": 10
  1575. },
  1576. {
  1577. "name": "rotation_over_time_tex0",
  1578. "type": 28,
  1579. "count": 1,
  1580. "defines": [
  1581. "ROTATION_OVER_TIME_MODULE_ENABLE"
  1582. ],
  1583. "stageFlags": 1,
  1584. "binding": 11
  1585. },
  1586. {
  1587. "name": "size_over_time_tex0",
  1588. "type": 28,
  1589. "count": 1,
  1590. "defines": [
  1591. "SIZE_OVER_TIME_MODULE_ENABLE"
  1592. ],
  1593. "stageFlags": 1,
  1594. "binding": 12
  1595. },
  1596. {
  1597. "name": "force_over_time_tex0",
  1598. "type": 28,
  1599. "count": 1,
  1600. "defines": [
  1601. "FORCE_OVER_TIME_MODULE_ENABLE"
  1602. ],
  1603. "stageFlags": 1,
  1604. "binding": 13
  1605. },
  1606. {
  1607. "name": "velocity_over_time_tex0",
  1608. "type": 28,
  1609. "count": 1,
  1610. "defines": [
  1611. "VELOCITY_OVER_TIME_MODULE_ENABLE"
  1612. ],
  1613. "stageFlags": 1,
  1614. "binding": 14
  1615. },
  1616. {
  1617. "name": "texture_animation_tex0",
  1618. "type": 28,
  1619. "count": 1,
  1620. "defines": [
  1621. "TEXTURE_ANIMATION_MODULE_ENABLE"
  1622. ],
  1623. "stageFlags": 1,
  1624. "binding": 15
  1625. },
  1626. {
  1627. "name": "mainTexture",
  1628. "type": 28,
  1629. "count": 1,
  1630. "defines": [],
  1631. "stageFlags": 16,
  1632. "binding": 16
  1633. }
  1634. ],
  1635. "samplers": [],
  1636. "textures": [],
  1637. "buffers": [],
  1638. "images": [],
  1639. "subpassInputs": [],
  1640. "attributes": [
  1641. {
  1642. "name": "a_position_starttime",
  1643. "defines": [],
  1644. "format": 44,
  1645. "location": 0
  1646. },
  1647. {
  1648. "name": "a_color",
  1649. "defines": [],
  1650. "format": 44,
  1651. "location": 1
  1652. },
  1653. {
  1654. "name": "a_dir_life",
  1655. "defines": [],
  1656. "format": 44,
  1657. "location": 2
  1658. },
  1659. {
  1660. "name": "a_rndSeed",
  1661. "defines": [],
  1662. "format": 11,
  1663. "location": 3
  1664. },
  1665. {
  1666. "name": "a_size_uv",
  1667. "defines": [
  1668. "!CC_INSTANCE_PARTICLE"
  1669. ],
  1670. "format": 44,
  1671. "location": 4
  1672. },
  1673. {
  1674. "name": "a_rotation_uv",
  1675. "defines": [
  1676. "!CC_INSTANCE_PARTICLE"
  1677. ],
  1678. "format": 44,
  1679. "location": 5
  1680. },
  1681. {
  1682. "name": "a_size_fid",
  1683. "defines": [
  1684. "CC_INSTANCE_PARTICLE"
  1685. ],
  1686. "format": 44,
  1687. "location": 6
  1688. },
  1689. {
  1690. "name": "a_rotation",
  1691. "defines": [
  1692. "CC_INSTANCE_PARTICLE"
  1693. ],
  1694. "format": 32,
  1695. "location": 7
  1696. },
  1697. {
  1698. "name": "a_uv",
  1699. "defines": [
  1700. "CC_INSTANCE_PARTICLE"
  1701. ],
  1702. "format": 32,
  1703. "location": 8
  1704. },
  1705. {
  1706. "name": "a_texCoord",
  1707. "defines": [
  1708. "CC_RENDER_MODE"
  1709. ],
  1710. "format": 32,
  1711. "location": 9
  1712. },
  1713. {
  1714. "name": "a_texCoord3",
  1715. "defines": [
  1716. "CC_RENDER_MODE"
  1717. ],
  1718. "format": 32,
  1719. "location": 10
  1720. },
  1721. {
  1722. "name": "a_normal",
  1723. "defines": [
  1724. "CC_RENDER_MODE"
  1725. ],
  1726. "format": 32,
  1727. "location": 11
  1728. },
  1729. {
  1730. "name": "a_color1",
  1731. "defines": [
  1732. "CC_RENDER_MODE"
  1733. ],
  1734. "format": 44,
  1735. "location": 12
  1736. }
  1737. ],
  1738. "varyings": [
  1739. {
  1740. "name": "uv",
  1741. "type": 14,
  1742. "count": 1,
  1743. "defines": [],
  1744. "stageFlags": 17,
  1745. "location": 0
  1746. },
  1747. {
  1748. "name": "color",
  1749. "type": 16,
  1750. "count": 1,
  1751. "defines": [],
  1752. "stageFlags": 17,
  1753. "location": 1
  1754. }
  1755. ],
  1756. "fragColors": [
  1757. {
  1758. "name": "cc_FragColor",
  1759. "typename": "vec4",
  1760. "type": 16,
  1761. "count": 1,
  1762. "defines": [],
  1763. "stageFlags": 16,
  1764. "location": 0
  1765. }
  1766. ],
  1767. "descriptors": [
  1768. {
  1769. "rate": 0,
  1770. "blocks": [
  1771. {
  1772. "tags": {
  1773. "builtin": "local"
  1774. },
  1775. "name": "CCLocal",
  1776. "members": [
  1777. {
  1778. "name": "cc_matWorld",
  1779. "typename": "mat4",
  1780. "type": 25,
  1781. "count": 1,
  1782. "precision": "highp "
  1783. },
  1784. {
  1785. "name": "cc_matWorldIT",
  1786. "typename": "mat4",
  1787. "type": 25,
  1788. "count": 1,
  1789. "precision": "highp "
  1790. },
  1791. {
  1792. "name": "cc_lightingMapUVParam",
  1793. "typename": "vec4",
  1794. "type": 16,
  1795. "count": 1,
  1796. "precision": "highp "
  1797. },
  1798. {
  1799. "name": "cc_localShadowBias",
  1800. "typename": "vec4",
  1801. "type": 16,
  1802. "count": 1,
  1803. "precision": "highp "
  1804. },
  1805. {
  1806. "name": "cc_reflectionProbeData1",
  1807. "typename": "vec4",
  1808. "type": 16,
  1809. "count": 1,
  1810. "precision": "highp "
  1811. },
  1812. {
  1813. "name": "cc_reflectionProbeData2",
  1814. "typename": "vec4",
  1815. "type": 16,
  1816. "count": 1,
  1817. "precision": "highp "
  1818. },
  1819. {
  1820. "name": "cc_reflectionProbeBlendData1",
  1821. "typename": "vec4",
  1822. "type": 16,
  1823. "count": 1,
  1824. "precision": "highp "
  1825. },
  1826. {
  1827. "name": "cc_reflectionProbeBlendData2",
  1828. "typename": "vec4",
  1829. "type": 16,
  1830. "count": 1,
  1831. "precision": "highp "
  1832. }
  1833. ],
  1834. "defines": [],
  1835. "stageFlags": 1
  1836. }
  1837. ],
  1838. "samplerTextures": [],
  1839. "samplers": [],
  1840. "textures": [],
  1841. "buffers": [],
  1842. "images": [],
  1843. "subpassInputs": []
  1844. },
  1845. {
  1846. "rate": 1,
  1847. "blocks": [
  1848. {
  1849. "name": "Constants",
  1850. "members": [
  1851. {
  1852. "name": "mainTiling_Offset",
  1853. "type": 16,
  1854. "count": 1
  1855. },
  1856. {
  1857. "name": "frameTile_velLenScale",
  1858. "type": 16,
  1859. "count": 1
  1860. },
  1861. {
  1862. "name": "scale",
  1863. "type": 16,
  1864. "count": 1
  1865. },
  1866. {
  1867. "name": "nodeRotation",
  1868. "type": 16,
  1869. "count": 1
  1870. }
  1871. ],
  1872. "defines": [],
  1873. "stageFlags": 1,
  1874. "binding": 0
  1875. },
  1876. {
  1877. "name": "SampleConstants",
  1878. "members": [
  1879. {
  1880. "name": "u_sampleInfo",
  1881. "type": 16,
  1882. "count": 1
  1883. }
  1884. ],
  1885. "defines": [],
  1886. "stageFlags": 1,
  1887. "binding": 1
  1888. },
  1889. {
  1890. "name": "TickConstants",
  1891. "members": [
  1892. {
  1893. "name": "u_worldRot",
  1894. "type": 16,
  1895. "count": 1
  1896. },
  1897. {
  1898. "name": "u_timeDelta",
  1899. "type": 16,
  1900. "count": 1
  1901. }
  1902. ],
  1903. "defines": [],
  1904. "stageFlags": 1,
  1905. "binding": 2
  1906. },
  1907. {
  1908. "name": "ColorConstant",
  1909. "members": [
  1910. {
  1911. "name": "u_color_mode",
  1912. "type": 5,
  1913. "count": 1
  1914. }
  1915. ],
  1916. "defines": [
  1917. "COLOR_OVER_TIME_MODULE_ENABLE"
  1918. ],
  1919. "stageFlags": 1,
  1920. "binding": 3
  1921. },
  1922. {
  1923. "name": "RotationConstant",
  1924. "members": [
  1925. {
  1926. "name": "u_rotation_mode",
  1927. "type": 5,
  1928. "count": 1
  1929. }
  1930. ],
  1931. "defines": [
  1932. "ROTATION_OVER_TIME_MODULE_ENABLE"
  1933. ],
  1934. "stageFlags": 1,
  1935. "binding": 4
  1936. },
  1937. {
  1938. "name": "SizeConstant",
  1939. "members": [
  1940. {
  1941. "name": "u_size_mode",
  1942. "type": 5,
  1943. "count": 1
  1944. }
  1945. ],
  1946. "defines": [
  1947. "SIZE_OVER_TIME_MODULE_ENABLE"
  1948. ],
  1949. "stageFlags": 1,
  1950. "binding": 5
  1951. },
  1952. {
  1953. "name": "ForceConstant",
  1954. "members": [
  1955. {
  1956. "name": "u_force_mode",
  1957. "type": 5,
  1958. "count": 1
  1959. },
  1960. {
  1961. "name": "u_force_space",
  1962. "type": 5,
  1963. "count": 1
  1964. }
  1965. ],
  1966. "defines": [
  1967. "FORCE_OVER_TIME_MODULE_ENABLE"
  1968. ],
  1969. "stageFlags": 1,
  1970. "binding": 6
  1971. },
  1972. {
  1973. "name": "VelocityConstant",
  1974. "members": [
  1975. {
  1976. "name": "u_velocity_mode",
  1977. "type": 5,
  1978. "count": 1
  1979. },
  1980. {
  1981. "name": "u_velocity_space",
  1982. "type": 5,
  1983. "count": 1
  1984. }
  1985. ],
  1986. "defines": [
  1987. "VELOCITY_OVER_TIME_MODULE_ENABLE"
  1988. ],
  1989. "stageFlags": 1,
  1990. "binding": 7
  1991. },
  1992. {
  1993. "name": "AnimationConstant",
  1994. "members": [
  1995. {
  1996. "name": "u_anim_info",
  1997. "type": 16,
  1998. "count": 1
  1999. }
  2000. ],
  2001. "defines": [
  2002. "TEXTURE_ANIMATION_MODULE_ENABLE"
  2003. ],
  2004. "stageFlags": 1,
  2005. "binding": 8
  2006. },
  2007. {
  2008. "name": "FragConstants",
  2009. "members": [
  2010. {
  2011. "name": "tintColor",
  2012. "type": 16,
  2013. "count": 1
  2014. }
  2015. ],
  2016. "defines": [],
  2017. "stageFlags": 16,
  2018. "binding": 9
  2019. }
  2020. ],
  2021. "samplerTextures": [
  2022. {
  2023. "name": "color_over_time_tex0",
  2024. "type": 28,
  2025. "count": 1,
  2026. "defines": [
  2027. "COLOR_OVER_TIME_MODULE_ENABLE"
  2028. ],
  2029. "stageFlags": 1,
  2030. "binding": 10
  2031. },
  2032. {
  2033. "name": "rotation_over_time_tex0",
  2034. "type": 28,
  2035. "count": 1,
  2036. "defines": [
  2037. "ROTATION_OVER_TIME_MODULE_ENABLE"
  2038. ],
  2039. "stageFlags": 1,
  2040. "binding": 11
  2041. },
  2042. {
  2043. "name": "size_over_time_tex0",
  2044. "type": 28,
  2045. "count": 1,
  2046. "defines": [
  2047. "SIZE_OVER_TIME_MODULE_ENABLE"
  2048. ],
  2049. "stageFlags": 1,
  2050. "binding": 12
  2051. },
  2052. {
  2053. "name": "force_over_time_tex0",
  2054. "type": 28,
  2055. "count": 1,
  2056. "defines": [
  2057. "FORCE_OVER_TIME_MODULE_ENABLE"
  2058. ],
  2059. "stageFlags": 1,
  2060. "binding": 13
  2061. },
  2062. {
  2063. "name": "velocity_over_time_tex0",
  2064. "type": 28,
  2065. "count": 1,
  2066. "defines": [
  2067. "VELOCITY_OVER_TIME_MODULE_ENABLE"
  2068. ],
  2069. "stageFlags": 1,
  2070. "binding": 14
  2071. },
  2072. {
  2073. "name": "texture_animation_tex0",
  2074. "type": 28,
  2075. "count": 1,
  2076. "defines": [
  2077. "TEXTURE_ANIMATION_MODULE_ENABLE"
  2078. ],
  2079. "stageFlags": 1,
  2080. "binding": 15
  2081. },
  2082. {
  2083. "name": "mainTexture",
  2084. "type": 28,
  2085. "count": 1,
  2086. "defines": [],
  2087. "stageFlags": 16,
  2088. "binding": 16
  2089. }
  2090. ],
  2091. "samplers": [],
  2092. "textures": [],
  2093. "buffers": [],
  2094. "images": [],
  2095. "subpassInputs": []
  2096. },
  2097. {
  2098. "rate": 2,
  2099. "blocks": [],
  2100. "samplerTextures": [],
  2101. "samplers": [],
  2102. "textures": [],
  2103. "buffers": [],
  2104. "images": [],
  2105. "subpassInputs": []
  2106. },
  2107. {
  2108. "rate": 3,
  2109. "blocks": [
  2110. {
  2111. "tags": {
  2112. "builtin": "global"
  2113. },
  2114. "name": "CCGlobal",
  2115. "members": [
  2116. {
  2117. "name": "cc_time",
  2118. "typename": "vec4",
  2119. "type": 16,
  2120. "count": 1,
  2121. "precision": "highp "
  2122. },
  2123. {
  2124. "name": "cc_screenSize",
  2125. "typename": "vec4",
  2126. "type": 16,
  2127. "count": 1,
  2128. "precision": "mediump "
  2129. },
  2130. {
  2131. "name": "cc_nativeSize",
  2132. "typename": "vec4",
  2133. "type": 16,
  2134. "count": 1,
  2135. "precision": "mediump "
  2136. },
  2137. {
  2138. "name": "cc_probeInfo",
  2139. "typename": "vec4",
  2140. "type": 16,
  2141. "count": 1,
  2142. "precision": "mediump "
  2143. },
  2144. {
  2145. "name": "cc_debug_view_mode",
  2146. "typename": "vec4",
  2147. "type": 16,
  2148. "count": 1,
  2149. "precision": "mediump "
  2150. }
  2151. ],
  2152. "defines": [],
  2153. "stageFlags": 17
  2154. },
  2155. {
  2156. "tags": {
  2157. "builtin": "global"
  2158. },
  2159. "name": "CCCamera",
  2160. "members": [
  2161. {
  2162. "name": "cc_matView",
  2163. "typename": "mat4",
  2164. "type": 25,
  2165. "count": 1,
  2166. "precision": "highp "
  2167. },
  2168. {
  2169. "name": "cc_matViewInv",
  2170. "typename": "mat4",
  2171. "type": 25,
  2172. "count": 1,
  2173. "precision": "highp "
  2174. },
  2175. {
  2176. "name": "cc_matProj",
  2177. "typename": "mat4",
  2178. "type": 25,
  2179. "count": 1,
  2180. "precision": "highp "
  2181. },
  2182. {
  2183. "name": "cc_matProjInv",
  2184. "typename": "mat4",
  2185. "type": 25,
  2186. "count": 1,
  2187. "precision": "highp "
  2188. },
  2189. {
  2190. "name": "cc_matViewProj",
  2191. "typename": "mat4",
  2192. "type": 25,
  2193. "count": 1,
  2194. "precision": "highp "
  2195. },
  2196. {
  2197. "name": "cc_matViewProjInv",
  2198. "typename": "mat4",
  2199. "type": 25,
  2200. "count": 1,
  2201. "precision": "highp "
  2202. },
  2203. {
  2204. "name": "cc_cameraPos",
  2205. "typename": "vec4",
  2206. "type": 16,
  2207. "count": 1,
  2208. "precision": "highp "
  2209. },
  2210. {
  2211. "name": "cc_surfaceTransform",
  2212. "typename": "vec4",
  2213. "type": 16,
  2214. "count": 1,
  2215. "precision": "mediump "
  2216. },
  2217. {
  2218. "name": "cc_screenScale",
  2219. "typename": "vec4",
  2220. "type": 16,
  2221. "count": 1,
  2222. "precision": "mediump "
  2223. },
  2224. {
  2225. "name": "cc_exposure",
  2226. "typename": "vec4",
  2227. "type": 16,
  2228. "count": 1,
  2229. "precision": "mediump "
  2230. },
  2231. {
  2232. "name": "cc_mainLitDir",
  2233. "typename": "vec4",
  2234. "type": 16,
  2235. "count": 1,
  2236. "precision": "mediump "
  2237. },
  2238. {
  2239. "name": "cc_mainLitColor",
  2240. "typename": "vec4",
  2241. "type": 16,
  2242. "count": 1,
  2243. "precision": "mediump "
  2244. },
  2245. {
  2246. "name": "cc_ambientSky",
  2247. "typename": "vec4",
  2248. "type": 16,
  2249. "count": 1,
  2250. "precision": "mediump "
  2251. },
  2252. {
  2253. "name": "cc_ambientGround",
  2254. "typename": "vec4",
  2255. "type": 16,
  2256. "count": 1,
  2257. "precision": "mediump "
  2258. },
  2259. {
  2260. "name": "cc_fogColor",
  2261. "typename": "vec4",
  2262. "type": 16,
  2263. "count": 1,
  2264. "precision": "mediump "
  2265. },
  2266. {
  2267. "name": "cc_fogBase",
  2268. "typename": "vec4",
  2269. "type": 16,
  2270. "count": 1,
  2271. "precision": "mediump "
  2272. },
  2273. {
  2274. "name": "cc_fogAdd",
  2275. "typename": "vec4",
  2276. "type": 16,
  2277. "count": 1,
  2278. "precision": "mediump "
  2279. },
  2280. {
  2281. "name": "cc_nearFar",
  2282. "typename": "vec4",
  2283. "type": 16,
  2284. "count": 1,
  2285. "precision": "mediump "
  2286. },
  2287. {
  2288. "name": "cc_viewPort",
  2289. "typename": "vec4",
  2290. "type": 16,
  2291. "count": 1,
  2292. "precision": "mediump "
  2293. }
  2294. ],
  2295. "defines": [],
  2296. "stageFlags": 17
  2297. }
  2298. ],
  2299. "samplerTextures": [],
  2300. "samplers": [],
  2301. "textures": [],
  2302. "buffers": [],
  2303. "images": [],
  2304. "subpassInputs": []
  2305. }
  2306. ],
  2307. "hash": 2330235135,
  2308. "glsl4": {
  2309. "vert": "\nprecision mediump float;\nvec4 quaternionFromAxis (vec3 xAxis,vec3 yAxis,vec3 zAxis){\n mat3 m = mat3(xAxis,yAxis,zAxis);\n float trace = m[0][0] + m[1][1] + m[2][2];\n vec4 quat;\n if (trace > 0.) {\n float s = 0.5 / sqrt(trace + 1.0);\n quat.w = 0.25 / s;\n quat.x = (m[2][1] - m[1][2]) * s;\n quat.y = (m[0][2] - m[2][0]) * s;\n quat.z = (m[1][0] - m[0][1]) * s;\n } else if ((m[0][0] > m[1][1]) && (m[0][0] > m[2][2])) {\n float s = 2.0 * sqrt(1.0 + m[0][0] - m[1][1] - m[2][2]);\n quat.w = (m[2][1] - m[1][2]) / s;\n quat.x = 0.25 * s;\n quat.y = (m[0][1] + m[1][0]) / s;\n quat.z = (m[0][2] + m[2][0]) / s;\n } else if (m[1][1] > m[2][2]) {\n float s = 2.0 * sqrt(1.0 + m[1][1] - m[0][0] - m[2][2]);\n quat.w = (m[0][2] - m[2][0]) / s;\n quat.x = (m[0][1] + m[1][0]) / s;\n quat.y = 0.25 * s;\n quat.z = (m[1][2] + m[2][1]) / s;\n } else {\n float s = 2.0 * sqrt(1.0 + m[2][2] - m[0][0] - m[1][1]);\n quat.w = (m[1][0] - m[0][1]) / s;\n quat.x = (m[0][2] + m[2][0]) / s;\n quat.y = (m[1][2] + m[2][1]) / s;\n quat.z = 0.25 * s;\n }\n float len = quat.x * quat.x + quat.y * quat.y + quat.z * quat.z + quat.w * quat.w;\n if (len > 0.) {\n len = 1. / sqrt(len);\n quat.x = quat.x * len;\n quat.y = quat.y * len;\n quat.z = quat.z * len;\n quat.w = quat.w * len;\n }\n return quat;\n}\nvec4 quaternionFromEuler (vec3 angle){\n float x = angle.x / 2.;\n float y = angle.y / 2.;\n float z = angle.z / 2.;\n float sx = sin(x);\n float cx = cos(x);\n float sy = sin(y);\n float cy = cos(y);\n float sz = sin(z);\n float cz = cos(z);\n vec4 quat = vec4(0);\n quat.x = sx * cy * cz + cx * sy * sz;\n quat.y = cx * sy * cz + sx * cy * sz;\n quat.z = cx * cy * sz - sx * sy * cz;\n quat.w = cx * cy * cz - sx * sy * sz;\n return quat;\n}\nmat4 matrixFromRT (vec4 q, vec3 p){\n float x2 = q.x + q.x;\n float y2 = q.y + q.y;\n float z2 = q.z + q.z;\n float xx = q.x * x2;\n float xy = q.x * y2;\n float xz = q.x * z2;\n float yy = q.y * y2;\n float yz = q.y * z2;\n float zz = q.z * z2;\n float wx = q.w * x2;\n float wy = q.w * y2;\n float wz = q.w * z2;\n return mat4(\n 1. - (yy + zz), xy + wz, xz - wy, 0,\n xy - wz, 1. - (xx + zz), yz + wx, 0,\n xz + wy, yz - wx, 1. - (xx + yy), 0,\n p.x, p.y, p.z, 1\n );\n}\nmat4 matFromRTS (vec4 q, vec3 t, vec3 s){\n float x = q.x, y = q.y, z = q.z, w = q.w;\n float x2 = x + x;\n float y2 = y + y;\n float z2 = z + z;\n float xx = x * x2;\n float xy = x * y2;\n float xz = x * z2;\n float yy = y * y2;\n float yz = y * z2;\n float zz = z * z2;\n float wx = w * x2;\n float wy = w * y2;\n float wz = w * z2;\n float sx = s.x;\n float sy = s.y;\n float sz = s.z;\n return mat4((1. - (yy + zz)) * sx, (xy + wz) * sx, (xz - wy) * sx, 0,\n (xy - wz) * sy, (1. - (xx + zz)) * sy, (yz + wx) * sy, 0,\n (xz + wy) * sz, (yz - wx) * sz, (1. - (xx + yy)) * sz, 0,\n t.x, t.y, t.z, 1);\n}\nvec4 quatMultiply (vec4 a, vec4 b){\n vec4 quat;\n quat.x = a.x * b.w + a.w * b.x + a.y * b.z - a.z * b.y;\n quat.y = a.y * b.w + a.w * b.y + a.z * b.x - a.x * b.z;\n quat.z = a.z * b.w + a.w * b.z + a.x * b.y - a.y * b.x;\n quat.w = a.w * b.w - a.x * b.x - a.y * b.y - a.z * b.z;\n return quat;\n}\nvoid rotateVecFromQuat (inout vec3 v, vec4 q){\n float ix = q.w * v.x + q.y * v.z - q.z * v.y;\n float iy = q.w * v.y + q.z * v.x - q.x * v.z;\n float iz = q.w * v.z + q.x * v.y - q.y * v.x;\n float iw = -q.x * v.x - q.y * v.y - q.z * v.z;\n v.x = ix * q.w + iw * -q.x + iy * -q.z - iz * -q.y;\n v.y = iy * q.w + iw * -q.y + iz * -q.x - ix * -q.z;\n v.z = iz * q.w + iw * -q.z + ix * -q.y - iy * -q.x;\n}\nvec3 rotateInLocalSpace (vec3 pos, vec3 xAxis, vec3 yAxis, vec3 zAxis, vec4 q){\n vec4 viewQuat = quaternionFromAxis(xAxis, yAxis, zAxis);\n vec4 rotQuat = quatMultiply(viewQuat, q);\n rotateVecFromQuat(pos, rotQuat);\n return pos;\n}\nmat3 quatToMat3(vec4 q) {\n vec3 m0 = vec3(\n 1.0 - 2.0 * q.y * q.y - 2.0 * q.z * q.z,\n 2.0 * q.x * q.y + 2.0 * q.w * q.z,\n 2.0 * q.x * q.z - 2.0 * q.w * q.y);\n\tvec3 m1 = vec3(\n 2.0 * q.x * q.y - 2.0 * q.w * q.z,\n 1.0 - 2.0 * q.x * q.x - 2.0 * q.z * q.z,\n 2.0 * q.y * q.z + 2.0 * q.w * q.x);\n\tvec3 m2 = vec3(\n 2.0 * q.x * q.z + 2.0 * q.w * q.y,\n 2.0 * q.y * q.z - 2.0 * q.w * q.x,\n 1.0 - 2.0 * q.x * q.x - 2.0 * q.y * q.y);\n return mat3(m0, m1, m2);\n}\nvec4 mat3ToQuat(mat3 mat) {\n float tr = mat[0][0] + mat[1][1] + mat[2][2];\n\tfloat qw, qx, qy, qz;\n if (tr > 0.0) {\n float S = sqrt(tr + 1.0) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = 0.25 * S;\n\t qx = (mat[1][2] - mat[2][1]) * invS;\n\t qy = (mat[2][0] - mat[0][2]) * invS;\n\t qz = (mat[0][1] - mat[1][0]) * invS;\n } else if ((mat[0][0] > mat[1][1])&&(mat[0][0] > mat[2][2])) {\n float S = sqrt(1.0 + mat[0][0] - mat[1][1] - mat[2][2]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[1][2] - mat[2][1]) * invS;\n\t qx = 0.25 * S;\n\t qy = (mat[1][0] + mat[0][1]) * invS;\n\t qz = (mat[2][0] + mat[0][2]) * invS;\n } else if (mat[1][1] > mat[2][2]) {\n\t float S = sqrt(1.0 + mat[1][1] - mat[0][0] - mat[2][2]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[2][0] - mat[0][2]) * invS;\n\t qx = (mat[1][0] + mat[0][1]) * invS;\n\t qy = 0.25 * S;\n\t qz = (mat[2][1] + mat[1][2]) * invS;\n } else {\n\t float S = sqrt(1.0 + mat[2][2] - mat[0][0] - mat[1][1]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[0][1] - mat[1][0]) * invS;\n\t qx = (mat[2][0] + mat[0][2]) * invS;\n\t qy = (mat[2][1] + mat[1][2]) * invS;\n\t qz = 0.25 * S;\n }\n return vec4(qx, qy, qz, qw);\n}\nvec4 eulerToQuat(vec3 euler) {\n vec3 er = euler * 0.5;\n float x = er.x, y = er.y, z = er.z;\n float sx = sin(x);\n float cx = cos(x);\n float sy = sin(y);\n float cy = cos(y);\n float sz = sin(z);\n float cz = cos(z);\n vec4 quat;\n quat.x = sx * cy * cz + cx * sy * sz;\n quat.y = cx * sy * cz + sx * cy * sz;\n quat.z = cx * cy * sz - sx * sy * cz;\n quat.w = cx * cy * cz - sx * sy * sz;\n return quat;\n}\nlayout(set = 1, binding = 0) uniform Constants {\n vec4 mainTiling_Offset;\n vec4 frameTile_velLenScale;\n vec4 scale;\n vec4 nodeRotation;\n};\nlayout(set = 0, binding = 0) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(set = 0, binding = 1) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nlayout(set = 2, binding = 0) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n};\nlayout(location = 0) out mediump vec2 uv;\nlayout(location = 1) out mediump vec4 color;\nvoid computeVertPos (inout vec4 pos, vec2 vertOffset, vec4 q, vec3 s\n#if CC_RENDER_MODE == 0 || CC_RENDER_MODE == 3\n , mat4 viewInv\n#endif\n#if CC_RENDER_MODE == 1\n , vec3 eye\n , vec4 velocity\n , float velocityScale\n , float lengthScale\n , float xIndex\n#endif\n) {\n#if CC_RENDER_MODE == 0\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n vec3 camX = normalize(vec3(viewInv[0][0], viewInv[1][0], viewInv[2][0]));\n vec3 camY = normalize(vec3(viewInv[0][1], viewInv[1][1], viewInv[2][1]));\n vec3 camZ = normalize(vec3(viewInv[0][2], viewInv[1][2], viewInv[2][2]));\n pos.xyz += rotateInLocalSpace(viewSpaceVert, camX, camY, camZ, q);\n#elif CC_RENDER_MODE == 1\n vec3 camRight = normalize(cross(pos.xyz - eye, velocity.xyz)) * s.x;\n vec3 camUp = velocity.xyz * velocityScale + normalize(velocity.xyz) * lengthScale * s.y;\n pos.xyz += (camRight * abs(vertOffset.x) * sign(vertOffset.y)) - camUp * xIndex;\n#elif CC_RENDER_MODE == 2\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n vec3 camX = vec3(1, 0, 0);\n vec3 camY = vec3(0, 0, -1);\n pos.xyz += rotateInLocalSpace(viewSpaceVert, camX, camY, cross(camX, camY), q);\n#elif CC_RENDER_MODE == 3\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n rotateVecFromQuat(viewSpaceVert, q);\n vec3 camX = normalize(vec3(cc_matView[0][0], cc_matView[1][0], cc_matView[2][0]));\n vec3 camY = vec3(0, 1, 0);\n vec3 offset = camX * viewSpaceVert.x + camY * viewSpaceVert.y;\n pos.xyz += offset;\n#else\n pos.x += vertOffset.x;\n pos.y += vertOffset.y;\n#endif\n}\nvec2 computeUV (float frameIndex, vec2 vertIndex, vec2 frameTile){\n vec2 aniUV = vec2(0, floor(frameIndex * frameTile.y));\n aniUV.x = floor(frameIndex * frameTile.x * frameTile.y - aniUV.y * frameTile.x);\n#if CC_RENDER_MODE != 4\n vertIndex.y = 1. - vertIndex.y;\n#endif\n return (aniUV.xy + vertIndex) / vec2(frameTile.x, frameTile.y);\n}\nlayout(set = 1, binding = 1) uniform SampleConstants {\n vec4 u_sampleInfo;\n};\nlayout(set = 1, binding = 2) uniform TickConstants {\n vec4 u_worldRot;\n vec4 u_timeDelta;\n};\nlayout(location = 0) in vec4 a_position_starttime;\nlayout(location = 1) in vec4 a_color;\nlayout(location = 2) in vec4 a_dir_life;\nlayout(location = 3) in float a_rndSeed;\n#if !CC_INSTANCE_PARTICLE\n layout(location = 4) in vec4 a_size_uv;\n layout(location = 5) in vec4 a_rotation_uv;\n#endif\n#if CC_INSTANCE_PARTICLE\n layout(location = 6) in vec4 a_size_fid;\n layout(location = 7) in vec3 a_rotation;\n layout(location = 8) in vec3 a_uv;\n#endif\n#if CC_RENDER_MODE == 4\n layout(location = 9) in vec3 a_texCoord;\n layout(location = 10) in vec3 a_texCoord3;\n layout(location = 11) in vec3 a_normal;\n layout(location = 12) in vec4 a_color1;\n#endif\nvec3 unpackCurveData (sampler2D tex, vec2 coord) {\n vec4 a = texture(tex, coord);\n vec4 b = texture(tex, coord + u_sampleInfo.y);\n float c = fract(coord.x * u_sampleInfo.x);\n return mix(a.xyz, b.xyz, c);\n}\nvec3 unpackCurveData (sampler2D tex, vec2 coord, out float w) {\n vec4 a = texture(tex, coord);\n vec4 b = texture(tex, coord + u_sampleInfo.y);\n float c = fract(coord.x * u_sampleInfo.x);\n w = mix(a.w, b.w, c);\n return mix(a.xyz, b.xyz, c);\n}\nfloat pseudoRandom(float x) {\n#if USE_VK_SHADER\n float o = x;\n x = mod(x - 1.0, 2.0) - 1.0;\n float freqVar = 10.16640753482;\n float y = sin(freqVar * floor(o * 0.5 - 0.5));\n float v = max(0.0, 1.0-abs(x));\n v *= 0.7071067812;\n v = y < 0.0 ? -v : v;\n return v;\n#endif\n#if !USE_VK_SHADER\n float seed = mod(x, 233280.);\n float q = (seed * 9301. + 49297.) / 233280.;\n return fract(q);\n#endif\n}\n#if COLOR_OVER_TIME_MODULE_ENABLE\n layout(set = 1, binding = 10) uniform sampler2D color_over_time_tex0;\n layout(set = 1, binding = 3) uniform ColorConstant {\n int u_color_mode;\n };\n#endif\n#if ROTATION_OVER_TIME_MODULE_ENABLE\n layout(set = 1, binding = 11) uniform sampler2D rotation_over_time_tex0;\n layout(set = 1, binding = 4) uniform RotationConstant {\n int u_rotation_mode;\n };\n#endif\n#if SIZE_OVER_TIME_MODULE_ENABLE\n layout(set = 1, binding = 12) uniform sampler2D size_over_time_tex0;\n layout(set = 1, binding = 5) uniform SizeConstant {\n int u_size_mode;\n };\n#endif\n#if FORCE_OVER_TIME_MODULE_ENABLE\n layout(set = 1, binding = 13) uniform sampler2D force_over_time_tex0;\n layout(set = 1, binding = 6) uniform ForceConstant {\n int u_force_mode;\n int u_force_space;\n };\n#endif\n#if VELOCITY_OVER_TIME_MODULE_ENABLE\n layout(set = 1, binding = 14) uniform sampler2D velocity_over_time_tex0;\n layout(set = 1, binding = 7) uniform VelocityConstant {\n int u_velocity_mode;\n int u_velocity_space;\n };\n#endif\n#if TEXTURE_ANIMATION_MODULE_ENABLE\n layout(set = 1, binding = 15) uniform sampler2D texture_animation_tex0;\n layout(set = 1, binding = 8) uniform AnimationConstant {\n vec4 u_anim_info;\n };\n#endif\nfloat repeat (float t, float length) {\n return t - floor(t / length) * length;\n}\nvec4 rotateQuat (vec4 p, vec4 q) {\n vec3 iv = cross(q.xyz, p.xyz) + q.w * p.xyz;\n vec3 res = p.xyz + 2.0 * cross(q.xyz, iv);\n return vec4(res.xyz, p.w);\n}\nvec4 gpvs_main () {\n float activeTime = u_timeDelta.x - a_position_starttime.w;\n float normalizedTime = clamp(activeTime / a_dir_life.w, 0.0, 1.0);\n vec2 timeCoord0 = vec2(normalizedTime, 0.);\n vec2 timeCoord1 = vec2(normalizedTime, 1.);\n #if CC_RENDER_MODE == 4\n vec2 vertIdx = vec2(a_texCoord.x, a_texCoord.y);\n #endif\n #if CC_RENDER_MODE != 4\n #if !CC_INSTANCE_PARTICLE\n vec2 vertIdx = vec2(a_size_uv.w, a_rotation_uv.w);\n #endif\n #if CC_INSTANCE_PARTICLE\n vec2 vertIdx = a_uv.xy;\n #endif\n #endif\n vec4 velocity = vec4(a_dir_life.xyz, 0.);\n vec4 pos = vec4(a_position_starttime.xyz, 1.);\n #if !CC_INSTANCE_PARTICLE\n vec3 size = a_size_uv.xyz;\n #endif\n #if CC_INSTANCE_PARTICLE\n vec3 size = a_size_fid.xyz;\n #endif\n #if SIZE_OVER_TIME_MODULE_ENABLE\n if (u_size_mode == 1) {\n size *= unpackCurveData(size_over_time_tex0, timeCoord0);\n } else {\n vec3 size_0 = unpackCurveData(size_over_time_tex0, timeCoord0);\n vec3 size_1 = unpackCurveData(size_over_time_tex0, timeCoord1);\n float factor_s = pseudoRandom(a_rndSeed + 39825.);\n size *= mix(size_0, size_1, factor_s);\n }\n #endif\n vec3 compScale = scale.xyz * size;\n #if FORCE_OVER_TIME_MODULE_ENABLE\n vec3 forceAnim = vec3(0.);\n if (u_force_mode == 1) {\n forceAnim = unpackCurveData(force_over_time_tex0, timeCoord0);\n } else {\n vec3 force_0 = unpackCurveData(force_over_time_tex0, timeCoord0);\n vec3 force_1 = unpackCurveData(force_over_time_tex0, timeCoord1);\n float factor_f = pseudoRandom(a_rndSeed + 212165.);\n forceAnim = mix(force_0, force_1, factor_f);\n }\n vec4 forceTrack = vec4(forceAnim, 0.);\n if (u_force_space == 0) {\n forceTrack = rotateQuat(forceTrack, u_worldRot);\n }\n velocity.xyz += forceTrack.xyz;\n #endif\n #if VELOCITY_OVER_TIME_MODULE_ENABLE\n float speedModifier0 = 1.;\n float speedModifier1 = 1.;\n vec3 velocityAnim = vec3(0.);\n if (u_velocity_mode == 1) {\n velocityAnim = unpackCurveData(velocity_over_time_tex0, timeCoord0, speedModifier0);\n } else {\n vec3 vectory_0 = unpackCurveData(velocity_over_time_tex0, timeCoord0, speedModifier0);\n vec3 vectory_1 = unpackCurveData(velocity_over_time_tex0, timeCoord1, speedModifier1);\n float factor_v = pseudoRandom(a_rndSeed + 197866.);\n velocityAnim = mix(vectory_0, vectory_1, factor_v);\n speedModifier0 = mix(speedModifier0, speedModifier1, factor_v);\n }\n vec4 velocityTrack = vec4(velocityAnim, 0.);\n if (u_velocity_space == 0) {\n velocityTrack = rotateQuat(velocityTrack, u_worldRot);\n }\n velocity.xyz += velocityTrack.xyz;\n velocity.xyz *= speedModifier0;\n #endif\n pos.xyz += velocity.xyz * normalizedTime * a_dir_life.w;\n #if !CC_USE_WORLD_SPACE\n pos = cc_matWorld * pos;\n #if CC_RENDER_MODE == 1\n velocity = rotateQuat(velocity, u_worldRot);\n #endif\n #endif\n #if !CC_INSTANCE_PARTICLE\n vec3 startRotation = a_rotation_uv.xyz;\n #endif\n #if CC_INSTANCE_PARTICLE\n vec3 startRotation = a_rotation;\n #endif\n #if CC_RENDER_MODE != 4\n #if CC_RENDER_MODE == 0\n vec3 rotEuler = startRotation.xyz;\n #elif CC_RENDER_MODE == 1\n vec3 rotEuler = vec3(0.);\n #endif\n #if CC_RENDER_MODE != 0 && CC_RENDER_MODE != 1\n vec3 rotEuler = vec3(0., 0., startRotation.z);\n #endif\n vec4 rot = quaternionFromEuler(rotEuler);\n #endif\n #if CC_RENDER_MODE == 4\n vec4 rot = quaternionFromEuler(startRotation);\n #endif\n #if ROTATION_OVER_TIME_MODULE_ENABLE\n if (u_rotation_mode == 1) {\n vec3 euler = unpackCurveData(rotation_over_time_tex0, timeCoord0) * normalizedTime * a_dir_life.w;\n vec4 quat = eulerToQuat(euler);\n mat3 mLocal = quatToMat3(quat);\n mat3 mStart = quatToMat3(rot);\n rot = mat3ToQuat(mStart * mLocal);\n } else {\n vec3 rotation_0 = unpackCurveData(rotation_over_time_tex0, timeCoord0);\n vec3 rotation_1 = unpackCurveData(rotation_over_time_tex0, timeCoord1);\n float factor_r = pseudoRandom(a_rndSeed + 125292.);\n vec3 euler = mix(rotation_0, rotation_1, factor_r) * normalizedTime * a_dir_life.w;\n #if CC_RENDER_MODE == 3 || CC_RENDER_MODE == 2\n euler = vec3(0.0, 0.0, euler.z);\n #endif\n vec4 quat = eulerToQuat(euler);\n mat3 mLocal = quatToMat3(quat);\n mat3 mStart = quatToMat3(rot);\n rot = mat3ToQuat(mStart * mLocal);\n }\n #endif\n #if COLOR_OVER_TIME_MODULE_ENABLE\n if (u_color_mode == 1) {\n color = a_color * texture(color_over_time_tex0, timeCoord0);\n } else {\n vec4 color_0 = texture(color_over_time_tex0, timeCoord0);\n vec4 color_1 = texture(color_over_time_tex0, timeCoord1);\n float factor_c = pseudoRandom(a_rndSeed + 91041.);\n color = a_color * mix(color_0, color_1, factor_c);\n }\n #endif\n #if !COLOR_OVER_TIME_MODULE_ENABLE\n color = a_color;\n #endif\n #if CC_RENDER_MODE != 4\n vec2 cornerOffset = vec2((vertIdx - 0.5));\n #if CC_RENDER_MODE == 1\n rot = vec4(0.0, 0.0, 0.0, 1.0);\n #endif\n computeVertPos(pos, cornerOffset, rot, compScale\n #if CC_RENDER_MODE == 0 || CC_RENDER_MODE == 3\n , cc_matViewInv\n #endif\n #if CC_RENDER_MODE == 1\n , cc_cameraPos.xyz\n , velocity\n , frameTile_velLenScale.z\n , frameTile_velLenScale.w\n #if !CC_INSTANCE_PARTICLE\n , a_size_uv.w\n #endif\n #if CC_INSTANCE_PARTICLE\n , a_uv.x\n #endif\n #endif\n );\n #endif\n #if CC_RENDER_MODE == 4\n mat3 rotMat = quatToMat3(rot);\n mat3 nodeMat = quatToMat3(nodeRotation);\n rotMat = nodeMat * rotMat;\n rot = mat3ToQuat(rotMat);\n mat4 xformNoScale = matrixFromRT(rot, pos.xyz);\n mat4 xform = matFromRTS(rot, pos.xyz, compScale);\n pos = xform * vec4(a_texCoord3, 1);\n vec4 normal = xformNoScale * vec4(a_normal, 0);\n color *= a_color1;\n #endif\n pos = cc_matViewProj * pos;\n float frameIndex = 0.;\n #if TEXTURE_ANIMATION_MODULE_ENABLE\n float startFrame = 0.;\n vec3 frameInfo = vec3(0.);\n if (int(u_anim_info.x) == 1) {\n frameInfo = unpackCurveData(texture_animation_tex0, timeCoord0);\n } else {\n vec3 frameInfo0 = unpackCurveData(texture_animation_tex0, timeCoord0);\n vec3 frameInfo1 = unpackCurveData(texture_animation_tex0, timeCoord1);\n float factor_t = pseudoRandom(a_rndSeed + 90794.);\n frameInfo = mix(frameInfo0, frameInfo1, factor_t);\n }\n startFrame = frameInfo.x / u_anim_info.y;\n float EPSILON = 1e-6;\n frameIndex = repeat(u_anim_info.z * (frameInfo.y + startFrame), 1. + EPSILON);\n #endif\n uv = computeUV(frameIndex, vertIdx, frameTile_velLenScale.xy) * mainTiling_Offset.xy + mainTiling_Offset.zw;\n return pos;\n}\nvoid main() { gl_Position = gpvs_main(); }",
  2310. "frag": "\nprecision mediump float;\nlayout(set = 0, binding = 0) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(set = 0, binding = 1) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nvec4 CCFragOutput (vec4 color) {\n return color;\n}\nlayout(location = 0) in vec2 uv;\nlayout(location = 1) in vec4 color;\nlayout(set = 1, binding = 16) uniform sampler2D mainTexture;\nlayout(set = 1, binding = 9) uniform FragConstants {\n vec4 tintColor;\n};\nvec4 multiply () {\n vec4 col;\n vec4 texColor = texture(mainTexture, uv);\n col.rgb = tintColor.rgb * texColor.rgb * color.rgb * vec3(2.0);\n return CCFragOutput(col);\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = multiply(); }"
  2311. },
  2312. "glsl3": {
  2313. "vert": "\nprecision mediump float;\nvec4 quaternionFromAxis (vec3 xAxis,vec3 yAxis,vec3 zAxis){\n mat3 m = mat3(xAxis,yAxis,zAxis);\n float trace = m[0][0] + m[1][1] + m[2][2];\n vec4 quat;\n if (trace > 0.) {\n float s = 0.5 / sqrt(trace + 1.0);\n quat.w = 0.25 / s;\n quat.x = (m[2][1] - m[1][2]) * s;\n quat.y = (m[0][2] - m[2][0]) * s;\n quat.z = (m[1][0] - m[0][1]) * s;\n } else if ((m[0][0] > m[1][1]) && (m[0][0] > m[2][2])) {\n float s = 2.0 * sqrt(1.0 + m[0][0] - m[1][1] - m[2][2]);\n quat.w = (m[2][1] - m[1][2]) / s;\n quat.x = 0.25 * s;\n quat.y = (m[0][1] + m[1][0]) / s;\n quat.z = (m[0][2] + m[2][0]) / s;\n } else if (m[1][1] > m[2][2]) {\n float s = 2.0 * sqrt(1.0 + m[1][1] - m[0][0] - m[2][2]);\n quat.w = (m[0][2] - m[2][0]) / s;\n quat.x = (m[0][1] + m[1][0]) / s;\n quat.y = 0.25 * s;\n quat.z = (m[1][2] + m[2][1]) / s;\n } else {\n float s = 2.0 * sqrt(1.0 + m[2][2] - m[0][0] - m[1][1]);\n quat.w = (m[1][0] - m[0][1]) / s;\n quat.x = (m[0][2] + m[2][0]) / s;\n quat.y = (m[1][2] + m[2][1]) / s;\n quat.z = 0.25 * s;\n }\n float len = quat.x * quat.x + quat.y * quat.y + quat.z * quat.z + quat.w * quat.w;\n if (len > 0.) {\n len = 1. / sqrt(len);\n quat.x = quat.x * len;\n quat.y = quat.y * len;\n quat.z = quat.z * len;\n quat.w = quat.w * len;\n }\n return quat;\n}\nvec4 quaternionFromEuler (vec3 angle){\n float x = angle.x / 2.;\n float y = angle.y / 2.;\n float z = angle.z / 2.;\n float sx = sin(x);\n float cx = cos(x);\n float sy = sin(y);\n float cy = cos(y);\n float sz = sin(z);\n float cz = cos(z);\n vec4 quat = vec4(0);\n quat.x = sx * cy * cz + cx * sy * sz;\n quat.y = cx * sy * cz + sx * cy * sz;\n quat.z = cx * cy * sz - sx * sy * cz;\n quat.w = cx * cy * cz - sx * sy * sz;\n return quat;\n}\nmat4 matrixFromRT (vec4 q, vec3 p){\n float x2 = q.x + q.x;\n float y2 = q.y + q.y;\n float z2 = q.z + q.z;\n float xx = q.x * x2;\n float xy = q.x * y2;\n float xz = q.x * z2;\n float yy = q.y * y2;\n float yz = q.y * z2;\n float zz = q.z * z2;\n float wx = q.w * x2;\n float wy = q.w * y2;\n float wz = q.w * z2;\n return mat4(\n 1. - (yy + zz), xy + wz, xz - wy, 0,\n xy - wz, 1. - (xx + zz), yz + wx, 0,\n xz + wy, yz - wx, 1. - (xx + yy), 0,\n p.x, p.y, p.z, 1\n );\n}\nmat4 matFromRTS (vec4 q, vec3 t, vec3 s){\n float x = q.x, y = q.y, z = q.z, w = q.w;\n float x2 = x + x;\n float y2 = y + y;\n float z2 = z + z;\n float xx = x * x2;\n float xy = x * y2;\n float xz = x * z2;\n float yy = y * y2;\n float yz = y * z2;\n float zz = z * z2;\n float wx = w * x2;\n float wy = w * y2;\n float wz = w * z2;\n float sx = s.x;\n float sy = s.y;\n float sz = s.z;\n return mat4((1. - (yy + zz)) * sx, (xy + wz) * sx, (xz - wy) * sx, 0,\n (xy - wz) * sy, (1. - (xx + zz)) * sy, (yz + wx) * sy, 0,\n (xz + wy) * sz, (yz - wx) * sz, (1. - (xx + yy)) * sz, 0,\n t.x, t.y, t.z, 1);\n}\nvec4 quatMultiply (vec4 a, vec4 b){\n vec4 quat;\n quat.x = a.x * b.w + a.w * b.x + a.y * b.z - a.z * b.y;\n quat.y = a.y * b.w + a.w * b.y + a.z * b.x - a.x * b.z;\n quat.z = a.z * b.w + a.w * b.z + a.x * b.y - a.y * b.x;\n quat.w = a.w * b.w - a.x * b.x - a.y * b.y - a.z * b.z;\n return quat;\n}\nvoid rotateVecFromQuat (inout vec3 v, vec4 q){\n float ix = q.w * v.x + q.y * v.z - q.z * v.y;\n float iy = q.w * v.y + q.z * v.x - q.x * v.z;\n float iz = q.w * v.z + q.x * v.y - q.y * v.x;\n float iw = -q.x * v.x - q.y * v.y - q.z * v.z;\n v.x = ix * q.w + iw * -q.x + iy * -q.z - iz * -q.y;\n v.y = iy * q.w + iw * -q.y + iz * -q.x - ix * -q.z;\n v.z = iz * q.w + iw * -q.z + ix * -q.y - iy * -q.x;\n}\nvec3 rotateInLocalSpace (vec3 pos, vec3 xAxis, vec3 yAxis, vec3 zAxis, vec4 q){\n vec4 viewQuat = quaternionFromAxis(xAxis, yAxis, zAxis);\n vec4 rotQuat = quatMultiply(viewQuat, q);\n rotateVecFromQuat(pos, rotQuat);\n return pos;\n}\nmat3 quatToMat3(vec4 q) {\n vec3 m0 = vec3(\n 1.0 - 2.0 * q.y * q.y - 2.0 * q.z * q.z,\n 2.0 * q.x * q.y + 2.0 * q.w * q.z,\n 2.0 * q.x * q.z - 2.0 * q.w * q.y);\n\tvec3 m1 = vec3(\n 2.0 * q.x * q.y - 2.0 * q.w * q.z,\n 1.0 - 2.0 * q.x * q.x - 2.0 * q.z * q.z,\n 2.0 * q.y * q.z + 2.0 * q.w * q.x);\n\tvec3 m2 = vec3(\n 2.0 * q.x * q.z + 2.0 * q.w * q.y,\n 2.0 * q.y * q.z - 2.0 * q.w * q.x,\n 1.0 - 2.0 * q.x * q.x - 2.0 * q.y * q.y);\n return mat3(m0, m1, m2);\n}\nvec4 mat3ToQuat(mat3 mat) {\n float tr = mat[0][0] + mat[1][1] + mat[2][2];\n\tfloat qw, qx, qy, qz;\n if (tr > 0.0) {\n float S = sqrt(tr + 1.0) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = 0.25 * S;\n\t qx = (mat[1][2] - mat[2][1]) * invS;\n\t qy = (mat[2][0] - mat[0][2]) * invS;\n\t qz = (mat[0][1] - mat[1][0]) * invS;\n } else if ((mat[0][0] > mat[1][1])&&(mat[0][0] > mat[2][2])) {\n float S = sqrt(1.0 + mat[0][0] - mat[1][1] - mat[2][2]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[1][2] - mat[2][1]) * invS;\n\t qx = 0.25 * S;\n\t qy = (mat[1][0] + mat[0][1]) * invS;\n\t qz = (mat[2][0] + mat[0][2]) * invS;\n } else if (mat[1][1] > mat[2][2]) {\n\t float S = sqrt(1.0 + mat[1][1] - mat[0][0] - mat[2][2]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[2][0] - mat[0][2]) * invS;\n\t qx = (mat[1][0] + mat[0][1]) * invS;\n\t qy = 0.25 * S;\n\t qz = (mat[2][1] + mat[1][2]) * invS;\n } else {\n\t float S = sqrt(1.0 + mat[2][2] - mat[0][0] - mat[1][1]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[0][1] - mat[1][0]) * invS;\n\t qx = (mat[2][0] + mat[0][2]) * invS;\n\t qy = (mat[2][1] + mat[1][2]) * invS;\n\t qz = 0.25 * S;\n }\n return vec4(qx, qy, qz, qw);\n}\nvec4 eulerToQuat(vec3 euler) {\n vec3 er = euler * 0.5;\n float x = er.x, y = er.y, z = er.z;\n float sx = sin(x);\n float cx = cos(x);\n float sy = sin(y);\n float cy = cos(y);\n float sz = sin(z);\n float cz = cos(z);\n vec4 quat;\n quat.x = sx * cy * cz + cx * sy * sz;\n quat.y = cx * sy * cz + sx * cy * sz;\n quat.z = cx * cy * sz - sx * sy * cz;\n quat.w = cx * cy * cz - sx * sy * sz;\n return quat;\n}\nlayout(std140) uniform Constants {\n vec4 mainTiling_Offset;\n vec4 frameTile_velLenScale;\n vec4 scale;\n vec4 nodeRotation;\n};\nlayout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nlayout(std140) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n};\nout mediump vec2 uv;\nout mediump vec4 color;\nvoid computeVertPos (inout vec4 pos, vec2 vertOffset, vec4 q, vec3 s\n#if CC_RENDER_MODE == 0 || CC_RENDER_MODE == 3\n , mat4 viewInv\n#endif\n#if CC_RENDER_MODE == 1\n , vec3 eye\n , vec4 velocity\n , float velocityScale\n , float lengthScale\n , float xIndex\n#endif\n) {\n#if CC_RENDER_MODE == 0\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n vec3 camX = normalize(vec3(viewInv[0][0], viewInv[1][0], viewInv[2][0]));\n vec3 camY = normalize(vec3(viewInv[0][1], viewInv[1][1], viewInv[2][1]));\n vec3 camZ = normalize(vec3(viewInv[0][2], viewInv[1][2], viewInv[2][2]));\n pos.xyz += rotateInLocalSpace(viewSpaceVert, camX, camY, camZ, q);\n#elif CC_RENDER_MODE == 1\n vec3 camRight = normalize(cross(pos.xyz - eye, velocity.xyz)) * s.x;\n vec3 camUp = velocity.xyz * velocityScale + normalize(velocity.xyz) * lengthScale * s.y;\n pos.xyz += (camRight * abs(vertOffset.x) * sign(vertOffset.y)) - camUp * xIndex;\n#elif CC_RENDER_MODE == 2\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n vec3 camX = vec3(1, 0, 0);\n vec3 camY = vec3(0, 0, -1);\n pos.xyz += rotateInLocalSpace(viewSpaceVert, camX, camY, cross(camX, camY), q);\n#elif CC_RENDER_MODE == 3\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n rotateVecFromQuat(viewSpaceVert, q);\n vec3 camX = normalize(vec3(cc_matView[0][0], cc_matView[1][0], cc_matView[2][0]));\n vec3 camY = vec3(0, 1, 0);\n vec3 offset = camX * viewSpaceVert.x + camY * viewSpaceVert.y;\n pos.xyz += offset;\n#else\n pos.x += vertOffset.x;\n pos.y += vertOffset.y;\n#endif\n}\nvec2 computeUV (float frameIndex, vec2 vertIndex, vec2 frameTile){\n vec2 aniUV = vec2(0, floor(frameIndex * frameTile.y));\n aniUV.x = floor(frameIndex * frameTile.x * frameTile.y - aniUV.y * frameTile.x);\n#if CC_RENDER_MODE != 4\n vertIndex.y = 1. - vertIndex.y;\n#endif\n return (aniUV.xy + vertIndex) / vec2(frameTile.x, frameTile.y);\n}\nlayout(std140) uniform SampleConstants {\n vec4 u_sampleInfo;\n};\nlayout(std140) uniform TickConstants {\n vec4 u_worldRot;\n vec4 u_timeDelta;\n};\nin vec4 a_position_starttime;\nin vec4 a_color;\nin vec4 a_dir_life;\nin float a_rndSeed;\n#if !CC_INSTANCE_PARTICLE\n in vec4 a_size_uv;\n in vec4 a_rotation_uv;\n#endif\n#if CC_INSTANCE_PARTICLE\n in vec4 a_size_fid;\n in vec3 a_rotation;\n in vec3 a_uv;\n#endif\n#if CC_RENDER_MODE == 4\n in vec3 a_texCoord;\n in vec3 a_texCoord3;\n in vec3 a_normal;\n in vec4 a_color1;\n#endif\nvec3 unpackCurveData (sampler2D tex, vec2 coord) {\n vec4 a = texture(tex, coord);\n vec4 b = texture(tex, coord + u_sampleInfo.y);\n float c = fract(coord.x * u_sampleInfo.x);\n return mix(a.xyz, b.xyz, c);\n}\nvec3 unpackCurveData (sampler2D tex, vec2 coord, out float w) {\n vec4 a = texture(tex, coord);\n vec4 b = texture(tex, coord + u_sampleInfo.y);\n float c = fract(coord.x * u_sampleInfo.x);\n w = mix(a.w, b.w, c);\n return mix(a.xyz, b.xyz, c);\n}\nfloat pseudoRandom(float x) {\n#if USE_VK_SHADER\n float o = x;\n x = mod(x - 1.0, 2.0) - 1.0;\n float freqVar = 10.16640753482;\n float y = sin(freqVar * floor(o * 0.5 - 0.5));\n float v = max(0.0, 1.0-abs(x));\n v *= 0.7071067812;\n v = y < 0.0 ? -v : v;\n return v;\n#endif\n#if !USE_VK_SHADER\n float seed = mod(x, 233280.);\n float q = (seed * 9301. + 49297.) / 233280.;\n return fract(q);\n#endif\n}\n#if COLOR_OVER_TIME_MODULE_ENABLE\n uniform sampler2D color_over_time_tex0;\n layout(std140) uniform ColorConstant {\n int u_color_mode;\n };\n#endif\n#if ROTATION_OVER_TIME_MODULE_ENABLE\n uniform sampler2D rotation_over_time_tex0;\n layout(std140) uniform RotationConstant {\n int u_rotation_mode;\n };\n#endif\n#if SIZE_OVER_TIME_MODULE_ENABLE\n uniform sampler2D size_over_time_tex0;\n layout(std140) uniform SizeConstant {\n int u_size_mode;\n };\n#endif\n#if FORCE_OVER_TIME_MODULE_ENABLE\n uniform sampler2D force_over_time_tex0;\n layout(std140) uniform ForceConstant {\n int u_force_mode;\n int u_force_space;\n };\n#endif\n#if VELOCITY_OVER_TIME_MODULE_ENABLE\n uniform sampler2D velocity_over_time_tex0;\n layout(std140) uniform VelocityConstant {\n int u_velocity_mode;\n int u_velocity_space;\n };\n#endif\n#if TEXTURE_ANIMATION_MODULE_ENABLE\n uniform sampler2D texture_animation_tex0;\n layout(std140) uniform AnimationConstant {\n vec4 u_anim_info;\n };\n#endif\nfloat repeat (float t, float length) {\n return t - floor(t / length) * length;\n}\nvec4 rotateQuat (vec4 p, vec4 q) {\n vec3 iv = cross(q.xyz, p.xyz) + q.w * p.xyz;\n vec3 res = p.xyz + 2.0 * cross(q.xyz, iv);\n return vec4(res.xyz, p.w);\n}\nvec4 gpvs_main () {\n float activeTime = u_timeDelta.x - a_position_starttime.w;\n float normalizedTime = clamp(activeTime / a_dir_life.w, 0.0, 1.0);\n vec2 timeCoord0 = vec2(normalizedTime, 0.);\n vec2 timeCoord1 = vec2(normalizedTime, 1.);\n #if CC_RENDER_MODE == 4\n vec2 vertIdx = vec2(a_texCoord.x, a_texCoord.y);\n #endif\n #if CC_RENDER_MODE != 4\n #if !CC_INSTANCE_PARTICLE\n vec2 vertIdx = vec2(a_size_uv.w, a_rotation_uv.w);\n #endif\n #if CC_INSTANCE_PARTICLE\n vec2 vertIdx = a_uv.xy;\n #endif\n #endif\n vec4 velocity = vec4(a_dir_life.xyz, 0.);\n vec4 pos = vec4(a_position_starttime.xyz, 1.);\n #if !CC_INSTANCE_PARTICLE\n vec3 size = a_size_uv.xyz;\n #endif\n #if CC_INSTANCE_PARTICLE\n vec3 size = a_size_fid.xyz;\n #endif\n #if SIZE_OVER_TIME_MODULE_ENABLE\n if (u_size_mode == 1) {\n size *= unpackCurveData(size_over_time_tex0, timeCoord0);\n } else {\n vec3 size_0 = unpackCurveData(size_over_time_tex0, timeCoord0);\n vec3 size_1 = unpackCurveData(size_over_time_tex0, timeCoord1);\n float factor_s = pseudoRandom(a_rndSeed + 39825.);\n size *= mix(size_0, size_1, factor_s);\n }\n #endif\n vec3 compScale = scale.xyz * size;\n #if FORCE_OVER_TIME_MODULE_ENABLE\n vec3 forceAnim = vec3(0.);\n if (u_force_mode == 1) {\n forceAnim = unpackCurveData(force_over_time_tex0, timeCoord0);\n } else {\n vec3 force_0 = unpackCurveData(force_over_time_tex0, timeCoord0);\n vec3 force_1 = unpackCurveData(force_over_time_tex0, timeCoord1);\n float factor_f = pseudoRandom(a_rndSeed + 212165.);\n forceAnim = mix(force_0, force_1, factor_f);\n }\n vec4 forceTrack = vec4(forceAnim, 0.);\n if (u_force_space == 0) {\n forceTrack = rotateQuat(forceTrack, u_worldRot);\n }\n velocity.xyz += forceTrack.xyz;\n #endif\n #if VELOCITY_OVER_TIME_MODULE_ENABLE\n float speedModifier0 = 1.;\n float speedModifier1 = 1.;\n vec3 velocityAnim = vec3(0.);\n if (u_velocity_mode == 1) {\n velocityAnim = unpackCurveData(velocity_over_time_tex0, timeCoord0, speedModifier0);\n } else {\n vec3 vectory_0 = unpackCurveData(velocity_over_time_tex0, timeCoord0, speedModifier0);\n vec3 vectory_1 = unpackCurveData(velocity_over_time_tex0, timeCoord1, speedModifier1);\n float factor_v = pseudoRandom(a_rndSeed + 197866.);\n velocityAnim = mix(vectory_0, vectory_1, factor_v);\n speedModifier0 = mix(speedModifier0, speedModifier1, factor_v);\n }\n vec4 velocityTrack = vec4(velocityAnim, 0.);\n if (u_velocity_space == 0) {\n velocityTrack = rotateQuat(velocityTrack, u_worldRot);\n }\n velocity.xyz += velocityTrack.xyz;\n velocity.xyz *= speedModifier0;\n #endif\n pos.xyz += velocity.xyz * normalizedTime * a_dir_life.w;\n #if !CC_USE_WORLD_SPACE\n pos = cc_matWorld * pos;\n #if CC_RENDER_MODE == 1\n velocity = rotateQuat(velocity, u_worldRot);\n #endif\n #endif\n #if !CC_INSTANCE_PARTICLE\n vec3 startRotation = a_rotation_uv.xyz;\n #endif\n #if CC_INSTANCE_PARTICLE\n vec3 startRotation = a_rotation;\n #endif\n #if CC_RENDER_MODE != 4\n #if CC_RENDER_MODE == 0\n vec3 rotEuler = startRotation.xyz;\n #elif CC_RENDER_MODE == 1\n vec3 rotEuler = vec3(0.);\n #endif\n #if CC_RENDER_MODE != 0 && CC_RENDER_MODE != 1\n vec3 rotEuler = vec3(0., 0., startRotation.z);\n #endif\n vec4 rot = quaternionFromEuler(rotEuler);\n #endif\n #if CC_RENDER_MODE == 4\n vec4 rot = quaternionFromEuler(startRotation);\n #endif\n #if ROTATION_OVER_TIME_MODULE_ENABLE\n if (u_rotation_mode == 1) {\n vec3 euler = unpackCurveData(rotation_over_time_tex0, timeCoord0) * normalizedTime * a_dir_life.w;\n vec4 quat = eulerToQuat(euler);\n mat3 mLocal = quatToMat3(quat);\n mat3 mStart = quatToMat3(rot);\n rot = mat3ToQuat(mStart * mLocal);\n } else {\n vec3 rotation_0 = unpackCurveData(rotation_over_time_tex0, timeCoord0);\n vec3 rotation_1 = unpackCurveData(rotation_over_time_tex0, timeCoord1);\n float factor_r = pseudoRandom(a_rndSeed + 125292.);\n vec3 euler = mix(rotation_0, rotation_1, factor_r) * normalizedTime * a_dir_life.w;\n #if CC_RENDER_MODE == 3 || CC_RENDER_MODE == 2\n euler = vec3(0.0, 0.0, euler.z);\n #endif\n vec4 quat = eulerToQuat(euler);\n mat3 mLocal = quatToMat3(quat);\n mat3 mStart = quatToMat3(rot);\n rot = mat3ToQuat(mStart * mLocal);\n }\n #endif\n #if COLOR_OVER_TIME_MODULE_ENABLE\n if (u_color_mode == 1) {\n color = a_color * texture(color_over_time_tex0, timeCoord0);\n } else {\n vec4 color_0 = texture(color_over_time_tex0, timeCoord0);\n vec4 color_1 = texture(color_over_time_tex0, timeCoord1);\n float factor_c = pseudoRandom(a_rndSeed + 91041.);\n color = a_color * mix(color_0, color_1, factor_c);\n }\n #endif\n #if !COLOR_OVER_TIME_MODULE_ENABLE\n color = a_color;\n #endif\n #if CC_RENDER_MODE != 4\n vec2 cornerOffset = vec2((vertIdx - 0.5));\n #if CC_RENDER_MODE == 1\n rot = vec4(0.0, 0.0, 0.0, 1.0);\n #endif\n computeVertPos(pos, cornerOffset, rot, compScale\n #if CC_RENDER_MODE == 0 || CC_RENDER_MODE == 3\n , cc_matViewInv\n #endif\n #if CC_RENDER_MODE == 1\n , cc_cameraPos.xyz\n , velocity\n , frameTile_velLenScale.z\n , frameTile_velLenScale.w\n #if !CC_INSTANCE_PARTICLE\n , a_size_uv.w\n #endif\n #if CC_INSTANCE_PARTICLE\n , a_uv.x\n #endif\n #endif\n );\n #endif\n #if CC_RENDER_MODE == 4\n mat3 rotMat = quatToMat3(rot);\n mat3 nodeMat = quatToMat3(nodeRotation);\n rotMat = nodeMat * rotMat;\n rot = mat3ToQuat(rotMat);\n mat4 xformNoScale = matrixFromRT(rot, pos.xyz);\n mat4 xform = matFromRTS(rot, pos.xyz, compScale);\n pos = xform * vec4(a_texCoord3, 1);\n vec4 normal = xformNoScale * vec4(a_normal, 0);\n color *= a_color1;\n #endif\n pos = cc_matViewProj * pos;\n float frameIndex = 0.;\n #if TEXTURE_ANIMATION_MODULE_ENABLE\n float startFrame = 0.;\n vec3 frameInfo = vec3(0.);\n if (int(u_anim_info.x) == 1) {\n frameInfo = unpackCurveData(texture_animation_tex0, timeCoord0);\n } else {\n vec3 frameInfo0 = unpackCurveData(texture_animation_tex0, timeCoord0);\n vec3 frameInfo1 = unpackCurveData(texture_animation_tex0, timeCoord1);\n float factor_t = pseudoRandom(a_rndSeed + 90794.);\n frameInfo = mix(frameInfo0, frameInfo1, factor_t);\n }\n startFrame = frameInfo.x / u_anim_info.y;\n float EPSILON = 1e-6;\n frameIndex = repeat(u_anim_info.z * (frameInfo.y + startFrame), 1. + EPSILON);\n #endif\n uv = computeUV(frameIndex, vertIdx, frameTile_velLenScale.xy) * mainTiling_Offset.xy + mainTiling_Offset.zw;\n return pos;\n}\nvoid main() { gl_Position = gpvs_main(); }",
  2314. "frag": "\nprecision mediump float;\nlayout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nvec4 CCFragOutput (vec4 color) {\n return color;\n}\nin vec2 uv;\nin vec4 color;\nuniform sampler2D mainTexture;\nlayout(std140) uniform FragConstants {\n vec4 tintColor;\n};\nvec4 multiply () {\n vec4 col;\n vec4 texColor = texture(mainTexture, uv);\n col.rgb = tintColor.rgb * texColor.rgb * color.rgb * vec3(2.0);\n return CCFragOutput(col);\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = multiply(); }"
  2315. },
  2316. "glsl1": {
  2317. "vert": "\nprecision mediump float;\nvec4 quaternionFromAxis (vec3 xAxis,vec3 yAxis,vec3 zAxis){\n mat3 m = mat3(xAxis,yAxis,zAxis);\n float trace = m[0][0] + m[1][1] + m[2][2];\n vec4 quat;\n if (trace > 0.) {\n float s = 0.5 / sqrt(trace + 1.0);\n quat.w = 0.25 / s;\n quat.x = (m[2][1] - m[1][2]) * s;\n quat.y = (m[0][2] - m[2][0]) * s;\n quat.z = (m[1][0] - m[0][1]) * s;\n } else if ((m[0][0] > m[1][1]) && (m[0][0] > m[2][2])) {\n float s = 2.0 * sqrt(1.0 + m[0][0] - m[1][1] - m[2][2]);\n quat.w = (m[2][1] - m[1][2]) / s;\n quat.x = 0.25 * s;\n quat.y = (m[0][1] + m[1][0]) / s;\n quat.z = (m[0][2] + m[2][0]) / s;\n } else if (m[1][1] > m[2][2]) {\n float s = 2.0 * sqrt(1.0 + m[1][1] - m[0][0] - m[2][2]);\n quat.w = (m[0][2] - m[2][0]) / s;\n quat.x = (m[0][1] + m[1][0]) / s;\n quat.y = 0.25 * s;\n quat.z = (m[1][2] + m[2][1]) / s;\n } else {\n float s = 2.0 * sqrt(1.0 + m[2][2] - m[0][0] - m[1][1]);\n quat.w = (m[1][0] - m[0][1]) / s;\n quat.x = (m[0][2] + m[2][0]) / s;\n quat.y = (m[1][2] + m[2][1]) / s;\n quat.z = 0.25 * s;\n }\n float len = quat.x * quat.x + quat.y * quat.y + quat.z * quat.z + quat.w * quat.w;\n if (len > 0.) {\n len = 1. / sqrt(len);\n quat.x = quat.x * len;\n quat.y = quat.y * len;\n quat.z = quat.z * len;\n quat.w = quat.w * len;\n }\n return quat;\n}\nvec4 quaternionFromEuler (vec3 angle){\n float x = angle.x / 2.;\n float y = angle.y / 2.;\n float z = angle.z / 2.;\n float sx = sin(x);\n float cx = cos(x);\n float sy = sin(y);\n float cy = cos(y);\n float sz = sin(z);\n float cz = cos(z);\n vec4 quat = vec4(0);\n quat.x = sx * cy * cz + cx * sy * sz;\n quat.y = cx * sy * cz + sx * cy * sz;\n quat.z = cx * cy * sz - sx * sy * cz;\n quat.w = cx * cy * cz - sx * sy * sz;\n return quat;\n}\nmat4 matrixFromRT (vec4 q, vec3 p){\n float x2 = q.x + q.x;\n float y2 = q.y + q.y;\n float z2 = q.z + q.z;\n float xx = q.x * x2;\n float xy = q.x * y2;\n float xz = q.x * z2;\n float yy = q.y * y2;\n float yz = q.y * z2;\n float zz = q.z * z2;\n float wx = q.w * x2;\n float wy = q.w * y2;\n float wz = q.w * z2;\n return mat4(\n 1. - (yy + zz), xy + wz, xz - wy, 0,\n xy - wz, 1. - (xx + zz), yz + wx, 0,\n xz + wy, yz - wx, 1. - (xx + yy), 0,\n p.x, p.y, p.z, 1\n );\n}\nmat4 matFromRTS (vec4 q, vec3 t, vec3 s){\n float x = q.x, y = q.y, z = q.z, w = q.w;\n float x2 = x + x;\n float y2 = y + y;\n float z2 = z + z;\n float xx = x * x2;\n float xy = x * y2;\n float xz = x * z2;\n float yy = y * y2;\n float yz = y * z2;\n float zz = z * z2;\n float wx = w * x2;\n float wy = w * y2;\n float wz = w * z2;\n float sx = s.x;\n float sy = s.y;\n float sz = s.z;\n return mat4((1. - (yy + zz)) * sx, (xy + wz) * sx, (xz - wy) * sx, 0,\n (xy - wz) * sy, (1. - (xx + zz)) * sy, (yz + wx) * sy, 0,\n (xz + wy) * sz, (yz - wx) * sz, (1. - (xx + yy)) * sz, 0,\n t.x, t.y, t.z, 1);\n}\nvec4 quatMultiply (vec4 a, vec4 b){\n vec4 quat;\n quat.x = a.x * b.w + a.w * b.x + a.y * b.z - a.z * b.y;\n quat.y = a.y * b.w + a.w * b.y + a.z * b.x - a.x * b.z;\n quat.z = a.z * b.w + a.w * b.z + a.x * b.y - a.y * b.x;\n quat.w = a.w * b.w - a.x * b.x - a.y * b.y - a.z * b.z;\n return quat;\n}\nvoid rotateVecFromQuat (inout vec3 v, vec4 q){\n float ix = q.w * v.x + q.y * v.z - q.z * v.y;\n float iy = q.w * v.y + q.z * v.x - q.x * v.z;\n float iz = q.w * v.z + q.x * v.y - q.y * v.x;\n float iw = -q.x * v.x - q.y * v.y - q.z * v.z;\n v.x = ix * q.w + iw * -q.x + iy * -q.z - iz * -q.y;\n v.y = iy * q.w + iw * -q.y + iz * -q.x - ix * -q.z;\n v.z = iz * q.w + iw * -q.z + ix * -q.y - iy * -q.x;\n}\nvec3 rotateInLocalSpace (vec3 pos, vec3 xAxis, vec3 yAxis, vec3 zAxis, vec4 q){\n vec4 viewQuat = quaternionFromAxis(xAxis, yAxis, zAxis);\n vec4 rotQuat = quatMultiply(viewQuat, q);\n rotateVecFromQuat(pos, rotQuat);\n return pos;\n}\nmat3 quatToMat3(vec4 q) {\n vec3 m0 = vec3(\n 1.0 - 2.0 * q.y * q.y - 2.0 * q.z * q.z,\n 2.0 * q.x * q.y + 2.0 * q.w * q.z,\n 2.0 * q.x * q.z - 2.0 * q.w * q.y);\n\tvec3 m1 = vec3(\n 2.0 * q.x * q.y - 2.0 * q.w * q.z,\n 1.0 - 2.0 * q.x * q.x - 2.0 * q.z * q.z,\n 2.0 * q.y * q.z + 2.0 * q.w * q.x);\n\tvec3 m2 = vec3(\n 2.0 * q.x * q.z + 2.0 * q.w * q.y,\n 2.0 * q.y * q.z - 2.0 * q.w * q.x,\n 1.0 - 2.0 * q.x * q.x - 2.0 * q.y * q.y);\n return mat3(m0, m1, m2);\n}\nvec4 mat3ToQuat(mat3 mat) {\n float tr = mat[0][0] + mat[1][1] + mat[2][2];\n\tfloat qw, qx, qy, qz;\n if (tr > 0.0) {\n float S = sqrt(tr + 1.0) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = 0.25 * S;\n\t qx = (mat[1][2] - mat[2][1]) * invS;\n\t qy = (mat[2][0] - mat[0][2]) * invS;\n\t qz = (mat[0][1] - mat[1][0]) * invS;\n } else if ((mat[0][0] > mat[1][1])&&(mat[0][0] > mat[2][2])) {\n float S = sqrt(1.0 + mat[0][0] - mat[1][1] - mat[2][2]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[1][2] - mat[2][1]) * invS;\n\t qx = 0.25 * S;\n\t qy = (mat[1][0] + mat[0][1]) * invS;\n\t qz = (mat[2][0] + mat[0][2]) * invS;\n } else if (mat[1][1] > mat[2][2]) {\n\t float S = sqrt(1.0 + mat[1][1] - mat[0][0] - mat[2][2]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[2][0] - mat[0][2]) * invS;\n\t qx = (mat[1][0] + mat[0][1]) * invS;\n\t qy = 0.25 * S;\n\t qz = (mat[2][1] + mat[1][2]) * invS;\n } else {\n\t float S = sqrt(1.0 + mat[2][2] - mat[0][0] - mat[1][1]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[0][1] - mat[1][0]) * invS;\n\t qx = (mat[2][0] + mat[0][2]) * invS;\n\t qy = (mat[2][1] + mat[1][2]) * invS;\n\t qz = 0.25 * S;\n }\n return vec4(qx, qy, qz, qw);\n}\nvec4 eulerToQuat(vec3 euler) {\n vec3 er = euler * 0.5;\n float x = er.x, y = er.y, z = er.z;\n float sx = sin(x);\n float cx = cos(x);\n float sy = sin(y);\n float cy = cos(y);\n float sz = sin(z);\n float cz = cos(z);\n vec4 quat;\n quat.x = sx * cy * cz + cx * sy * sz;\n quat.y = cx * sy * cz + sx * cy * sz;\n quat.z = cx * cy * sz - sx * sy * cz;\n quat.w = cx * cy * cz - sx * sy * sz;\n return quat;\n}\n uniform vec4 mainTiling_Offset;\n uniform vec4 frameTile_velLenScale;\n uniform vec4 scale;\n uniform vec4 nodeRotation;\nuniform highp mat4 cc_matView;\n uniform highp mat4 cc_matViewInv;\n uniform highp mat4 cc_matViewProj;\n uniform highp vec4 cc_cameraPos;\nuniform highp mat4 cc_matWorld;\nvarying mediump vec2 uv;\nvarying mediump vec4 color;\nvoid computeVertPos (inout vec4 pos, vec2 vertOffset, vec4 q, vec3 s\n#if CC_RENDER_MODE == 0 || CC_RENDER_MODE == 3\n , mat4 viewInv\n#endif\n#if CC_RENDER_MODE == 1\n , vec3 eye\n , vec4 velocity\n , float velocityScale\n , float lengthScale\n , float xIndex\n#endif\n) {\n#if CC_RENDER_MODE == 0\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n vec3 camX = normalize(vec3(viewInv[0][0], viewInv[1][0], viewInv[2][0]));\n vec3 camY = normalize(vec3(viewInv[0][1], viewInv[1][1], viewInv[2][1]));\n vec3 camZ = normalize(vec3(viewInv[0][2], viewInv[1][2], viewInv[2][2]));\n pos.xyz += rotateInLocalSpace(viewSpaceVert, camX, camY, camZ, q);\n#elif CC_RENDER_MODE == 1\n vec3 camRight = normalize(cross(pos.xyz - eye, velocity.xyz)) * s.x;\n vec3 camUp = velocity.xyz * velocityScale + normalize(velocity.xyz) * lengthScale * s.y;\n pos.xyz += (camRight * abs(vertOffset.x) * sign(vertOffset.y)) - camUp * xIndex;\n#elif CC_RENDER_MODE == 2\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n vec3 camX = vec3(1, 0, 0);\n vec3 camY = vec3(0, 0, -1);\n pos.xyz += rotateInLocalSpace(viewSpaceVert, camX, camY, cross(camX, camY), q);\n#elif CC_RENDER_MODE == 3\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n rotateVecFromQuat(viewSpaceVert, q);\n vec3 camX = normalize(vec3(cc_matView[0][0], cc_matView[1][0], cc_matView[2][0]));\n vec3 camY = vec3(0, 1, 0);\n vec3 offset = camX * viewSpaceVert.x + camY * viewSpaceVert.y;\n pos.xyz += offset;\n#else\n pos.x += vertOffset.x;\n pos.y += vertOffset.y;\n#endif\n}\nvec2 computeUV (float frameIndex, vec2 vertIndex, vec2 frameTile){\n vec2 aniUV = vec2(0, floor(frameIndex * frameTile.y));\n aniUV.x = floor(frameIndex * frameTile.x * frameTile.y - aniUV.y * frameTile.x);\n#if CC_RENDER_MODE != 4\n vertIndex.y = 1. - vertIndex.y;\n#endif\n return (aniUV.xy + vertIndex) / vec2(frameTile.x, frameTile.y);\n}\n uniform vec4 u_sampleInfo;\n uniform vec4 u_worldRot;\n uniform vec4 u_timeDelta;\nattribute vec4 a_position_starttime;\nattribute vec4 a_color;\nattribute vec4 a_dir_life;\nattribute float a_rndSeed;\n#if !CC_INSTANCE_PARTICLE\n attribute vec4 a_size_uv;\n attribute vec4 a_rotation_uv;\n#endif\n#if CC_INSTANCE_PARTICLE\n attribute vec4 a_size_fid;\n attribute vec3 a_rotation;\n attribute vec3 a_uv;\n#endif\n#if CC_RENDER_MODE == 4\n attribute vec3 a_texCoord;\n attribute vec3 a_texCoord3;\n attribute vec3 a_normal;\n attribute vec4 a_color1;\n#endif\nvec3 unpackCurveData (sampler2D tex, vec2 coord) {\n vec4 a = texture2D(tex, coord);\n vec4 b = texture2D(tex, coord + u_sampleInfo.y);\n float c = fract(coord.x * u_sampleInfo.x);\n return mix(a.xyz, b.xyz, c);\n}\nvec3 unpackCurveData (sampler2D tex, vec2 coord, out float w) {\n vec4 a = texture2D(tex, coord);\n vec4 b = texture2D(tex, coord + u_sampleInfo.y);\n float c = fract(coord.x * u_sampleInfo.x);\n w = mix(a.w, b.w, c);\n return mix(a.xyz, b.xyz, c);\n}\nfloat pseudoRandom(float x) {\n#if USE_VK_SHADER\n float o = x;\n x = mod(x - 1.0, 2.0) - 1.0;\n float freqVar = 10.16640753482;\n float y = sin(freqVar * floor(o * 0.5 - 0.5));\n float v = max(0.0, 1.0-abs(x));\n v *= 0.7071067812;\n v = y < 0.0 ? -v : v;\n return v;\n#endif\n#if !USE_VK_SHADER\n float seed = mod(x, 233280.);\n float q = (seed * 9301. + 49297.) / 233280.;\n return fract(q);\n#endif\n}\n#if COLOR_OVER_TIME_MODULE_ENABLE\n uniform sampler2D color_over_time_tex0;\n uniform int u_color_mode;\n#endif\n#if ROTATION_OVER_TIME_MODULE_ENABLE\n uniform sampler2D rotation_over_time_tex0;\n uniform int u_rotation_mode;\n#endif\n#if SIZE_OVER_TIME_MODULE_ENABLE\n uniform sampler2D size_over_time_tex0;\n uniform int u_size_mode;\n#endif\n#if FORCE_OVER_TIME_MODULE_ENABLE\n uniform sampler2D force_over_time_tex0;\n uniform int u_force_mode;\n uniform int u_force_space;\n#endif\n#if VELOCITY_OVER_TIME_MODULE_ENABLE\n uniform sampler2D velocity_over_time_tex0;\n uniform int u_velocity_mode;\n uniform int u_velocity_space;\n#endif\n#if TEXTURE_ANIMATION_MODULE_ENABLE\n uniform sampler2D texture_animation_tex0;\n uniform vec4 u_anim_info;\n#endif\nfloat repeat (float t, float length) {\n return t - floor(t / length) * length;\n}\nvec4 rotateQuat (vec4 p, vec4 q) {\n vec3 iv = cross(q.xyz, p.xyz) + q.w * p.xyz;\n vec3 res = p.xyz + 2.0 * cross(q.xyz, iv);\n return vec4(res.xyz, p.w);\n}\nvec4 gpvs_main () {\n float activeTime = u_timeDelta.x - a_position_starttime.w;\n float normalizedTime = clamp(activeTime / a_dir_life.w, 0.0, 1.0);\n vec2 timeCoord0 = vec2(normalizedTime, 0.);\n vec2 timeCoord1 = vec2(normalizedTime, 1.);\n #if CC_RENDER_MODE == 4\n vec2 vertIdx = vec2(a_texCoord.x, a_texCoord.y);\n #endif\n #if CC_RENDER_MODE != 4\n #if !CC_INSTANCE_PARTICLE\n vec2 vertIdx = vec2(a_size_uv.w, a_rotation_uv.w);\n #endif\n #if CC_INSTANCE_PARTICLE\n vec2 vertIdx = a_uv.xy;\n #endif\n #endif\n vec4 velocity = vec4(a_dir_life.xyz, 0.);\n vec4 pos = vec4(a_position_starttime.xyz, 1.);\n #if !CC_INSTANCE_PARTICLE\n vec3 size = a_size_uv.xyz;\n #endif\n #if CC_INSTANCE_PARTICLE\n vec3 size = a_size_fid.xyz;\n #endif\n #if SIZE_OVER_TIME_MODULE_ENABLE\n if (u_size_mode == 1) {\n size *= unpackCurveData(size_over_time_tex0, timeCoord0);\n } else {\n vec3 size_0 = unpackCurveData(size_over_time_tex0, timeCoord0);\n vec3 size_1 = unpackCurveData(size_over_time_tex0, timeCoord1);\n float factor_s = pseudoRandom(a_rndSeed + 39825.);\n size *= mix(size_0, size_1, factor_s);\n }\n #endif\n vec3 compScale = scale.xyz * size;\n #if FORCE_OVER_TIME_MODULE_ENABLE\n vec3 forceAnim = vec3(0.);\n if (u_force_mode == 1) {\n forceAnim = unpackCurveData(force_over_time_tex0, timeCoord0);\n } else {\n vec3 force_0 = unpackCurveData(force_over_time_tex0, timeCoord0);\n vec3 force_1 = unpackCurveData(force_over_time_tex0, timeCoord1);\n float factor_f = pseudoRandom(a_rndSeed + 212165.);\n forceAnim = mix(force_0, force_1, factor_f);\n }\n vec4 forceTrack = vec4(forceAnim, 0.);\n if (u_force_space == 0) {\n forceTrack = rotateQuat(forceTrack, u_worldRot);\n }\n velocity.xyz += forceTrack.xyz;\n #endif\n #if VELOCITY_OVER_TIME_MODULE_ENABLE\n float speedModifier0 = 1.;\n float speedModifier1 = 1.;\n vec3 velocityAnim = vec3(0.);\n if (u_velocity_mode == 1) {\n velocityAnim = unpackCurveData(velocity_over_time_tex0, timeCoord0, speedModifier0);\n } else {\n vec3 vectory_0 = unpackCurveData(velocity_over_time_tex0, timeCoord0, speedModifier0);\n vec3 vectory_1 = unpackCurveData(velocity_over_time_tex0, timeCoord1, speedModifier1);\n float factor_v = pseudoRandom(a_rndSeed + 197866.);\n velocityAnim = mix(vectory_0, vectory_1, factor_v);\n speedModifier0 = mix(speedModifier0, speedModifier1, factor_v);\n }\n vec4 velocityTrack = vec4(velocityAnim, 0.);\n if (u_velocity_space == 0) {\n velocityTrack = rotateQuat(velocityTrack, u_worldRot);\n }\n velocity.xyz += velocityTrack.xyz;\n velocity.xyz *= speedModifier0;\n #endif\n pos.xyz += velocity.xyz * normalizedTime * a_dir_life.w;\n #if !CC_USE_WORLD_SPACE\n pos = cc_matWorld * pos;\n #if CC_RENDER_MODE == 1\n velocity = rotateQuat(velocity, u_worldRot);\n #endif\n #endif\n #if !CC_INSTANCE_PARTICLE\n vec3 startRotation = a_rotation_uv.xyz;\n #endif\n #if CC_INSTANCE_PARTICLE\n vec3 startRotation = a_rotation;\n #endif\n #if CC_RENDER_MODE != 4\n #if CC_RENDER_MODE == 0\n vec3 rotEuler = startRotation.xyz;\n #elif CC_RENDER_MODE == 1\n vec3 rotEuler = vec3(0.);\n #endif\n #if CC_RENDER_MODE != 0 && CC_RENDER_MODE != 1\n vec3 rotEuler = vec3(0., 0., startRotation.z);\n #endif\n vec4 rot = quaternionFromEuler(rotEuler);\n #endif\n #if CC_RENDER_MODE == 4\n vec4 rot = quaternionFromEuler(startRotation);\n #endif\n #if ROTATION_OVER_TIME_MODULE_ENABLE\n if (u_rotation_mode == 1) {\n vec3 euler = unpackCurveData(rotation_over_time_tex0, timeCoord0) * normalizedTime * a_dir_life.w;\n vec4 quat = eulerToQuat(euler);\n mat3 mLocal = quatToMat3(quat);\n mat3 mStart = quatToMat3(rot);\n rot = mat3ToQuat(mStart * mLocal);\n } else {\n vec3 rotation_0 = unpackCurveData(rotation_over_time_tex0, timeCoord0);\n vec3 rotation_1 = unpackCurveData(rotation_over_time_tex0, timeCoord1);\n float factor_r = pseudoRandom(a_rndSeed + 125292.);\n vec3 euler = mix(rotation_0, rotation_1, factor_r) * normalizedTime * a_dir_life.w;\n #if CC_RENDER_MODE == 3 || CC_RENDER_MODE == 2\n euler = vec3(0.0, 0.0, euler.z);\n #endif\n vec4 quat = eulerToQuat(euler);\n mat3 mLocal = quatToMat3(quat);\n mat3 mStart = quatToMat3(rot);\n rot = mat3ToQuat(mStart * mLocal);\n }\n #endif\n #if COLOR_OVER_TIME_MODULE_ENABLE\n if (u_color_mode == 1) {\n color = a_color * texture2D(color_over_time_tex0, timeCoord0);\n } else {\n vec4 color_0 = texture2D(color_over_time_tex0, timeCoord0);\n vec4 color_1 = texture2D(color_over_time_tex0, timeCoord1);\n float factor_c = pseudoRandom(a_rndSeed + 91041.);\n color = a_color * mix(color_0, color_1, factor_c);\n }\n #endif\n #if !COLOR_OVER_TIME_MODULE_ENABLE\n color = a_color;\n #endif\n #if CC_RENDER_MODE != 4\n vec2 cornerOffset = vec2((vertIdx - 0.5));\n #if CC_RENDER_MODE == 1\n rot = vec4(0.0, 0.0, 0.0, 1.0);\n #endif\n computeVertPos(pos, cornerOffset, rot, compScale\n #if CC_RENDER_MODE == 0 || CC_RENDER_MODE == 3\n , cc_matViewInv\n #endif\n #if CC_RENDER_MODE == 1\n , cc_cameraPos.xyz\n , velocity\n , frameTile_velLenScale.z\n , frameTile_velLenScale.w\n #if !CC_INSTANCE_PARTICLE\n , a_size_uv.w\n #endif\n #if CC_INSTANCE_PARTICLE\n , a_uv.x\n #endif\n #endif\n );\n #endif\n #if CC_RENDER_MODE == 4\n mat3 rotMat = quatToMat3(rot);\n mat3 nodeMat = quatToMat3(nodeRotation);\n rotMat = nodeMat * rotMat;\n rot = mat3ToQuat(rotMat);\n mat4 xformNoScale = matrixFromRT(rot, pos.xyz);\n mat4 xform = matFromRTS(rot, pos.xyz, compScale);\n pos = xform * vec4(a_texCoord3, 1);\n vec4 normal = xformNoScale * vec4(a_normal, 0);\n color *= a_color1;\n #endif\n pos = cc_matViewProj * pos;\n float frameIndex = 0.;\n #if TEXTURE_ANIMATION_MODULE_ENABLE\n float startFrame = 0.;\n vec3 frameInfo = vec3(0.);\n if (int(u_anim_info.x) == 1) {\n frameInfo = unpackCurveData(texture_animation_tex0, timeCoord0);\n } else {\n vec3 frameInfo0 = unpackCurveData(texture_animation_tex0, timeCoord0);\n vec3 frameInfo1 = unpackCurveData(texture_animation_tex0, timeCoord1);\n float factor_t = pseudoRandom(a_rndSeed + 90794.);\n frameInfo = mix(frameInfo0, frameInfo1, factor_t);\n }\n startFrame = frameInfo.x / u_anim_info.y;\n float EPSILON = 1e-6;\n frameIndex = repeat(u_anim_info.z * (frameInfo.y + startFrame), 1. + EPSILON);\n #endif\n uv = computeUV(frameIndex, vertIdx, frameTile_velLenScale.xy) * mainTiling_Offset.xy + mainTiling_Offset.zw;\n return pos;\n}\nvoid main() { gl_Position = gpvs_main(); }",
  2318. "frag": "\nprecision mediump float;\nvec4 CCFragOutput (vec4 color) {\n return color;\n}\nvarying vec2 uv;\nvarying vec4 color;\nuniform sampler2D mainTexture;\n uniform vec4 tintColor;\nvec4 multiply () {\n vec4 col;\n vec4 texColor = texture2D(mainTexture, uv);\n col.rgb = tintColor.rgb * texColor.rgb * color.rgb * vec3(2.0);\n return CCFragOutput(col);\n}\nvoid main() { gl_FragColor = multiply(); }"
  2319. },
  2320. "builtins": {
  2321. "globals": {
  2322. "blocks": [
  2323. {
  2324. "name": "CCGlobal",
  2325. "defines": []
  2326. },
  2327. {
  2328. "name": "CCCamera",
  2329. "defines": []
  2330. }
  2331. ],
  2332. "samplerTextures": [],
  2333. "buffers": [],
  2334. "images": []
  2335. },
  2336. "locals": {
  2337. "blocks": [
  2338. {
  2339. "name": "CCLocal",
  2340. "defines": []
  2341. }
  2342. ],
  2343. "samplerTextures": [],
  2344. "buffers": [],
  2345. "images": []
  2346. },
  2347. "statistics": {
  2348. "CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS": 71,
  2349. "CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS": 43
  2350. }
  2351. },
  2352. "defines": [
  2353. {
  2354. "name": "CC_RENDER_MODE",
  2355. "type": "number",
  2356. "defines": [],
  2357. "range": [
  2358. 0,
  2359. 4
  2360. ]
  2361. },
  2362. {
  2363. "name": "CC_INSTANCE_PARTICLE",
  2364. "type": "boolean",
  2365. "defines": []
  2366. },
  2367. {
  2368. "name": "USE_VK_SHADER",
  2369. "type": "boolean",
  2370. "defines": []
  2371. },
  2372. {
  2373. "name": "COLOR_OVER_TIME_MODULE_ENABLE",
  2374. "type": "boolean",
  2375. "defines": []
  2376. },
  2377. {
  2378. "name": "ROTATION_OVER_TIME_MODULE_ENABLE",
  2379. "type": "boolean",
  2380. "defines": []
  2381. },
  2382. {
  2383. "name": "SIZE_OVER_TIME_MODULE_ENABLE",
  2384. "type": "boolean",
  2385. "defines": []
  2386. },
  2387. {
  2388. "name": "FORCE_OVER_TIME_MODULE_ENABLE",
  2389. "type": "boolean",
  2390. "defines": []
  2391. },
  2392. {
  2393. "name": "VELOCITY_OVER_TIME_MODULE_ENABLE",
  2394. "type": "boolean",
  2395. "defines": []
  2396. },
  2397. {
  2398. "name": "TEXTURE_ANIMATION_MODULE_ENABLE",
  2399. "type": "boolean",
  2400. "defines": []
  2401. },
  2402. {
  2403. "name": "CC_USE_WORLD_SPACE",
  2404. "type": "boolean",
  2405. "defines": []
  2406. }
  2407. ],
  2408. "name": "particles/builtin-particle-gpu|builtin/internal/particle-vs-gpu:gpvs_main|tinted-fs:multiply"
  2409. },
  2410. {
  2411. "blocks": [
  2412. {
  2413. "name": "Constants",
  2414. "members": [
  2415. {
  2416. "name": "mainTiling_Offset",
  2417. "type": 16,
  2418. "count": 1
  2419. },
  2420. {
  2421. "name": "frameTile_velLenScale",
  2422. "type": 16,
  2423. "count": 1
  2424. },
  2425. {
  2426. "name": "scale",
  2427. "type": 16,
  2428. "count": 1
  2429. },
  2430. {
  2431. "name": "nodeRotation",
  2432. "type": 16,
  2433. "count": 1
  2434. }
  2435. ],
  2436. "defines": [],
  2437. "stageFlags": 1,
  2438. "binding": 0
  2439. },
  2440. {
  2441. "name": "SampleConstants",
  2442. "members": [
  2443. {
  2444. "name": "u_sampleInfo",
  2445. "type": 16,
  2446. "count": 1
  2447. }
  2448. ],
  2449. "defines": [],
  2450. "stageFlags": 1,
  2451. "binding": 1
  2452. },
  2453. {
  2454. "name": "TickConstants",
  2455. "members": [
  2456. {
  2457. "name": "u_worldRot",
  2458. "type": 16,
  2459. "count": 1
  2460. },
  2461. {
  2462. "name": "u_timeDelta",
  2463. "type": 16,
  2464. "count": 1
  2465. }
  2466. ],
  2467. "defines": [],
  2468. "stageFlags": 1,
  2469. "binding": 2
  2470. },
  2471. {
  2472. "name": "ColorConstant",
  2473. "members": [
  2474. {
  2475. "name": "u_color_mode",
  2476. "type": 5,
  2477. "count": 1
  2478. }
  2479. ],
  2480. "defines": [
  2481. "COLOR_OVER_TIME_MODULE_ENABLE"
  2482. ],
  2483. "stageFlags": 1,
  2484. "binding": 3
  2485. },
  2486. {
  2487. "name": "RotationConstant",
  2488. "members": [
  2489. {
  2490. "name": "u_rotation_mode",
  2491. "type": 5,
  2492. "count": 1
  2493. }
  2494. ],
  2495. "defines": [
  2496. "ROTATION_OVER_TIME_MODULE_ENABLE"
  2497. ],
  2498. "stageFlags": 1,
  2499. "binding": 4
  2500. },
  2501. {
  2502. "name": "SizeConstant",
  2503. "members": [
  2504. {
  2505. "name": "u_size_mode",
  2506. "type": 5,
  2507. "count": 1
  2508. }
  2509. ],
  2510. "defines": [
  2511. "SIZE_OVER_TIME_MODULE_ENABLE"
  2512. ],
  2513. "stageFlags": 1,
  2514. "binding": 5
  2515. },
  2516. {
  2517. "name": "ForceConstant",
  2518. "members": [
  2519. {
  2520. "name": "u_force_mode",
  2521. "type": 5,
  2522. "count": 1
  2523. },
  2524. {
  2525. "name": "u_force_space",
  2526. "type": 5,
  2527. "count": 1
  2528. }
  2529. ],
  2530. "defines": [
  2531. "FORCE_OVER_TIME_MODULE_ENABLE"
  2532. ],
  2533. "stageFlags": 1,
  2534. "binding": 6
  2535. },
  2536. {
  2537. "name": "VelocityConstant",
  2538. "members": [
  2539. {
  2540. "name": "u_velocity_mode",
  2541. "type": 5,
  2542. "count": 1
  2543. },
  2544. {
  2545. "name": "u_velocity_space",
  2546. "type": 5,
  2547. "count": 1
  2548. }
  2549. ],
  2550. "defines": [
  2551. "VELOCITY_OVER_TIME_MODULE_ENABLE"
  2552. ],
  2553. "stageFlags": 1,
  2554. "binding": 7
  2555. },
  2556. {
  2557. "name": "AnimationConstant",
  2558. "members": [
  2559. {
  2560. "name": "u_anim_info",
  2561. "type": 16,
  2562. "count": 1
  2563. }
  2564. ],
  2565. "defines": [
  2566. "TEXTURE_ANIMATION_MODULE_ENABLE"
  2567. ],
  2568. "stageFlags": 1,
  2569. "binding": 8
  2570. }
  2571. ],
  2572. "samplerTextures": [
  2573. {
  2574. "name": "color_over_time_tex0",
  2575. "type": 28,
  2576. "count": 1,
  2577. "defines": [
  2578. "COLOR_OVER_TIME_MODULE_ENABLE"
  2579. ],
  2580. "stageFlags": 1,
  2581. "binding": 9
  2582. },
  2583. {
  2584. "name": "rotation_over_time_tex0",
  2585. "type": 28,
  2586. "count": 1,
  2587. "defines": [
  2588. "ROTATION_OVER_TIME_MODULE_ENABLE"
  2589. ],
  2590. "stageFlags": 1,
  2591. "binding": 10
  2592. },
  2593. {
  2594. "name": "size_over_time_tex0",
  2595. "type": 28,
  2596. "count": 1,
  2597. "defines": [
  2598. "SIZE_OVER_TIME_MODULE_ENABLE"
  2599. ],
  2600. "stageFlags": 1,
  2601. "binding": 11
  2602. },
  2603. {
  2604. "name": "force_over_time_tex0",
  2605. "type": 28,
  2606. "count": 1,
  2607. "defines": [
  2608. "FORCE_OVER_TIME_MODULE_ENABLE"
  2609. ],
  2610. "stageFlags": 1,
  2611. "binding": 12
  2612. },
  2613. {
  2614. "name": "velocity_over_time_tex0",
  2615. "type": 28,
  2616. "count": 1,
  2617. "defines": [
  2618. "VELOCITY_OVER_TIME_MODULE_ENABLE"
  2619. ],
  2620. "stageFlags": 1,
  2621. "binding": 13
  2622. },
  2623. {
  2624. "name": "texture_animation_tex0",
  2625. "type": 28,
  2626. "count": 1,
  2627. "defines": [
  2628. "TEXTURE_ANIMATION_MODULE_ENABLE"
  2629. ],
  2630. "stageFlags": 1,
  2631. "binding": 14
  2632. },
  2633. {
  2634. "name": "mainTexture",
  2635. "type": 28,
  2636. "count": 1,
  2637. "defines": [],
  2638. "stageFlags": 16,
  2639. "binding": 15
  2640. }
  2641. ],
  2642. "samplers": [],
  2643. "textures": [],
  2644. "buffers": [],
  2645. "images": [],
  2646. "subpassInputs": [],
  2647. "attributes": [
  2648. {
  2649. "name": "a_position_starttime",
  2650. "defines": [],
  2651. "format": 44,
  2652. "location": 0
  2653. },
  2654. {
  2655. "name": "a_color",
  2656. "defines": [],
  2657. "format": 44,
  2658. "location": 1
  2659. },
  2660. {
  2661. "name": "a_dir_life",
  2662. "defines": [],
  2663. "format": 44,
  2664. "location": 2
  2665. },
  2666. {
  2667. "name": "a_rndSeed",
  2668. "defines": [],
  2669. "format": 11,
  2670. "location": 3
  2671. },
  2672. {
  2673. "name": "a_size_uv",
  2674. "defines": [
  2675. "!CC_INSTANCE_PARTICLE"
  2676. ],
  2677. "format": 44,
  2678. "location": 4
  2679. },
  2680. {
  2681. "name": "a_rotation_uv",
  2682. "defines": [
  2683. "!CC_INSTANCE_PARTICLE"
  2684. ],
  2685. "format": 44,
  2686. "location": 5
  2687. },
  2688. {
  2689. "name": "a_size_fid",
  2690. "defines": [
  2691. "CC_INSTANCE_PARTICLE"
  2692. ],
  2693. "format": 44,
  2694. "location": 6
  2695. },
  2696. {
  2697. "name": "a_rotation",
  2698. "defines": [
  2699. "CC_INSTANCE_PARTICLE"
  2700. ],
  2701. "format": 32,
  2702. "location": 7
  2703. },
  2704. {
  2705. "name": "a_uv",
  2706. "defines": [
  2707. "CC_INSTANCE_PARTICLE"
  2708. ],
  2709. "format": 32,
  2710. "location": 8
  2711. },
  2712. {
  2713. "name": "a_texCoord",
  2714. "defines": [
  2715. "CC_RENDER_MODE"
  2716. ],
  2717. "format": 32,
  2718. "location": 9
  2719. },
  2720. {
  2721. "name": "a_texCoord3",
  2722. "defines": [
  2723. "CC_RENDER_MODE"
  2724. ],
  2725. "format": 32,
  2726. "location": 10
  2727. },
  2728. {
  2729. "name": "a_normal",
  2730. "defines": [
  2731. "CC_RENDER_MODE"
  2732. ],
  2733. "format": 32,
  2734. "location": 11
  2735. },
  2736. {
  2737. "name": "a_color1",
  2738. "defines": [
  2739. "CC_RENDER_MODE"
  2740. ],
  2741. "format": 44,
  2742. "location": 12
  2743. }
  2744. ],
  2745. "varyings": [
  2746. {
  2747. "name": "uv",
  2748. "type": 14,
  2749. "count": 1,
  2750. "defines": [],
  2751. "stageFlags": 17,
  2752. "location": 0
  2753. },
  2754. {
  2755. "name": "color",
  2756. "type": 16,
  2757. "count": 1,
  2758. "defines": [],
  2759. "stageFlags": 17,
  2760. "location": 1
  2761. }
  2762. ],
  2763. "fragColors": [
  2764. {
  2765. "name": "cc_FragColor",
  2766. "typename": "vec4",
  2767. "type": 16,
  2768. "count": 1,
  2769. "defines": [],
  2770. "stageFlags": 16,
  2771. "location": 0
  2772. }
  2773. ],
  2774. "descriptors": [
  2775. {
  2776. "rate": 0,
  2777. "blocks": [
  2778. {
  2779. "tags": {
  2780. "builtin": "local"
  2781. },
  2782. "name": "CCLocal",
  2783. "members": [
  2784. {
  2785. "name": "cc_matWorld",
  2786. "typename": "mat4",
  2787. "type": 25,
  2788. "count": 1,
  2789. "precision": "highp "
  2790. },
  2791. {
  2792. "name": "cc_matWorldIT",
  2793. "typename": "mat4",
  2794. "type": 25,
  2795. "count": 1,
  2796. "precision": "highp "
  2797. },
  2798. {
  2799. "name": "cc_lightingMapUVParam",
  2800. "typename": "vec4",
  2801. "type": 16,
  2802. "count": 1,
  2803. "precision": "highp "
  2804. },
  2805. {
  2806. "name": "cc_localShadowBias",
  2807. "typename": "vec4",
  2808. "type": 16,
  2809. "count": 1,
  2810. "precision": "highp "
  2811. },
  2812. {
  2813. "name": "cc_reflectionProbeData1",
  2814. "typename": "vec4",
  2815. "type": 16,
  2816. "count": 1,
  2817. "precision": "highp "
  2818. },
  2819. {
  2820. "name": "cc_reflectionProbeData2",
  2821. "typename": "vec4",
  2822. "type": 16,
  2823. "count": 1,
  2824. "precision": "highp "
  2825. },
  2826. {
  2827. "name": "cc_reflectionProbeBlendData1",
  2828. "typename": "vec4",
  2829. "type": 16,
  2830. "count": 1,
  2831. "precision": "highp "
  2832. },
  2833. {
  2834. "name": "cc_reflectionProbeBlendData2",
  2835. "typename": "vec4",
  2836. "type": 16,
  2837. "count": 1,
  2838. "precision": "highp "
  2839. }
  2840. ],
  2841. "defines": [],
  2842. "stageFlags": 1
  2843. }
  2844. ],
  2845. "samplerTextures": [],
  2846. "samplers": [],
  2847. "textures": [],
  2848. "buffers": [],
  2849. "images": [],
  2850. "subpassInputs": []
  2851. },
  2852. {
  2853. "rate": 1,
  2854. "blocks": [
  2855. {
  2856. "name": "Constants",
  2857. "members": [
  2858. {
  2859. "name": "mainTiling_Offset",
  2860. "type": 16,
  2861. "count": 1
  2862. },
  2863. {
  2864. "name": "frameTile_velLenScale",
  2865. "type": 16,
  2866. "count": 1
  2867. },
  2868. {
  2869. "name": "scale",
  2870. "type": 16,
  2871. "count": 1
  2872. },
  2873. {
  2874. "name": "nodeRotation",
  2875. "type": 16,
  2876. "count": 1
  2877. }
  2878. ],
  2879. "defines": [],
  2880. "stageFlags": 1,
  2881. "binding": 0
  2882. },
  2883. {
  2884. "name": "SampleConstants",
  2885. "members": [
  2886. {
  2887. "name": "u_sampleInfo",
  2888. "type": 16,
  2889. "count": 1
  2890. }
  2891. ],
  2892. "defines": [],
  2893. "stageFlags": 1,
  2894. "binding": 1
  2895. },
  2896. {
  2897. "name": "TickConstants",
  2898. "members": [
  2899. {
  2900. "name": "u_worldRot",
  2901. "type": 16,
  2902. "count": 1
  2903. },
  2904. {
  2905. "name": "u_timeDelta",
  2906. "type": 16,
  2907. "count": 1
  2908. }
  2909. ],
  2910. "defines": [],
  2911. "stageFlags": 1,
  2912. "binding": 2
  2913. },
  2914. {
  2915. "name": "ColorConstant",
  2916. "members": [
  2917. {
  2918. "name": "u_color_mode",
  2919. "type": 5,
  2920. "count": 1
  2921. }
  2922. ],
  2923. "defines": [
  2924. "COLOR_OVER_TIME_MODULE_ENABLE"
  2925. ],
  2926. "stageFlags": 1,
  2927. "binding": 3
  2928. },
  2929. {
  2930. "name": "RotationConstant",
  2931. "members": [
  2932. {
  2933. "name": "u_rotation_mode",
  2934. "type": 5,
  2935. "count": 1
  2936. }
  2937. ],
  2938. "defines": [
  2939. "ROTATION_OVER_TIME_MODULE_ENABLE"
  2940. ],
  2941. "stageFlags": 1,
  2942. "binding": 4
  2943. },
  2944. {
  2945. "name": "SizeConstant",
  2946. "members": [
  2947. {
  2948. "name": "u_size_mode",
  2949. "type": 5,
  2950. "count": 1
  2951. }
  2952. ],
  2953. "defines": [
  2954. "SIZE_OVER_TIME_MODULE_ENABLE"
  2955. ],
  2956. "stageFlags": 1,
  2957. "binding": 5
  2958. },
  2959. {
  2960. "name": "ForceConstant",
  2961. "members": [
  2962. {
  2963. "name": "u_force_mode",
  2964. "type": 5,
  2965. "count": 1
  2966. },
  2967. {
  2968. "name": "u_force_space",
  2969. "type": 5,
  2970. "count": 1
  2971. }
  2972. ],
  2973. "defines": [
  2974. "FORCE_OVER_TIME_MODULE_ENABLE"
  2975. ],
  2976. "stageFlags": 1,
  2977. "binding": 6
  2978. },
  2979. {
  2980. "name": "VelocityConstant",
  2981. "members": [
  2982. {
  2983. "name": "u_velocity_mode",
  2984. "type": 5,
  2985. "count": 1
  2986. },
  2987. {
  2988. "name": "u_velocity_space",
  2989. "type": 5,
  2990. "count": 1
  2991. }
  2992. ],
  2993. "defines": [
  2994. "VELOCITY_OVER_TIME_MODULE_ENABLE"
  2995. ],
  2996. "stageFlags": 1,
  2997. "binding": 7
  2998. },
  2999. {
  3000. "name": "AnimationConstant",
  3001. "members": [
  3002. {
  3003. "name": "u_anim_info",
  3004. "type": 16,
  3005. "count": 1
  3006. }
  3007. ],
  3008. "defines": [
  3009. "TEXTURE_ANIMATION_MODULE_ENABLE"
  3010. ],
  3011. "stageFlags": 1,
  3012. "binding": 8
  3013. }
  3014. ],
  3015. "samplerTextures": [
  3016. {
  3017. "name": "color_over_time_tex0",
  3018. "type": 28,
  3019. "count": 1,
  3020. "defines": [
  3021. "COLOR_OVER_TIME_MODULE_ENABLE"
  3022. ],
  3023. "stageFlags": 1,
  3024. "binding": 9
  3025. },
  3026. {
  3027. "name": "rotation_over_time_tex0",
  3028. "type": 28,
  3029. "count": 1,
  3030. "defines": [
  3031. "ROTATION_OVER_TIME_MODULE_ENABLE"
  3032. ],
  3033. "stageFlags": 1,
  3034. "binding": 10
  3035. },
  3036. {
  3037. "name": "size_over_time_tex0",
  3038. "type": 28,
  3039. "count": 1,
  3040. "defines": [
  3041. "SIZE_OVER_TIME_MODULE_ENABLE"
  3042. ],
  3043. "stageFlags": 1,
  3044. "binding": 11
  3045. },
  3046. {
  3047. "name": "force_over_time_tex0",
  3048. "type": 28,
  3049. "count": 1,
  3050. "defines": [
  3051. "FORCE_OVER_TIME_MODULE_ENABLE"
  3052. ],
  3053. "stageFlags": 1,
  3054. "binding": 12
  3055. },
  3056. {
  3057. "name": "velocity_over_time_tex0",
  3058. "type": 28,
  3059. "count": 1,
  3060. "defines": [
  3061. "VELOCITY_OVER_TIME_MODULE_ENABLE"
  3062. ],
  3063. "stageFlags": 1,
  3064. "binding": 13
  3065. },
  3066. {
  3067. "name": "texture_animation_tex0",
  3068. "type": 28,
  3069. "count": 1,
  3070. "defines": [
  3071. "TEXTURE_ANIMATION_MODULE_ENABLE"
  3072. ],
  3073. "stageFlags": 1,
  3074. "binding": 14
  3075. },
  3076. {
  3077. "name": "mainTexture",
  3078. "type": 28,
  3079. "count": 1,
  3080. "defines": [],
  3081. "stageFlags": 16,
  3082. "binding": 15
  3083. }
  3084. ],
  3085. "samplers": [],
  3086. "textures": [],
  3087. "buffers": [],
  3088. "images": [],
  3089. "subpassInputs": []
  3090. },
  3091. {
  3092. "rate": 2,
  3093. "blocks": [],
  3094. "samplerTextures": [],
  3095. "samplers": [],
  3096. "textures": [],
  3097. "buffers": [],
  3098. "images": [],
  3099. "subpassInputs": []
  3100. },
  3101. {
  3102. "rate": 3,
  3103. "blocks": [
  3104. {
  3105. "tags": {
  3106. "builtin": "global"
  3107. },
  3108. "name": "CCGlobal",
  3109. "members": [
  3110. {
  3111. "name": "cc_time",
  3112. "typename": "vec4",
  3113. "type": 16,
  3114. "count": 1,
  3115. "precision": "highp "
  3116. },
  3117. {
  3118. "name": "cc_screenSize",
  3119. "typename": "vec4",
  3120. "type": 16,
  3121. "count": 1,
  3122. "precision": "mediump "
  3123. },
  3124. {
  3125. "name": "cc_nativeSize",
  3126. "typename": "vec4",
  3127. "type": 16,
  3128. "count": 1,
  3129. "precision": "mediump "
  3130. },
  3131. {
  3132. "name": "cc_probeInfo",
  3133. "typename": "vec4",
  3134. "type": 16,
  3135. "count": 1,
  3136. "precision": "mediump "
  3137. },
  3138. {
  3139. "name": "cc_debug_view_mode",
  3140. "typename": "vec4",
  3141. "type": 16,
  3142. "count": 1,
  3143. "precision": "mediump "
  3144. }
  3145. ],
  3146. "defines": [],
  3147. "stageFlags": 17
  3148. },
  3149. {
  3150. "tags": {
  3151. "builtin": "global"
  3152. },
  3153. "name": "CCCamera",
  3154. "members": [
  3155. {
  3156. "name": "cc_matView",
  3157. "typename": "mat4",
  3158. "type": 25,
  3159. "count": 1,
  3160. "precision": "highp "
  3161. },
  3162. {
  3163. "name": "cc_matViewInv",
  3164. "typename": "mat4",
  3165. "type": 25,
  3166. "count": 1,
  3167. "precision": "highp "
  3168. },
  3169. {
  3170. "name": "cc_matProj",
  3171. "typename": "mat4",
  3172. "type": 25,
  3173. "count": 1,
  3174. "precision": "highp "
  3175. },
  3176. {
  3177. "name": "cc_matProjInv",
  3178. "typename": "mat4",
  3179. "type": 25,
  3180. "count": 1,
  3181. "precision": "highp "
  3182. },
  3183. {
  3184. "name": "cc_matViewProj",
  3185. "typename": "mat4",
  3186. "type": 25,
  3187. "count": 1,
  3188. "precision": "highp "
  3189. },
  3190. {
  3191. "name": "cc_matViewProjInv",
  3192. "typename": "mat4",
  3193. "type": 25,
  3194. "count": 1,
  3195. "precision": "highp "
  3196. },
  3197. {
  3198. "name": "cc_cameraPos",
  3199. "typename": "vec4",
  3200. "type": 16,
  3201. "count": 1,
  3202. "precision": "highp "
  3203. },
  3204. {
  3205. "name": "cc_surfaceTransform",
  3206. "typename": "vec4",
  3207. "type": 16,
  3208. "count": 1,
  3209. "precision": "mediump "
  3210. },
  3211. {
  3212. "name": "cc_screenScale",
  3213. "typename": "vec4",
  3214. "type": 16,
  3215. "count": 1,
  3216. "precision": "mediump "
  3217. },
  3218. {
  3219. "name": "cc_exposure",
  3220. "typename": "vec4",
  3221. "type": 16,
  3222. "count": 1,
  3223. "precision": "mediump "
  3224. },
  3225. {
  3226. "name": "cc_mainLitDir",
  3227. "typename": "vec4",
  3228. "type": 16,
  3229. "count": 1,
  3230. "precision": "mediump "
  3231. },
  3232. {
  3233. "name": "cc_mainLitColor",
  3234. "typename": "vec4",
  3235. "type": 16,
  3236. "count": 1,
  3237. "precision": "mediump "
  3238. },
  3239. {
  3240. "name": "cc_ambientSky",
  3241. "typename": "vec4",
  3242. "type": 16,
  3243. "count": 1,
  3244. "precision": "mediump "
  3245. },
  3246. {
  3247. "name": "cc_ambientGround",
  3248. "typename": "vec4",
  3249. "type": 16,
  3250. "count": 1,
  3251. "precision": "mediump "
  3252. },
  3253. {
  3254. "name": "cc_fogColor",
  3255. "typename": "vec4",
  3256. "type": 16,
  3257. "count": 1,
  3258. "precision": "mediump "
  3259. },
  3260. {
  3261. "name": "cc_fogBase",
  3262. "typename": "vec4",
  3263. "type": 16,
  3264. "count": 1,
  3265. "precision": "mediump "
  3266. },
  3267. {
  3268. "name": "cc_fogAdd",
  3269. "typename": "vec4",
  3270. "type": 16,
  3271. "count": 1,
  3272. "precision": "mediump "
  3273. },
  3274. {
  3275. "name": "cc_nearFar",
  3276. "typename": "vec4",
  3277. "type": 16,
  3278. "count": 1,
  3279. "precision": "mediump "
  3280. },
  3281. {
  3282. "name": "cc_viewPort",
  3283. "typename": "vec4",
  3284. "type": 16,
  3285. "count": 1,
  3286. "precision": "mediump "
  3287. }
  3288. ],
  3289. "defines": [],
  3290. "stageFlags": 17
  3291. }
  3292. ],
  3293. "samplerTextures": [],
  3294. "samplers": [],
  3295. "textures": [],
  3296. "buffers": [],
  3297. "images": [],
  3298. "subpassInputs": []
  3299. }
  3300. ],
  3301. "hash": 1067163463,
  3302. "glsl4": {
  3303. "vert": "\nprecision mediump float;\nvec4 quaternionFromAxis (vec3 xAxis,vec3 yAxis,vec3 zAxis){\n mat3 m = mat3(xAxis,yAxis,zAxis);\n float trace = m[0][0] + m[1][1] + m[2][2];\n vec4 quat;\n if (trace > 0.) {\n float s = 0.5 / sqrt(trace + 1.0);\n quat.w = 0.25 / s;\n quat.x = (m[2][1] - m[1][2]) * s;\n quat.y = (m[0][2] - m[2][0]) * s;\n quat.z = (m[1][0] - m[0][1]) * s;\n } else if ((m[0][0] > m[1][1]) && (m[0][0] > m[2][2])) {\n float s = 2.0 * sqrt(1.0 + m[0][0] - m[1][1] - m[2][2]);\n quat.w = (m[2][1] - m[1][2]) / s;\n quat.x = 0.25 * s;\n quat.y = (m[0][1] + m[1][0]) / s;\n quat.z = (m[0][2] + m[2][0]) / s;\n } else if (m[1][1] > m[2][2]) {\n float s = 2.0 * sqrt(1.0 + m[1][1] - m[0][0] - m[2][2]);\n quat.w = (m[0][2] - m[2][0]) / s;\n quat.x = (m[0][1] + m[1][0]) / s;\n quat.y = 0.25 * s;\n quat.z = (m[1][2] + m[2][1]) / s;\n } else {\n float s = 2.0 * sqrt(1.0 + m[2][2] - m[0][0] - m[1][1]);\n quat.w = (m[1][0] - m[0][1]) / s;\n quat.x = (m[0][2] + m[2][0]) / s;\n quat.y = (m[1][2] + m[2][1]) / s;\n quat.z = 0.25 * s;\n }\n float len = quat.x * quat.x + quat.y * quat.y + quat.z * quat.z + quat.w * quat.w;\n if (len > 0.) {\n len = 1. / sqrt(len);\n quat.x = quat.x * len;\n quat.y = quat.y * len;\n quat.z = quat.z * len;\n quat.w = quat.w * len;\n }\n return quat;\n}\nvec4 quaternionFromEuler (vec3 angle){\n float x = angle.x / 2.;\n float y = angle.y / 2.;\n float z = angle.z / 2.;\n float sx = sin(x);\n float cx = cos(x);\n float sy = sin(y);\n float cy = cos(y);\n float sz = sin(z);\n float cz = cos(z);\n vec4 quat = vec4(0);\n quat.x = sx * cy * cz + cx * sy * sz;\n quat.y = cx * sy * cz + sx * cy * sz;\n quat.z = cx * cy * sz - sx * sy * cz;\n quat.w = cx * cy * cz - sx * sy * sz;\n return quat;\n}\nmat4 matrixFromRT (vec4 q, vec3 p){\n float x2 = q.x + q.x;\n float y2 = q.y + q.y;\n float z2 = q.z + q.z;\n float xx = q.x * x2;\n float xy = q.x * y2;\n float xz = q.x * z2;\n float yy = q.y * y2;\n float yz = q.y * z2;\n float zz = q.z * z2;\n float wx = q.w * x2;\n float wy = q.w * y2;\n float wz = q.w * z2;\n return mat4(\n 1. - (yy + zz), xy + wz, xz - wy, 0,\n xy - wz, 1. - (xx + zz), yz + wx, 0,\n xz + wy, yz - wx, 1. - (xx + yy), 0,\n p.x, p.y, p.z, 1\n );\n}\nmat4 matFromRTS (vec4 q, vec3 t, vec3 s){\n float x = q.x, y = q.y, z = q.z, w = q.w;\n float x2 = x + x;\n float y2 = y + y;\n float z2 = z + z;\n float xx = x * x2;\n float xy = x * y2;\n float xz = x * z2;\n float yy = y * y2;\n float yz = y * z2;\n float zz = z * z2;\n float wx = w * x2;\n float wy = w * y2;\n float wz = w * z2;\n float sx = s.x;\n float sy = s.y;\n float sz = s.z;\n return mat4((1. - (yy + zz)) * sx, (xy + wz) * sx, (xz - wy) * sx, 0,\n (xy - wz) * sy, (1. - (xx + zz)) * sy, (yz + wx) * sy, 0,\n (xz + wy) * sz, (yz - wx) * sz, (1. - (xx + yy)) * sz, 0,\n t.x, t.y, t.z, 1);\n}\nvec4 quatMultiply (vec4 a, vec4 b){\n vec4 quat;\n quat.x = a.x * b.w + a.w * b.x + a.y * b.z - a.z * b.y;\n quat.y = a.y * b.w + a.w * b.y + a.z * b.x - a.x * b.z;\n quat.z = a.z * b.w + a.w * b.z + a.x * b.y - a.y * b.x;\n quat.w = a.w * b.w - a.x * b.x - a.y * b.y - a.z * b.z;\n return quat;\n}\nvoid rotateVecFromQuat (inout vec3 v, vec4 q){\n float ix = q.w * v.x + q.y * v.z - q.z * v.y;\n float iy = q.w * v.y + q.z * v.x - q.x * v.z;\n float iz = q.w * v.z + q.x * v.y - q.y * v.x;\n float iw = -q.x * v.x - q.y * v.y - q.z * v.z;\n v.x = ix * q.w + iw * -q.x + iy * -q.z - iz * -q.y;\n v.y = iy * q.w + iw * -q.y + iz * -q.x - ix * -q.z;\n v.z = iz * q.w + iw * -q.z + ix * -q.y - iy * -q.x;\n}\nvec3 rotateInLocalSpace (vec3 pos, vec3 xAxis, vec3 yAxis, vec3 zAxis, vec4 q){\n vec4 viewQuat = quaternionFromAxis(xAxis, yAxis, zAxis);\n vec4 rotQuat = quatMultiply(viewQuat, q);\n rotateVecFromQuat(pos, rotQuat);\n return pos;\n}\nmat3 quatToMat3(vec4 q) {\n vec3 m0 = vec3(\n 1.0 - 2.0 * q.y * q.y - 2.0 * q.z * q.z,\n 2.0 * q.x * q.y + 2.0 * q.w * q.z,\n 2.0 * q.x * q.z - 2.0 * q.w * q.y);\n\tvec3 m1 = vec3(\n 2.0 * q.x * q.y - 2.0 * q.w * q.z,\n 1.0 - 2.0 * q.x * q.x - 2.0 * q.z * q.z,\n 2.0 * q.y * q.z + 2.0 * q.w * q.x);\n\tvec3 m2 = vec3(\n 2.0 * q.x * q.z + 2.0 * q.w * q.y,\n 2.0 * q.y * q.z - 2.0 * q.w * q.x,\n 1.0 - 2.0 * q.x * q.x - 2.0 * q.y * q.y);\n return mat3(m0, m1, m2);\n}\nvec4 mat3ToQuat(mat3 mat) {\n float tr = mat[0][0] + mat[1][1] + mat[2][2];\n\tfloat qw, qx, qy, qz;\n if (tr > 0.0) {\n float S = sqrt(tr + 1.0) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = 0.25 * S;\n\t qx = (mat[1][2] - mat[2][1]) * invS;\n\t qy = (mat[2][0] - mat[0][2]) * invS;\n\t qz = (mat[0][1] - mat[1][0]) * invS;\n } else if ((mat[0][0] > mat[1][1])&&(mat[0][0] > mat[2][2])) {\n float S = sqrt(1.0 + mat[0][0] - mat[1][1] - mat[2][2]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[1][2] - mat[2][1]) * invS;\n\t qx = 0.25 * S;\n\t qy = (mat[1][0] + mat[0][1]) * invS;\n\t qz = (mat[2][0] + mat[0][2]) * invS;\n } else if (mat[1][1] > mat[2][2]) {\n\t float S = sqrt(1.0 + mat[1][1] - mat[0][0] - mat[2][2]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[2][0] - mat[0][2]) * invS;\n\t qx = (mat[1][0] + mat[0][1]) * invS;\n\t qy = 0.25 * S;\n\t qz = (mat[2][1] + mat[1][2]) * invS;\n } else {\n\t float S = sqrt(1.0 + mat[2][2] - mat[0][0] - mat[1][1]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[0][1] - mat[1][0]) * invS;\n\t qx = (mat[2][0] + mat[0][2]) * invS;\n\t qy = (mat[2][1] + mat[1][2]) * invS;\n\t qz = 0.25 * S;\n }\n return vec4(qx, qy, qz, qw);\n}\nvec4 eulerToQuat(vec3 euler) {\n vec3 er = euler * 0.5;\n float x = er.x, y = er.y, z = er.z;\n float sx = sin(x);\n float cx = cos(x);\n float sy = sin(y);\n float cy = cos(y);\n float sz = sin(z);\n float cz = cos(z);\n vec4 quat;\n quat.x = sx * cy * cz + cx * sy * sz;\n quat.y = cx * sy * cz + sx * cy * sz;\n quat.z = cx * cy * sz - sx * sy * cz;\n quat.w = cx * cy * cz - sx * sy * sz;\n return quat;\n}\nlayout(set = 1, binding = 0) uniform Constants {\n vec4 mainTiling_Offset;\n vec4 frameTile_velLenScale;\n vec4 scale;\n vec4 nodeRotation;\n};\nlayout(set = 0, binding = 0) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(set = 0, binding = 1) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nlayout(set = 2, binding = 0) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n};\nlayout(location = 0) out mediump vec2 uv;\nlayout(location = 1) out mediump vec4 color;\nvoid computeVertPos (inout vec4 pos, vec2 vertOffset, vec4 q, vec3 s\n#if CC_RENDER_MODE == 0 || CC_RENDER_MODE == 3\n , mat4 viewInv\n#endif\n#if CC_RENDER_MODE == 1\n , vec3 eye\n , vec4 velocity\n , float velocityScale\n , float lengthScale\n , float xIndex\n#endif\n) {\n#if CC_RENDER_MODE == 0\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n vec3 camX = normalize(vec3(viewInv[0][0], viewInv[1][0], viewInv[2][0]));\n vec3 camY = normalize(vec3(viewInv[0][1], viewInv[1][1], viewInv[2][1]));\n vec3 camZ = normalize(vec3(viewInv[0][2], viewInv[1][2], viewInv[2][2]));\n pos.xyz += rotateInLocalSpace(viewSpaceVert, camX, camY, camZ, q);\n#elif CC_RENDER_MODE == 1\n vec3 camRight = normalize(cross(pos.xyz - eye, velocity.xyz)) * s.x;\n vec3 camUp = velocity.xyz * velocityScale + normalize(velocity.xyz) * lengthScale * s.y;\n pos.xyz += (camRight * abs(vertOffset.x) * sign(vertOffset.y)) - camUp * xIndex;\n#elif CC_RENDER_MODE == 2\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n vec3 camX = vec3(1, 0, 0);\n vec3 camY = vec3(0, 0, -1);\n pos.xyz += rotateInLocalSpace(viewSpaceVert, camX, camY, cross(camX, camY), q);\n#elif CC_RENDER_MODE == 3\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n rotateVecFromQuat(viewSpaceVert, q);\n vec3 camX = normalize(vec3(cc_matView[0][0], cc_matView[1][0], cc_matView[2][0]));\n vec3 camY = vec3(0, 1, 0);\n vec3 offset = camX * viewSpaceVert.x + camY * viewSpaceVert.y;\n pos.xyz += offset;\n#else\n pos.x += vertOffset.x;\n pos.y += vertOffset.y;\n#endif\n}\nvec2 computeUV (float frameIndex, vec2 vertIndex, vec2 frameTile){\n vec2 aniUV = vec2(0, floor(frameIndex * frameTile.y));\n aniUV.x = floor(frameIndex * frameTile.x * frameTile.y - aniUV.y * frameTile.x);\n#if CC_RENDER_MODE != 4\n vertIndex.y = 1. - vertIndex.y;\n#endif\n return (aniUV.xy + vertIndex) / vec2(frameTile.x, frameTile.y);\n}\nlayout(set = 1, binding = 1) uniform SampleConstants {\n vec4 u_sampleInfo;\n};\nlayout(set = 1, binding = 2) uniform TickConstants {\n vec4 u_worldRot;\n vec4 u_timeDelta;\n};\nlayout(location = 0) in vec4 a_position_starttime;\nlayout(location = 1) in vec4 a_color;\nlayout(location = 2) in vec4 a_dir_life;\nlayout(location = 3) in float a_rndSeed;\n#if !CC_INSTANCE_PARTICLE\n layout(location = 4) in vec4 a_size_uv;\n layout(location = 5) in vec4 a_rotation_uv;\n#endif\n#if CC_INSTANCE_PARTICLE\n layout(location = 6) in vec4 a_size_fid;\n layout(location = 7) in vec3 a_rotation;\n layout(location = 8) in vec3 a_uv;\n#endif\n#if CC_RENDER_MODE == 4\n layout(location = 9) in vec3 a_texCoord;\n layout(location = 10) in vec3 a_texCoord3;\n layout(location = 11) in vec3 a_normal;\n layout(location = 12) in vec4 a_color1;\n#endif\nvec3 unpackCurveData (sampler2D tex, vec2 coord) {\n vec4 a = texture(tex, coord);\n vec4 b = texture(tex, coord + u_sampleInfo.y);\n float c = fract(coord.x * u_sampleInfo.x);\n return mix(a.xyz, b.xyz, c);\n}\nvec3 unpackCurveData (sampler2D tex, vec2 coord, out float w) {\n vec4 a = texture(tex, coord);\n vec4 b = texture(tex, coord + u_sampleInfo.y);\n float c = fract(coord.x * u_sampleInfo.x);\n w = mix(a.w, b.w, c);\n return mix(a.xyz, b.xyz, c);\n}\nfloat pseudoRandom(float x) {\n#if USE_VK_SHADER\n float o = x;\n x = mod(x - 1.0, 2.0) - 1.0;\n float freqVar = 10.16640753482;\n float y = sin(freqVar * floor(o * 0.5 - 0.5));\n float v = max(0.0, 1.0-abs(x));\n v *= 0.7071067812;\n v = y < 0.0 ? -v : v;\n return v;\n#endif\n#if !USE_VK_SHADER\n float seed = mod(x, 233280.);\n float q = (seed * 9301. + 49297.) / 233280.;\n return fract(q);\n#endif\n}\n#if COLOR_OVER_TIME_MODULE_ENABLE\n layout(set = 1, binding = 9) uniform sampler2D color_over_time_tex0;\n layout(set = 1, binding = 3) uniform ColorConstant {\n int u_color_mode;\n };\n#endif\n#if ROTATION_OVER_TIME_MODULE_ENABLE\n layout(set = 1, binding = 10) uniform sampler2D rotation_over_time_tex0;\n layout(set = 1, binding = 4) uniform RotationConstant {\n int u_rotation_mode;\n };\n#endif\n#if SIZE_OVER_TIME_MODULE_ENABLE\n layout(set = 1, binding = 11) uniform sampler2D size_over_time_tex0;\n layout(set = 1, binding = 5) uniform SizeConstant {\n int u_size_mode;\n };\n#endif\n#if FORCE_OVER_TIME_MODULE_ENABLE\n layout(set = 1, binding = 12) uniform sampler2D force_over_time_tex0;\n layout(set = 1, binding = 6) uniform ForceConstant {\n int u_force_mode;\n int u_force_space;\n };\n#endif\n#if VELOCITY_OVER_TIME_MODULE_ENABLE\n layout(set = 1, binding = 13) uniform sampler2D velocity_over_time_tex0;\n layout(set = 1, binding = 7) uniform VelocityConstant {\n int u_velocity_mode;\n int u_velocity_space;\n };\n#endif\n#if TEXTURE_ANIMATION_MODULE_ENABLE\n layout(set = 1, binding = 14) uniform sampler2D texture_animation_tex0;\n layout(set = 1, binding = 8) uniform AnimationConstant {\n vec4 u_anim_info;\n };\n#endif\nfloat repeat (float t, float length) {\n return t - floor(t / length) * length;\n}\nvec4 rotateQuat (vec4 p, vec4 q) {\n vec3 iv = cross(q.xyz, p.xyz) + q.w * p.xyz;\n vec3 res = p.xyz + 2.0 * cross(q.xyz, iv);\n return vec4(res.xyz, p.w);\n}\nvec4 gpvs_main () {\n float activeTime = u_timeDelta.x - a_position_starttime.w;\n float normalizedTime = clamp(activeTime / a_dir_life.w, 0.0, 1.0);\n vec2 timeCoord0 = vec2(normalizedTime, 0.);\n vec2 timeCoord1 = vec2(normalizedTime, 1.);\n #if CC_RENDER_MODE == 4\n vec2 vertIdx = vec2(a_texCoord.x, a_texCoord.y);\n #endif\n #if CC_RENDER_MODE != 4\n #if !CC_INSTANCE_PARTICLE\n vec2 vertIdx = vec2(a_size_uv.w, a_rotation_uv.w);\n #endif\n #if CC_INSTANCE_PARTICLE\n vec2 vertIdx = a_uv.xy;\n #endif\n #endif\n vec4 velocity = vec4(a_dir_life.xyz, 0.);\n vec4 pos = vec4(a_position_starttime.xyz, 1.);\n #if !CC_INSTANCE_PARTICLE\n vec3 size = a_size_uv.xyz;\n #endif\n #if CC_INSTANCE_PARTICLE\n vec3 size = a_size_fid.xyz;\n #endif\n #if SIZE_OVER_TIME_MODULE_ENABLE\n if (u_size_mode == 1) {\n size *= unpackCurveData(size_over_time_tex0, timeCoord0);\n } else {\n vec3 size_0 = unpackCurveData(size_over_time_tex0, timeCoord0);\n vec3 size_1 = unpackCurveData(size_over_time_tex0, timeCoord1);\n float factor_s = pseudoRandom(a_rndSeed + 39825.);\n size *= mix(size_0, size_1, factor_s);\n }\n #endif\n vec3 compScale = scale.xyz * size;\n #if FORCE_OVER_TIME_MODULE_ENABLE\n vec3 forceAnim = vec3(0.);\n if (u_force_mode == 1) {\n forceAnim = unpackCurveData(force_over_time_tex0, timeCoord0);\n } else {\n vec3 force_0 = unpackCurveData(force_over_time_tex0, timeCoord0);\n vec3 force_1 = unpackCurveData(force_over_time_tex0, timeCoord1);\n float factor_f = pseudoRandom(a_rndSeed + 212165.);\n forceAnim = mix(force_0, force_1, factor_f);\n }\n vec4 forceTrack = vec4(forceAnim, 0.);\n if (u_force_space == 0) {\n forceTrack = rotateQuat(forceTrack, u_worldRot);\n }\n velocity.xyz += forceTrack.xyz;\n #endif\n #if VELOCITY_OVER_TIME_MODULE_ENABLE\n float speedModifier0 = 1.;\n float speedModifier1 = 1.;\n vec3 velocityAnim = vec3(0.);\n if (u_velocity_mode == 1) {\n velocityAnim = unpackCurveData(velocity_over_time_tex0, timeCoord0, speedModifier0);\n } else {\n vec3 vectory_0 = unpackCurveData(velocity_over_time_tex0, timeCoord0, speedModifier0);\n vec3 vectory_1 = unpackCurveData(velocity_over_time_tex0, timeCoord1, speedModifier1);\n float factor_v = pseudoRandom(a_rndSeed + 197866.);\n velocityAnim = mix(vectory_0, vectory_1, factor_v);\n speedModifier0 = mix(speedModifier0, speedModifier1, factor_v);\n }\n vec4 velocityTrack = vec4(velocityAnim, 0.);\n if (u_velocity_space == 0) {\n velocityTrack = rotateQuat(velocityTrack, u_worldRot);\n }\n velocity.xyz += velocityTrack.xyz;\n velocity.xyz *= speedModifier0;\n #endif\n pos.xyz += velocity.xyz * normalizedTime * a_dir_life.w;\n #if !CC_USE_WORLD_SPACE\n pos = cc_matWorld * pos;\n #if CC_RENDER_MODE == 1\n velocity = rotateQuat(velocity, u_worldRot);\n #endif\n #endif\n #if !CC_INSTANCE_PARTICLE\n vec3 startRotation = a_rotation_uv.xyz;\n #endif\n #if CC_INSTANCE_PARTICLE\n vec3 startRotation = a_rotation;\n #endif\n #if CC_RENDER_MODE != 4\n #if CC_RENDER_MODE == 0\n vec3 rotEuler = startRotation.xyz;\n #elif CC_RENDER_MODE == 1\n vec3 rotEuler = vec3(0.);\n #endif\n #if CC_RENDER_MODE != 0 && CC_RENDER_MODE != 1\n vec3 rotEuler = vec3(0., 0., startRotation.z);\n #endif\n vec4 rot = quaternionFromEuler(rotEuler);\n #endif\n #if CC_RENDER_MODE == 4\n vec4 rot = quaternionFromEuler(startRotation);\n #endif\n #if ROTATION_OVER_TIME_MODULE_ENABLE\n if (u_rotation_mode == 1) {\n vec3 euler = unpackCurveData(rotation_over_time_tex0, timeCoord0) * normalizedTime * a_dir_life.w;\n vec4 quat = eulerToQuat(euler);\n mat3 mLocal = quatToMat3(quat);\n mat3 mStart = quatToMat3(rot);\n rot = mat3ToQuat(mStart * mLocal);\n } else {\n vec3 rotation_0 = unpackCurveData(rotation_over_time_tex0, timeCoord0);\n vec3 rotation_1 = unpackCurveData(rotation_over_time_tex0, timeCoord1);\n float factor_r = pseudoRandom(a_rndSeed + 125292.);\n vec3 euler = mix(rotation_0, rotation_1, factor_r) * normalizedTime * a_dir_life.w;\n #if CC_RENDER_MODE == 3 || CC_RENDER_MODE == 2\n euler = vec3(0.0, 0.0, euler.z);\n #endif\n vec4 quat = eulerToQuat(euler);\n mat3 mLocal = quatToMat3(quat);\n mat3 mStart = quatToMat3(rot);\n rot = mat3ToQuat(mStart * mLocal);\n }\n #endif\n #if COLOR_OVER_TIME_MODULE_ENABLE\n if (u_color_mode == 1) {\n color = a_color * texture(color_over_time_tex0, timeCoord0);\n } else {\n vec4 color_0 = texture(color_over_time_tex0, timeCoord0);\n vec4 color_1 = texture(color_over_time_tex0, timeCoord1);\n float factor_c = pseudoRandom(a_rndSeed + 91041.);\n color = a_color * mix(color_0, color_1, factor_c);\n }\n #endif\n #if !COLOR_OVER_TIME_MODULE_ENABLE\n color = a_color;\n #endif\n #if CC_RENDER_MODE != 4\n vec2 cornerOffset = vec2((vertIdx - 0.5));\n #if CC_RENDER_MODE == 1\n rot = vec4(0.0, 0.0, 0.0, 1.0);\n #endif\n computeVertPos(pos, cornerOffset, rot, compScale\n #if CC_RENDER_MODE == 0 || CC_RENDER_MODE == 3\n , cc_matViewInv\n #endif\n #if CC_RENDER_MODE == 1\n , cc_cameraPos.xyz\n , velocity\n , frameTile_velLenScale.z\n , frameTile_velLenScale.w\n #if !CC_INSTANCE_PARTICLE\n , a_size_uv.w\n #endif\n #if CC_INSTANCE_PARTICLE\n , a_uv.x\n #endif\n #endif\n );\n #endif\n #if CC_RENDER_MODE == 4\n mat3 rotMat = quatToMat3(rot);\n mat3 nodeMat = quatToMat3(nodeRotation);\n rotMat = nodeMat * rotMat;\n rot = mat3ToQuat(rotMat);\n mat4 xformNoScale = matrixFromRT(rot, pos.xyz);\n mat4 xform = matFromRTS(rot, pos.xyz, compScale);\n pos = xform * vec4(a_texCoord3, 1);\n vec4 normal = xformNoScale * vec4(a_normal, 0);\n color *= a_color1;\n #endif\n pos = cc_matViewProj * pos;\n float frameIndex = 0.;\n #if TEXTURE_ANIMATION_MODULE_ENABLE\n float startFrame = 0.;\n vec3 frameInfo = vec3(0.);\n if (int(u_anim_info.x) == 1) {\n frameInfo = unpackCurveData(texture_animation_tex0, timeCoord0);\n } else {\n vec3 frameInfo0 = unpackCurveData(texture_animation_tex0, timeCoord0);\n vec3 frameInfo1 = unpackCurveData(texture_animation_tex0, timeCoord1);\n float factor_t = pseudoRandom(a_rndSeed + 90794.);\n frameInfo = mix(frameInfo0, frameInfo1, factor_t);\n }\n startFrame = frameInfo.x / u_anim_info.y;\n float EPSILON = 1e-6;\n frameIndex = repeat(u_anim_info.z * (frameInfo.y + startFrame), 1. + EPSILON);\n #endif\n uv = computeUV(frameIndex, vertIdx, frameTile_velLenScale.xy) * mainTiling_Offset.xy + mainTiling_Offset.zw;\n return pos;\n}\nvoid main() { gl_Position = gpvs_main(); }",
  3304. "frag": "\nprecision mediump float;\nlayout(set = 0, binding = 0) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(set = 0, binding = 1) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nvec4 CCFragOutput (vec4 color) {\n return color;\n}\nlayout(location = 0) in vec2 uv;\nlayout(location = 1) in vec4 color;\nlayout(set = 1, binding = 15) uniform sampler2D mainTexture;\nvec4 addSmooth () {\n vec4 col = color * texture(mainTexture, uv);\n col.rgb *= col.a;\n return CCFragOutput(col);\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = addSmooth(); }"
  3305. },
  3306. "glsl3": {
  3307. "vert": "\nprecision mediump float;\nvec4 quaternionFromAxis (vec3 xAxis,vec3 yAxis,vec3 zAxis){\n mat3 m = mat3(xAxis,yAxis,zAxis);\n float trace = m[0][0] + m[1][1] + m[2][2];\n vec4 quat;\n if (trace > 0.) {\n float s = 0.5 / sqrt(trace + 1.0);\n quat.w = 0.25 / s;\n quat.x = (m[2][1] - m[1][2]) * s;\n quat.y = (m[0][2] - m[2][0]) * s;\n quat.z = (m[1][0] - m[0][1]) * s;\n } else if ((m[0][0] > m[1][1]) && (m[0][0] > m[2][2])) {\n float s = 2.0 * sqrt(1.0 + m[0][0] - m[1][1] - m[2][2]);\n quat.w = (m[2][1] - m[1][2]) / s;\n quat.x = 0.25 * s;\n quat.y = (m[0][1] + m[1][0]) / s;\n quat.z = (m[0][2] + m[2][0]) / s;\n } else if (m[1][1] > m[2][2]) {\n float s = 2.0 * sqrt(1.0 + m[1][1] - m[0][0] - m[2][2]);\n quat.w = (m[0][2] - m[2][0]) / s;\n quat.x = (m[0][1] + m[1][0]) / s;\n quat.y = 0.25 * s;\n quat.z = (m[1][2] + m[2][1]) / s;\n } else {\n float s = 2.0 * sqrt(1.0 + m[2][2] - m[0][0] - m[1][1]);\n quat.w = (m[1][0] - m[0][1]) / s;\n quat.x = (m[0][2] + m[2][0]) / s;\n quat.y = (m[1][2] + m[2][1]) / s;\n quat.z = 0.25 * s;\n }\n float len = quat.x * quat.x + quat.y * quat.y + quat.z * quat.z + quat.w * quat.w;\n if (len > 0.) {\n len = 1. / sqrt(len);\n quat.x = quat.x * len;\n quat.y = quat.y * len;\n quat.z = quat.z * len;\n quat.w = quat.w * len;\n }\n return quat;\n}\nvec4 quaternionFromEuler (vec3 angle){\n float x = angle.x / 2.;\n float y = angle.y / 2.;\n float z = angle.z / 2.;\n float sx = sin(x);\n float cx = cos(x);\n float sy = sin(y);\n float cy = cos(y);\n float sz = sin(z);\n float cz = cos(z);\n vec4 quat = vec4(0);\n quat.x = sx * cy * cz + cx * sy * sz;\n quat.y = cx * sy * cz + sx * cy * sz;\n quat.z = cx * cy * sz - sx * sy * cz;\n quat.w = cx * cy * cz - sx * sy * sz;\n return quat;\n}\nmat4 matrixFromRT (vec4 q, vec3 p){\n float x2 = q.x + q.x;\n float y2 = q.y + q.y;\n float z2 = q.z + q.z;\n float xx = q.x * x2;\n float xy = q.x * y2;\n float xz = q.x * z2;\n float yy = q.y * y2;\n float yz = q.y * z2;\n float zz = q.z * z2;\n float wx = q.w * x2;\n float wy = q.w * y2;\n float wz = q.w * z2;\n return mat4(\n 1. - (yy + zz), xy + wz, xz - wy, 0,\n xy - wz, 1. - (xx + zz), yz + wx, 0,\n xz + wy, yz - wx, 1. - (xx + yy), 0,\n p.x, p.y, p.z, 1\n );\n}\nmat4 matFromRTS (vec4 q, vec3 t, vec3 s){\n float x = q.x, y = q.y, z = q.z, w = q.w;\n float x2 = x + x;\n float y2 = y + y;\n float z2 = z + z;\n float xx = x * x2;\n float xy = x * y2;\n float xz = x * z2;\n float yy = y * y2;\n float yz = y * z2;\n float zz = z * z2;\n float wx = w * x2;\n float wy = w * y2;\n float wz = w * z2;\n float sx = s.x;\n float sy = s.y;\n float sz = s.z;\n return mat4((1. - (yy + zz)) * sx, (xy + wz) * sx, (xz - wy) * sx, 0,\n (xy - wz) * sy, (1. - (xx + zz)) * sy, (yz + wx) * sy, 0,\n (xz + wy) * sz, (yz - wx) * sz, (1. - (xx + yy)) * sz, 0,\n t.x, t.y, t.z, 1);\n}\nvec4 quatMultiply (vec4 a, vec4 b){\n vec4 quat;\n quat.x = a.x * b.w + a.w * b.x + a.y * b.z - a.z * b.y;\n quat.y = a.y * b.w + a.w * b.y + a.z * b.x - a.x * b.z;\n quat.z = a.z * b.w + a.w * b.z + a.x * b.y - a.y * b.x;\n quat.w = a.w * b.w - a.x * b.x - a.y * b.y - a.z * b.z;\n return quat;\n}\nvoid rotateVecFromQuat (inout vec3 v, vec4 q){\n float ix = q.w * v.x + q.y * v.z - q.z * v.y;\n float iy = q.w * v.y + q.z * v.x - q.x * v.z;\n float iz = q.w * v.z + q.x * v.y - q.y * v.x;\n float iw = -q.x * v.x - q.y * v.y - q.z * v.z;\n v.x = ix * q.w + iw * -q.x + iy * -q.z - iz * -q.y;\n v.y = iy * q.w + iw * -q.y + iz * -q.x - ix * -q.z;\n v.z = iz * q.w + iw * -q.z + ix * -q.y - iy * -q.x;\n}\nvec3 rotateInLocalSpace (vec3 pos, vec3 xAxis, vec3 yAxis, vec3 zAxis, vec4 q){\n vec4 viewQuat = quaternionFromAxis(xAxis, yAxis, zAxis);\n vec4 rotQuat = quatMultiply(viewQuat, q);\n rotateVecFromQuat(pos, rotQuat);\n return pos;\n}\nmat3 quatToMat3(vec4 q) {\n vec3 m0 = vec3(\n 1.0 - 2.0 * q.y * q.y - 2.0 * q.z * q.z,\n 2.0 * q.x * q.y + 2.0 * q.w * q.z,\n 2.0 * q.x * q.z - 2.0 * q.w * q.y);\n\tvec3 m1 = vec3(\n 2.0 * q.x * q.y - 2.0 * q.w * q.z,\n 1.0 - 2.0 * q.x * q.x - 2.0 * q.z * q.z,\n 2.0 * q.y * q.z + 2.0 * q.w * q.x);\n\tvec3 m2 = vec3(\n 2.0 * q.x * q.z + 2.0 * q.w * q.y,\n 2.0 * q.y * q.z - 2.0 * q.w * q.x,\n 1.0 - 2.0 * q.x * q.x - 2.0 * q.y * q.y);\n return mat3(m0, m1, m2);\n}\nvec4 mat3ToQuat(mat3 mat) {\n float tr = mat[0][0] + mat[1][1] + mat[2][2];\n\tfloat qw, qx, qy, qz;\n if (tr > 0.0) {\n float S = sqrt(tr + 1.0) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = 0.25 * S;\n\t qx = (mat[1][2] - mat[2][1]) * invS;\n\t qy = (mat[2][0] - mat[0][2]) * invS;\n\t qz = (mat[0][1] - mat[1][0]) * invS;\n } else if ((mat[0][0] > mat[1][1])&&(mat[0][0] > mat[2][2])) {\n float S = sqrt(1.0 + mat[0][0] - mat[1][1] - mat[2][2]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[1][2] - mat[2][1]) * invS;\n\t qx = 0.25 * S;\n\t qy = (mat[1][0] + mat[0][1]) * invS;\n\t qz = (mat[2][0] + mat[0][2]) * invS;\n } else if (mat[1][1] > mat[2][2]) {\n\t float S = sqrt(1.0 + mat[1][1] - mat[0][0] - mat[2][2]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[2][0] - mat[0][2]) * invS;\n\t qx = (mat[1][0] + mat[0][1]) * invS;\n\t qy = 0.25 * S;\n\t qz = (mat[2][1] + mat[1][2]) * invS;\n } else {\n\t float S = sqrt(1.0 + mat[2][2] - mat[0][0] - mat[1][1]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[0][1] - mat[1][0]) * invS;\n\t qx = (mat[2][0] + mat[0][2]) * invS;\n\t qy = (mat[2][1] + mat[1][2]) * invS;\n\t qz = 0.25 * S;\n }\n return vec4(qx, qy, qz, qw);\n}\nvec4 eulerToQuat(vec3 euler) {\n vec3 er = euler * 0.5;\n float x = er.x, y = er.y, z = er.z;\n float sx = sin(x);\n float cx = cos(x);\n float sy = sin(y);\n float cy = cos(y);\n float sz = sin(z);\n float cz = cos(z);\n vec4 quat;\n quat.x = sx * cy * cz + cx * sy * sz;\n quat.y = cx * sy * cz + sx * cy * sz;\n quat.z = cx * cy * sz - sx * sy * cz;\n quat.w = cx * cy * cz - sx * sy * sz;\n return quat;\n}\nlayout(std140) uniform Constants {\n vec4 mainTiling_Offset;\n vec4 frameTile_velLenScale;\n vec4 scale;\n vec4 nodeRotation;\n};\nlayout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nlayout(std140) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n};\nout mediump vec2 uv;\nout mediump vec4 color;\nvoid computeVertPos (inout vec4 pos, vec2 vertOffset, vec4 q, vec3 s\n#if CC_RENDER_MODE == 0 || CC_RENDER_MODE == 3\n , mat4 viewInv\n#endif\n#if CC_RENDER_MODE == 1\n , vec3 eye\n , vec4 velocity\n , float velocityScale\n , float lengthScale\n , float xIndex\n#endif\n) {\n#if CC_RENDER_MODE == 0\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n vec3 camX = normalize(vec3(viewInv[0][0], viewInv[1][0], viewInv[2][0]));\n vec3 camY = normalize(vec3(viewInv[0][1], viewInv[1][1], viewInv[2][1]));\n vec3 camZ = normalize(vec3(viewInv[0][2], viewInv[1][2], viewInv[2][2]));\n pos.xyz += rotateInLocalSpace(viewSpaceVert, camX, camY, camZ, q);\n#elif CC_RENDER_MODE == 1\n vec3 camRight = normalize(cross(pos.xyz - eye, velocity.xyz)) * s.x;\n vec3 camUp = velocity.xyz * velocityScale + normalize(velocity.xyz) * lengthScale * s.y;\n pos.xyz += (camRight * abs(vertOffset.x) * sign(vertOffset.y)) - camUp * xIndex;\n#elif CC_RENDER_MODE == 2\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n vec3 camX = vec3(1, 0, 0);\n vec3 camY = vec3(0, 0, -1);\n pos.xyz += rotateInLocalSpace(viewSpaceVert, camX, camY, cross(camX, camY), q);\n#elif CC_RENDER_MODE == 3\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n rotateVecFromQuat(viewSpaceVert, q);\n vec3 camX = normalize(vec3(cc_matView[0][0], cc_matView[1][0], cc_matView[2][0]));\n vec3 camY = vec3(0, 1, 0);\n vec3 offset = camX * viewSpaceVert.x + camY * viewSpaceVert.y;\n pos.xyz += offset;\n#else\n pos.x += vertOffset.x;\n pos.y += vertOffset.y;\n#endif\n}\nvec2 computeUV (float frameIndex, vec2 vertIndex, vec2 frameTile){\n vec2 aniUV = vec2(0, floor(frameIndex * frameTile.y));\n aniUV.x = floor(frameIndex * frameTile.x * frameTile.y - aniUV.y * frameTile.x);\n#if CC_RENDER_MODE != 4\n vertIndex.y = 1. - vertIndex.y;\n#endif\n return (aniUV.xy + vertIndex) / vec2(frameTile.x, frameTile.y);\n}\nlayout(std140) uniform SampleConstants {\n vec4 u_sampleInfo;\n};\nlayout(std140) uniform TickConstants {\n vec4 u_worldRot;\n vec4 u_timeDelta;\n};\nin vec4 a_position_starttime;\nin vec4 a_color;\nin vec4 a_dir_life;\nin float a_rndSeed;\n#if !CC_INSTANCE_PARTICLE\n in vec4 a_size_uv;\n in vec4 a_rotation_uv;\n#endif\n#if CC_INSTANCE_PARTICLE\n in vec4 a_size_fid;\n in vec3 a_rotation;\n in vec3 a_uv;\n#endif\n#if CC_RENDER_MODE == 4\n in vec3 a_texCoord;\n in vec3 a_texCoord3;\n in vec3 a_normal;\n in vec4 a_color1;\n#endif\nvec3 unpackCurveData (sampler2D tex, vec2 coord) {\n vec4 a = texture(tex, coord);\n vec4 b = texture(tex, coord + u_sampleInfo.y);\n float c = fract(coord.x * u_sampleInfo.x);\n return mix(a.xyz, b.xyz, c);\n}\nvec3 unpackCurveData (sampler2D tex, vec2 coord, out float w) {\n vec4 a = texture(tex, coord);\n vec4 b = texture(tex, coord + u_sampleInfo.y);\n float c = fract(coord.x * u_sampleInfo.x);\n w = mix(a.w, b.w, c);\n return mix(a.xyz, b.xyz, c);\n}\nfloat pseudoRandom(float x) {\n#if USE_VK_SHADER\n float o = x;\n x = mod(x - 1.0, 2.0) - 1.0;\n float freqVar = 10.16640753482;\n float y = sin(freqVar * floor(o * 0.5 - 0.5));\n float v = max(0.0, 1.0-abs(x));\n v *= 0.7071067812;\n v = y < 0.0 ? -v : v;\n return v;\n#endif\n#if !USE_VK_SHADER\n float seed = mod(x, 233280.);\n float q = (seed * 9301. + 49297.) / 233280.;\n return fract(q);\n#endif\n}\n#if COLOR_OVER_TIME_MODULE_ENABLE\n uniform sampler2D color_over_time_tex0;\n layout(std140) uniform ColorConstant {\n int u_color_mode;\n };\n#endif\n#if ROTATION_OVER_TIME_MODULE_ENABLE\n uniform sampler2D rotation_over_time_tex0;\n layout(std140) uniform RotationConstant {\n int u_rotation_mode;\n };\n#endif\n#if SIZE_OVER_TIME_MODULE_ENABLE\n uniform sampler2D size_over_time_tex0;\n layout(std140) uniform SizeConstant {\n int u_size_mode;\n };\n#endif\n#if FORCE_OVER_TIME_MODULE_ENABLE\n uniform sampler2D force_over_time_tex0;\n layout(std140) uniform ForceConstant {\n int u_force_mode;\n int u_force_space;\n };\n#endif\n#if VELOCITY_OVER_TIME_MODULE_ENABLE\n uniform sampler2D velocity_over_time_tex0;\n layout(std140) uniform VelocityConstant {\n int u_velocity_mode;\n int u_velocity_space;\n };\n#endif\n#if TEXTURE_ANIMATION_MODULE_ENABLE\n uniform sampler2D texture_animation_tex0;\n layout(std140) uniform AnimationConstant {\n vec4 u_anim_info;\n };\n#endif\nfloat repeat (float t, float length) {\n return t - floor(t / length) * length;\n}\nvec4 rotateQuat (vec4 p, vec4 q) {\n vec3 iv = cross(q.xyz, p.xyz) + q.w * p.xyz;\n vec3 res = p.xyz + 2.0 * cross(q.xyz, iv);\n return vec4(res.xyz, p.w);\n}\nvec4 gpvs_main () {\n float activeTime = u_timeDelta.x - a_position_starttime.w;\n float normalizedTime = clamp(activeTime / a_dir_life.w, 0.0, 1.0);\n vec2 timeCoord0 = vec2(normalizedTime, 0.);\n vec2 timeCoord1 = vec2(normalizedTime, 1.);\n #if CC_RENDER_MODE == 4\n vec2 vertIdx = vec2(a_texCoord.x, a_texCoord.y);\n #endif\n #if CC_RENDER_MODE != 4\n #if !CC_INSTANCE_PARTICLE\n vec2 vertIdx = vec2(a_size_uv.w, a_rotation_uv.w);\n #endif\n #if CC_INSTANCE_PARTICLE\n vec2 vertIdx = a_uv.xy;\n #endif\n #endif\n vec4 velocity = vec4(a_dir_life.xyz, 0.);\n vec4 pos = vec4(a_position_starttime.xyz, 1.);\n #if !CC_INSTANCE_PARTICLE\n vec3 size = a_size_uv.xyz;\n #endif\n #if CC_INSTANCE_PARTICLE\n vec3 size = a_size_fid.xyz;\n #endif\n #if SIZE_OVER_TIME_MODULE_ENABLE\n if (u_size_mode == 1) {\n size *= unpackCurveData(size_over_time_tex0, timeCoord0);\n } else {\n vec3 size_0 = unpackCurveData(size_over_time_tex0, timeCoord0);\n vec3 size_1 = unpackCurveData(size_over_time_tex0, timeCoord1);\n float factor_s = pseudoRandom(a_rndSeed + 39825.);\n size *= mix(size_0, size_1, factor_s);\n }\n #endif\n vec3 compScale = scale.xyz * size;\n #if FORCE_OVER_TIME_MODULE_ENABLE\n vec3 forceAnim = vec3(0.);\n if (u_force_mode == 1) {\n forceAnim = unpackCurveData(force_over_time_tex0, timeCoord0);\n } else {\n vec3 force_0 = unpackCurveData(force_over_time_tex0, timeCoord0);\n vec3 force_1 = unpackCurveData(force_over_time_tex0, timeCoord1);\n float factor_f = pseudoRandom(a_rndSeed + 212165.);\n forceAnim = mix(force_0, force_1, factor_f);\n }\n vec4 forceTrack = vec4(forceAnim, 0.);\n if (u_force_space == 0) {\n forceTrack = rotateQuat(forceTrack, u_worldRot);\n }\n velocity.xyz += forceTrack.xyz;\n #endif\n #if VELOCITY_OVER_TIME_MODULE_ENABLE\n float speedModifier0 = 1.;\n float speedModifier1 = 1.;\n vec3 velocityAnim = vec3(0.);\n if (u_velocity_mode == 1) {\n velocityAnim = unpackCurveData(velocity_over_time_tex0, timeCoord0, speedModifier0);\n } else {\n vec3 vectory_0 = unpackCurveData(velocity_over_time_tex0, timeCoord0, speedModifier0);\n vec3 vectory_1 = unpackCurveData(velocity_over_time_tex0, timeCoord1, speedModifier1);\n float factor_v = pseudoRandom(a_rndSeed + 197866.);\n velocityAnim = mix(vectory_0, vectory_1, factor_v);\n speedModifier0 = mix(speedModifier0, speedModifier1, factor_v);\n }\n vec4 velocityTrack = vec4(velocityAnim, 0.);\n if (u_velocity_space == 0) {\n velocityTrack = rotateQuat(velocityTrack, u_worldRot);\n }\n velocity.xyz += velocityTrack.xyz;\n velocity.xyz *= speedModifier0;\n #endif\n pos.xyz += velocity.xyz * normalizedTime * a_dir_life.w;\n #if !CC_USE_WORLD_SPACE\n pos = cc_matWorld * pos;\n #if CC_RENDER_MODE == 1\n velocity = rotateQuat(velocity, u_worldRot);\n #endif\n #endif\n #if !CC_INSTANCE_PARTICLE\n vec3 startRotation = a_rotation_uv.xyz;\n #endif\n #if CC_INSTANCE_PARTICLE\n vec3 startRotation = a_rotation;\n #endif\n #if CC_RENDER_MODE != 4\n #if CC_RENDER_MODE == 0\n vec3 rotEuler = startRotation.xyz;\n #elif CC_RENDER_MODE == 1\n vec3 rotEuler = vec3(0.);\n #endif\n #if CC_RENDER_MODE != 0 && CC_RENDER_MODE != 1\n vec3 rotEuler = vec3(0., 0., startRotation.z);\n #endif\n vec4 rot = quaternionFromEuler(rotEuler);\n #endif\n #if CC_RENDER_MODE == 4\n vec4 rot = quaternionFromEuler(startRotation);\n #endif\n #if ROTATION_OVER_TIME_MODULE_ENABLE\n if (u_rotation_mode == 1) {\n vec3 euler = unpackCurveData(rotation_over_time_tex0, timeCoord0) * normalizedTime * a_dir_life.w;\n vec4 quat = eulerToQuat(euler);\n mat3 mLocal = quatToMat3(quat);\n mat3 mStart = quatToMat3(rot);\n rot = mat3ToQuat(mStart * mLocal);\n } else {\n vec3 rotation_0 = unpackCurveData(rotation_over_time_tex0, timeCoord0);\n vec3 rotation_1 = unpackCurveData(rotation_over_time_tex0, timeCoord1);\n float factor_r = pseudoRandom(a_rndSeed + 125292.);\n vec3 euler = mix(rotation_0, rotation_1, factor_r) * normalizedTime * a_dir_life.w;\n #if CC_RENDER_MODE == 3 || CC_RENDER_MODE == 2\n euler = vec3(0.0, 0.0, euler.z);\n #endif\n vec4 quat = eulerToQuat(euler);\n mat3 mLocal = quatToMat3(quat);\n mat3 mStart = quatToMat3(rot);\n rot = mat3ToQuat(mStart * mLocal);\n }\n #endif\n #if COLOR_OVER_TIME_MODULE_ENABLE\n if (u_color_mode == 1) {\n color = a_color * texture(color_over_time_tex0, timeCoord0);\n } else {\n vec4 color_0 = texture(color_over_time_tex0, timeCoord0);\n vec4 color_1 = texture(color_over_time_tex0, timeCoord1);\n float factor_c = pseudoRandom(a_rndSeed + 91041.);\n color = a_color * mix(color_0, color_1, factor_c);\n }\n #endif\n #if !COLOR_OVER_TIME_MODULE_ENABLE\n color = a_color;\n #endif\n #if CC_RENDER_MODE != 4\n vec2 cornerOffset = vec2((vertIdx - 0.5));\n #if CC_RENDER_MODE == 1\n rot = vec4(0.0, 0.0, 0.0, 1.0);\n #endif\n computeVertPos(pos, cornerOffset, rot, compScale\n #if CC_RENDER_MODE == 0 || CC_RENDER_MODE == 3\n , cc_matViewInv\n #endif\n #if CC_RENDER_MODE == 1\n , cc_cameraPos.xyz\n , velocity\n , frameTile_velLenScale.z\n , frameTile_velLenScale.w\n #if !CC_INSTANCE_PARTICLE\n , a_size_uv.w\n #endif\n #if CC_INSTANCE_PARTICLE\n , a_uv.x\n #endif\n #endif\n );\n #endif\n #if CC_RENDER_MODE == 4\n mat3 rotMat = quatToMat3(rot);\n mat3 nodeMat = quatToMat3(nodeRotation);\n rotMat = nodeMat * rotMat;\n rot = mat3ToQuat(rotMat);\n mat4 xformNoScale = matrixFromRT(rot, pos.xyz);\n mat4 xform = matFromRTS(rot, pos.xyz, compScale);\n pos = xform * vec4(a_texCoord3, 1);\n vec4 normal = xformNoScale * vec4(a_normal, 0);\n color *= a_color1;\n #endif\n pos = cc_matViewProj * pos;\n float frameIndex = 0.;\n #if TEXTURE_ANIMATION_MODULE_ENABLE\n float startFrame = 0.;\n vec3 frameInfo = vec3(0.);\n if (int(u_anim_info.x) == 1) {\n frameInfo = unpackCurveData(texture_animation_tex0, timeCoord0);\n } else {\n vec3 frameInfo0 = unpackCurveData(texture_animation_tex0, timeCoord0);\n vec3 frameInfo1 = unpackCurveData(texture_animation_tex0, timeCoord1);\n float factor_t = pseudoRandom(a_rndSeed + 90794.);\n frameInfo = mix(frameInfo0, frameInfo1, factor_t);\n }\n startFrame = frameInfo.x / u_anim_info.y;\n float EPSILON = 1e-6;\n frameIndex = repeat(u_anim_info.z * (frameInfo.y + startFrame), 1. + EPSILON);\n #endif\n uv = computeUV(frameIndex, vertIdx, frameTile_velLenScale.xy) * mainTiling_Offset.xy + mainTiling_Offset.zw;\n return pos;\n}\nvoid main() { gl_Position = gpvs_main(); }",
  3308. "frag": "\nprecision mediump float;\nlayout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nvec4 CCFragOutput (vec4 color) {\n return color;\n}\nin vec2 uv;\nin vec4 color;\nuniform sampler2D mainTexture;\nvec4 addSmooth () {\n vec4 col = color * texture(mainTexture, uv);\n col.rgb *= col.a;\n return CCFragOutput(col);\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = addSmooth(); }"
  3309. },
  3310. "glsl1": {
  3311. "vert": "\nprecision mediump float;\nvec4 quaternionFromAxis (vec3 xAxis,vec3 yAxis,vec3 zAxis){\n mat3 m = mat3(xAxis,yAxis,zAxis);\n float trace = m[0][0] + m[1][1] + m[2][2];\n vec4 quat;\n if (trace > 0.) {\n float s = 0.5 / sqrt(trace + 1.0);\n quat.w = 0.25 / s;\n quat.x = (m[2][1] - m[1][2]) * s;\n quat.y = (m[0][2] - m[2][0]) * s;\n quat.z = (m[1][0] - m[0][1]) * s;\n } else if ((m[0][0] > m[1][1]) && (m[0][0] > m[2][2])) {\n float s = 2.0 * sqrt(1.0 + m[0][0] - m[1][1] - m[2][2]);\n quat.w = (m[2][1] - m[1][2]) / s;\n quat.x = 0.25 * s;\n quat.y = (m[0][1] + m[1][0]) / s;\n quat.z = (m[0][2] + m[2][0]) / s;\n } else if (m[1][1] > m[2][2]) {\n float s = 2.0 * sqrt(1.0 + m[1][1] - m[0][0] - m[2][2]);\n quat.w = (m[0][2] - m[2][0]) / s;\n quat.x = (m[0][1] + m[1][0]) / s;\n quat.y = 0.25 * s;\n quat.z = (m[1][2] + m[2][1]) / s;\n } else {\n float s = 2.0 * sqrt(1.0 + m[2][2] - m[0][0] - m[1][1]);\n quat.w = (m[1][0] - m[0][1]) / s;\n quat.x = (m[0][2] + m[2][0]) / s;\n quat.y = (m[1][2] + m[2][1]) / s;\n quat.z = 0.25 * s;\n }\n float len = quat.x * quat.x + quat.y * quat.y + quat.z * quat.z + quat.w * quat.w;\n if (len > 0.) {\n len = 1. / sqrt(len);\n quat.x = quat.x * len;\n quat.y = quat.y * len;\n quat.z = quat.z * len;\n quat.w = quat.w * len;\n }\n return quat;\n}\nvec4 quaternionFromEuler (vec3 angle){\n float x = angle.x / 2.;\n float y = angle.y / 2.;\n float z = angle.z / 2.;\n float sx = sin(x);\n float cx = cos(x);\n float sy = sin(y);\n float cy = cos(y);\n float sz = sin(z);\n float cz = cos(z);\n vec4 quat = vec4(0);\n quat.x = sx * cy * cz + cx * sy * sz;\n quat.y = cx * sy * cz + sx * cy * sz;\n quat.z = cx * cy * sz - sx * sy * cz;\n quat.w = cx * cy * cz - sx * sy * sz;\n return quat;\n}\nmat4 matrixFromRT (vec4 q, vec3 p){\n float x2 = q.x + q.x;\n float y2 = q.y + q.y;\n float z2 = q.z + q.z;\n float xx = q.x * x2;\n float xy = q.x * y2;\n float xz = q.x * z2;\n float yy = q.y * y2;\n float yz = q.y * z2;\n float zz = q.z * z2;\n float wx = q.w * x2;\n float wy = q.w * y2;\n float wz = q.w * z2;\n return mat4(\n 1. - (yy + zz), xy + wz, xz - wy, 0,\n xy - wz, 1. - (xx + zz), yz + wx, 0,\n xz + wy, yz - wx, 1. - (xx + yy), 0,\n p.x, p.y, p.z, 1\n );\n}\nmat4 matFromRTS (vec4 q, vec3 t, vec3 s){\n float x = q.x, y = q.y, z = q.z, w = q.w;\n float x2 = x + x;\n float y2 = y + y;\n float z2 = z + z;\n float xx = x * x2;\n float xy = x * y2;\n float xz = x * z2;\n float yy = y * y2;\n float yz = y * z2;\n float zz = z * z2;\n float wx = w * x2;\n float wy = w * y2;\n float wz = w * z2;\n float sx = s.x;\n float sy = s.y;\n float sz = s.z;\n return mat4((1. - (yy + zz)) * sx, (xy + wz) * sx, (xz - wy) * sx, 0,\n (xy - wz) * sy, (1. - (xx + zz)) * sy, (yz + wx) * sy, 0,\n (xz + wy) * sz, (yz - wx) * sz, (1. - (xx + yy)) * sz, 0,\n t.x, t.y, t.z, 1);\n}\nvec4 quatMultiply (vec4 a, vec4 b){\n vec4 quat;\n quat.x = a.x * b.w + a.w * b.x + a.y * b.z - a.z * b.y;\n quat.y = a.y * b.w + a.w * b.y + a.z * b.x - a.x * b.z;\n quat.z = a.z * b.w + a.w * b.z + a.x * b.y - a.y * b.x;\n quat.w = a.w * b.w - a.x * b.x - a.y * b.y - a.z * b.z;\n return quat;\n}\nvoid rotateVecFromQuat (inout vec3 v, vec4 q){\n float ix = q.w * v.x + q.y * v.z - q.z * v.y;\n float iy = q.w * v.y + q.z * v.x - q.x * v.z;\n float iz = q.w * v.z + q.x * v.y - q.y * v.x;\n float iw = -q.x * v.x - q.y * v.y - q.z * v.z;\n v.x = ix * q.w + iw * -q.x + iy * -q.z - iz * -q.y;\n v.y = iy * q.w + iw * -q.y + iz * -q.x - ix * -q.z;\n v.z = iz * q.w + iw * -q.z + ix * -q.y - iy * -q.x;\n}\nvec3 rotateInLocalSpace (vec3 pos, vec3 xAxis, vec3 yAxis, vec3 zAxis, vec4 q){\n vec4 viewQuat = quaternionFromAxis(xAxis, yAxis, zAxis);\n vec4 rotQuat = quatMultiply(viewQuat, q);\n rotateVecFromQuat(pos, rotQuat);\n return pos;\n}\nmat3 quatToMat3(vec4 q) {\n vec3 m0 = vec3(\n 1.0 - 2.0 * q.y * q.y - 2.0 * q.z * q.z,\n 2.0 * q.x * q.y + 2.0 * q.w * q.z,\n 2.0 * q.x * q.z - 2.0 * q.w * q.y);\n\tvec3 m1 = vec3(\n 2.0 * q.x * q.y - 2.0 * q.w * q.z,\n 1.0 - 2.0 * q.x * q.x - 2.0 * q.z * q.z,\n 2.0 * q.y * q.z + 2.0 * q.w * q.x);\n\tvec3 m2 = vec3(\n 2.0 * q.x * q.z + 2.0 * q.w * q.y,\n 2.0 * q.y * q.z - 2.0 * q.w * q.x,\n 1.0 - 2.0 * q.x * q.x - 2.0 * q.y * q.y);\n return mat3(m0, m1, m2);\n}\nvec4 mat3ToQuat(mat3 mat) {\n float tr = mat[0][0] + mat[1][1] + mat[2][2];\n\tfloat qw, qx, qy, qz;\n if (tr > 0.0) {\n float S = sqrt(tr + 1.0) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = 0.25 * S;\n\t qx = (mat[1][2] - mat[2][1]) * invS;\n\t qy = (mat[2][0] - mat[0][2]) * invS;\n\t qz = (mat[0][1] - mat[1][0]) * invS;\n } else if ((mat[0][0] > mat[1][1])&&(mat[0][0] > mat[2][2])) {\n float S = sqrt(1.0 + mat[0][0] - mat[1][1] - mat[2][2]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[1][2] - mat[2][1]) * invS;\n\t qx = 0.25 * S;\n\t qy = (mat[1][0] + mat[0][1]) * invS;\n\t qz = (mat[2][0] + mat[0][2]) * invS;\n } else if (mat[1][1] > mat[2][2]) {\n\t float S = sqrt(1.0 + mat[1][1] - mat[0][0] - mat[2][2]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[2][0] - mat[0][2]) * invS;\n\t qx = (mat[1][0] + mat[0][1]) * invS;\n\t qy = 0.25 * S;\n\t qz = (mat[2][1] + mat[1][2]) * invS;\n } else {\n\t float S = sqrt(1.0 + mat[2][2] - mat[0][0] - mat[1][1]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[0][1] - mat[1][0]) * invS;\n\t qx = (mat[2][0] + mat[0][2]) * invS;\n\t qy = (mat[2][1] + mat[1][2]) * invS;\n\t qz = 0.25 * S;\n }\n return vec4(qx, qy, qz, qw);\n}\nvec4 eulerToQuat(vec3 euler) {\n vec3 er = euler * 0.5;\n float x = er.x, y = er.y, z = er.z;\n float sx = sin(x);\n float cx = cos(x);\n float sy = sin(y);\n float cy = cos(y);\n float sz = sin(z);\n float cz = cos(z);\n vec4 quat;\n quat.x = sx * cy * cz + cx * sy * sz;\n quat.y = cx * sy * cz + sx * cy * sz;\n quat.z = cx * cy * sz - sx * sy * cz;\n quat.w = cx * cy * cz - sx * sy * sz;\n return quat;\n}\n uniform vec4 mainTiling_Offset;\n uniform vec4 frameTile_velLenScale;\n uniform vec4 scale;\n uniform vec4 nodeRotation;\nuniform highp mat4 cc_matView;\n uniform highp mat4 cc_matViewInv;\n uniform highp mat4 cc_matViewProj;\n uniform highp vec4 cc_cameraPos;\nuniform highp mat4 cc_matWorld;\nvarying mediump vec2 uv;\nvarying mediump vec4 color;\nvoid computeVertPos (inout vec4 pos, vec2 vertOffset, vec4 q, vec3 s\n#if CC_RENDER_MODE == 0 || CC_RENDER_MODE == 3\n , mat4 viewInv\n#endif\n#if CC_RENDER_MODE == 1\n , vec3 eye\n , vec4 velocity\n , float velocityScale\n , float lengthScale\n , float xIndex\n#endif\n) {\n#if CC_RENDER_MODE == 0\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n vec3 camX = normalize(vec3(viewInv[0][0], viewInv[1][0], viewInv[2][0]));\n vec3 camY = normalize(vec3(viewInv[0][1], viewInv[1][1], viewInv[2][1]));\n vec3 camZ = normalize(vec3(viewInv[0][2], viewInv[1][2], viewInv[2][2]));\n pos.xyz += rotateInLocalSpace(viewSpaceVert, camX, camY, camZ, q);\n#elif CC_RENDER_MODE == 1\n vec3 camRight = normalize(cross(pos.xyz - eye, velocity.xyz)) * s.x;\n vec3 camUp = velocity.xyz * velocityScale + normalize(velocity.xyz) * lengthScale * s.y;\n pos.xyz += (camRight * abs(vertOffset.x) * sign(vertOffset.y)) - camUp * xIndex;\n#elif CC_RENDER_MODE == 2\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n vec3 camX = vec3(1, 0, 0);\n vec3 camY = vec3(0, 0, -1);\n pos.xyz += rotateInLocalSpace(viewSpaceVert, camX, camY, cross(camX, camY), q);\n#elif CC_RENDER_MODE == 3\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n rotateVecFromQuat(viewSpaceVert, q);\n vec3 camX = normalize(vec3(cc_matView[0][0], cc_matView[1][0], cc_matView[2][0]));\n vec3 camY = vec3(0, 1, 0);\n vec3 offset = camX * viewSpaceVert.x + camY * viewSpaceVert.y;\n pos.xyz += offset;\n#else\n pos.x += vertOffset.x;\n pos.y += vertOffset.y;\n#endif\n}\nvec2 computeUV (float frameIndex, vec2 vertIndex, vec2 frameTile){\n vec2 aniUV = vec2(0, floor(frameIndex * frameTile.y));\n aniUV.x = floor(frameIndex * frameTile.x * frameTile.y - aniUV.y * frameTile.x);\n#if CC_RENDER_MODE != 4\n vertIndex.y = 1. - vertIndex.y;\n#endif\n return (aniUV.xy + vertIndex) / vec2(frameTile.x, frameTile.y);\n}\n uniform vec4 u_sampleInfo;\n uniform vec4 u_worldRot;\n uniform vec4 u_timeDelta;\nattribute vec4 a_position_starttime;\nattribute vec4 a_color;\nattribute vec4 a_dir_life;\nattribute float a_rndSeed;\n#if !CC_INSTANCE_PARTICLE\n attribute vec4 a_size_uv;\n attribute vec4 a_rotation_uv;\n#endif\n#if CC_INSTANCE_PARTICLE\n attribute vec4 a_size_fid;\n attribute vec3 a_rotation;\n attribute vec3 a_uv;\n#endif\n#if CC_RENDER_MODE == 4\n attribute vec3 a_texCoord;\n attribute vec3 a_texCoord3;\n attribute vec3 a_normal;\n attribute vec4 a_color1;\n#endif\nvec3 unpackCurveData (sampler2D tex, vec2 coord) {\n vec4 a = texture2D(tex, coord);\n vec4 b = texture2D(tex, coord + u_sampleInfo.y);\n float c = fract(coord.x * u_sampleInfo.x);\n return mix(a.xyz, b.xyz, c);\n}\nvec3 unpackCurveData (sampler2D tex, vec2 coord, out float w) {\n vec4 a = texture2D(tex, coord);\n vec4 b = texture2D(tex, coord + u_sampleInfo.y);\n float c = fract(coord.x * u_sampleInfo.x);\n w = mix(a.w, b.w, c);\n return mix(a.xyz, b.xyz, c);\n}\nfloat pseudoRandom(float x) {\n#if USE_VK_SHADER\n float o = x;\n x = mod(x - 1.0, 2.0) - 1.0;\n float freqVar = 10.16640753482;\n float y = sin(freqVar * floor(o * 0.5 - 0.5));\n float v = max(0.0, 1.0-abs(x));\n v *= 0.7071067812;\n v = y < 0.0 ? -v : v;\n return v;\n#endif\n#if !USE_VK_SHADER\n float seed = mod(x, 233280.);\n float q = (seed * 9301. + 49297.) / 233280.;\n return fract(q);\n#endif\n}\n#if COLOR_OVER_TIME_MODULE_ENABLE\n uniform sampler2D color_over_time_tex0;\n uniform int u_color_mode;\n#endif\n#if ROTATION_OVER_TIME_MODULE_ENABLE\n uniform sampler2D rotation_over_time_tex0;\n uniform int u_rotation_mode;\n#endif\n#if SIZE_OVER_TIME_MODULE_ENABLE\n uniform sampler2D size_over_time_tex0;\n uniform int u_size_mode;\n#endif\n#if FORCE_OVER_TIME_MODULE_ENABLE\n uniform sampler2D force_over_time_tex0;\n uniform int u_force_mode;\n uniform int u_force_space;\n#endif\n#if VELOCITY_OVER_TIME_MODULE_ENABLE\n uniform sampler2D velocity_over_time_tex0;\n uniform int u_velocity_mode;\n uniform int u_velocity_space;\n#endif\n#if TEXTURE_ANIMATION_MODULE_ENABLE\n uniform sampler2D texture_animation_tex0;\n uniform vec4 u_anim_info;\n#endif\nfloat repeat (float t, float length) {\n return t - floor(t / length) * length;\n}\nvec4 rotateQuat (vec4 p, vec4 q) {\n vec3 iv = cross(q.xyz, p.xyz) + q.w * p.xyz;\n vec3 res = p.xyz + 2.0 * cross(q.xyz, iv);\n return vec4(res.xyz, p.w);\n}\nvec4 gpvs_main () {\n float activeTime = u_timeDelta.x - a_position_starttime.w;\n float normalizedTime = clamp(activeTime / a_dir_life.w, 0.0, 1.0);\n vec2 timeCoord0 = vec2(normalizedTime, 0.);\n vec2 timeCoord1 = vec2(normalizedTime, 1.);\n #if CC_RENDER_MODE == 4\n vec2 vertIdx = vec2(a_texCoord.x, a_texCoord.y);\n #endif\n #if CC_RENDER_MODE != 4\n #if !CC_INSTANCE_PARTICLE\n vec2 vertIdx = vec2(a_size_uv.w, a_rotation_uv.w);\n #endif\n #if CC_INSTANCE_PARTICLE\n vec2 vertIdx = a_uv.xy;\n #endif\n #endif\n vec4 velocity = vec4(a_dir_life.xyz, 0.);\n vec4 pos = vec4(a_position_starttime.xyz, 1.);\n #if !CC_INSTANCE_PARTICLE\n vec3 size = a_size_uv.xyz;\n #endif\n #if CC_INSTANCE_PARTICLE\n vec3 size = a_size_fid.xyz;\n #endif\n #if SIZE_OVER_TIME_MODULE_ENABLE\n if (u_size_mode == 1) {\n size *= unpackCurveData(size_over_time_tex0, timeCoord0);\n } else {\n vec3 size_0 = unpackCurveData(size_over_time_tex0, timeCoord0);\n vec3 size_1 = unpackCurveData(size_over_time_tex0, timeCoord1);\n float factor_s = pseudoRandom(a_rndSeed + 39825.);\n size *= mix(size_0, size_1, factor_s);\n }\n #endif\n vec3 compScale = scale.xyz * size;\n #if FORCE_OVER_TIME_MODULE_ENABLE\n vec3 forceAnim = vec3(0.);\n if (u_force_mode == 1) {\n forceAnim = unpackCurveData(force_over_time_tex0, timeCoord0);\n } else {\n vec3 force_0 = unpackCurveData(force_over_time_tex0, timeCoord0);\n vec3 force_1 = unpackCurveData(force_over_time_tex0, timeCoord1);\n float factor_f = pseudoRandom(a_rndSeed + 212165.);\n forceAnim = mix(force_0, force_1, factor_f);\n }\n vec4 forceTrack = vec4(forceAnim, 0.);\n if (u_force_space == 0) {\n forceTrack = rotateQuat(forceTrack, u_worldRot);\n }\n velocity.xyz += forceTrack.xyz;\n #endif\n #if VELOCITY_OVER_TIME_MODULE_ENABLE\n float speedModifier0 = 1.;\n float speedModifier1 = 1.;\n vec3 velocityAnim = vec3(0.);\n if (u_velocity_mode == 1) {\n velocityAnim = unpackCurveData(velocity_over_time_tex0, timeCoord0, speedModifier0);\n } else {\n vec3 vectory_0 = unpackCurveData(velocity_over_time_tex0, timeCoord0, speedModifier0);\n vec3 vectory_1 = unpackCurveData(velocity_over_time_tex0, timeCoord1, speedModifier1);\n float factor_v = pseudoRandom(a_rndSeed + 197866.);\n velocityAnim = mix(vectory_0, vectory_1, factor_v);\n speedModifier0 = mix(speedModifier0, speedModifier1, factor_v);\n }\n vec4 velocityTrack = vec4(velocityAnim, 0.);\n if (u_velocity_space == 0) {\n velocityTrack = rotateQuat(velocityTrack, u_worldRot);\n }\n velocity.xyz += velocityTrack.xyz;\n velocity.xyz *= speedModifier0;\n #endif\n pos.xyz += velocity.xyz * normalizedTime * a_dir_life.w;\n #if !CC_USE_WORLD_SPACE\n pos = cc_matWorld * pos;\n #if CC_RENDER_MODE == 1\n velocity = rotateQuat(velocity, u_worldRot);\n #endif\n #endif\n #if !CC_INSTANCE_PARTICLE\n vec3 startRotation = a_rotation_uv.xyz;\n #endif\n #if CC_INSTANCE_PARTICLE\n vec3 startRotation = a_rotation;\n #endif\n #if CC_RENDER_MODE != 4\n #if CC_RENDER_MODE == 0\n vec3 rotEuler = startRotation.xyz;\n #elif CC_RENDER_MODE == 1\n vec3 rotEuler = vec3(0.);\n #endif\n #if CC_RENDER_MODE != 0 && CC_RENDER_MODE != 1\n vec3 rotEuler = vec3(0., 0., startRotation.z);\n #endif\n vec4 rot = quaternionFromEuler(rotEuler);\n #endif\n #if CC_RENDER_MODE == 4\n vec4 rot = quaternionFromEuler(startRotation);\n #endif\n #if ROTATION_OVER_TIME_MODULE_ENABLE\n if (u_rotation_mode == 1) {\n vec3 euler = unpackCurveData(rotation_over_time_tex0, timeCoord0) * normalizedTime * a_dir_life.w;\n vec4 quat = eulerToQuat(euler);\n mat3 mLocal = quatToMat3(quat);\n mat3 mStart = quatToMat3(rot);\n rot = mat3ToQuat(mStart * mLocal);\n } else {\n vec3 rotation_0 = unpackCurveData(rotation_over_time_tex0, timeCoord0);\n vec3 rotation_1 = unpackCurveData(rotation_over_time_tex0, timeCoord1);\n float factor_r = pseudoRandom(a_rndSeed + 125292.);\n vec3 euler = mix(rotation_0, rotation_1, factor_r) * normalizedTime * a_dir_life.w;\n #if CC_RENDER_MODE == 3 || CC_RENDER_MODE == 2\n euler = vec3(0.0, 0.0, euler.z);\n #endif\n vec4 quat = eulerToQuat(euler);\n mat3 mLocal = quatToMat3(quat);\n mat3 mStart = quatToMat3(rot);\n rot = mat3ToQuat(mStart * mLocal);\n }\n #endif\n #if COLOR_OVER_TIME_MODULE_ENABLE\n if (u_color_mode == 1) {\n color = a_color * texture2D(color_over_time_tex0, timeCoord0);\n } else {\n vec4 color_0 = texture2D(color_over_time_tex0, timeCoord0);\n vec4 color_1 = texture2D(color_over_time_tex0, timeCoord1);\n float factor_c = pseudoRandom(a_rndSeed + 91041.);\n color = a_color * mix(color_0, color_1, factor_c);\n }\n #endif\n #if !COLOR_OVER_TIME_MODULE_ENABLE\n color = a_color;\n #endif\n #if CC_RENDER_MODE != 4\n vec2 cornerOffset = vec2((vertIdx - 0.5));\n #if CC_RENDER_MODE == 1\n rot = vec4(0.0, 0.0, 0.0, 1.0);\n #endif\n computeVertPos(pos, cornerOffset, rot, compScale\n #if CC_RENDER_MODE == 0 || CC_RENDER_MODE == 3\n , cc_matViewInv\n #endif\n #if CC_RENDER_MODE == 1\n , cc_cameraPos.xyz\n , velocity\n , frameTile_velLenScale.z\n , frameTile_velLenScale.w\n #if !CC_INSTANCE_PARTICLE\n , a_size_uv.w\n #endif\n #if CC_INSTANCE_PARTICLE\n , a_uv.x\n #endif\n #endif\n );\n #endif\n #if CC_RENDER_MODE == 4\n mat3 rotMat = quatToMat3(rot);\n mat3 nodeMat = quatToMat3(nodeRotation);\n rotMat = nodeMat * rotMat;\n rot = mat3ToQuat(rotMat);\n mat4 xformNoScale = matrixFromRT(rot, pos.xyz);\n mat4 xform = matFromRTS(rot, pos.xyz, compScale);\n pos = xform * vec4(a_texCoord3, 1);\n vec4 normal = xformNoScale * vec4(a_normal, 0);\n color *= a_color1;\n #endif\n pos = cc_matViewProj * pos;\n float frameIndex = 0.;\n #if TEXTURE_ANIMATION_MODULE_ENABLE\n float startFrame = 0.;\n vec3 frameInfo = vec3(0.);\n if (int(u_anim_info.x) == 1) {\n frameInfo = unpackCurveData(texture_animation_tex0, timeCoord0);\n } else {\n vec3 frameInfo0 = unpackCurveData(texture_animation_tex0, timeCoord0);\n vec3 frameInfo1 = unpackCurveData(texture_animation_tex0, timeCoord1);\n float factor_t = pseudoRandom(a_rndSeed + 90794.);\n frameInfo = mix(frameInfo0, frameInfo1, factor_t);\n }\n startFrame = frameInfo.x / u_anim_info.y;\n float EPSILON = 1e-6;\n frameIndex = repeat(u_anim_info.z * (frameInfo.y + startFrame), 1. + EPSILON);\n #endif\n uv = computeUV(frameIndex, vertIdx, frameTile_velLenScale.xy) * mainTiling_Offset.xy + mainTiling_Offset.zw;\n return pos;\n}\nvoid main() { gl_Position = gpvs_main(); }",
  3312. "frag": "\nprecision mediump float;\nvec4 CCFragOutput (vec4 color) {\n return color;\n}\nvarying vec2 uv;\nvarying vec4 color;\nuniform sampler2D mainTexture;\nvec4 addSmooth () {\n vec4 col = color * texture2D(mainTexture, uv);\n col.rgb *= col.a;\n return CCFragOutput(col);\n}\nvoid main() { gl_FragColor = addSmooth(); }"
  3313. },
  3314. "builtins": {
  3315. "globals": {
  3316. "blocks": [
  3317. {
  3318. "name": "CCGlobal",
  3319. "defines": []
  3320. },
  3321. {
  3322. "name": "CCCamera",
  3323. "defines": []
  3324. }
  3325. ],
  3326. "samplerTextures": [],
  3327. "buffers": [],
  3328. "images": []
  3329. },
  3330. "locals": {
  3331. "blocks": [
  3332. {
  3333. "name": "CCLocal",
  3334. "defines": []
  3335. }
  3336. ],
  3337. "samplerTextures": [],
  3338. "buffers": [],
  3339. "images": []
  3340. },
  3341. "statistics": {
  3342. "CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS": 71,
  3343. "CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS": 42
  3344. }
  3345. },
  3346. "defines": [
  3347. {
  3348. "name": "CC_RENDER_MODE",
  3349. "type": "number",
  3350. "defines": [],
  3351. "range": [
  3352. 0,
  3353. 4
  3354. ]
  3355. },
  3356. {
  3357. "name": "CC_INSTANCE_PARTICLE",
  3358. "type": "boolean",
  3359. "defines": []
  3360. },
  3361. {
  3362. "name": "USE_VK_SHADER",
  3363. "type": "boolean",
  3364. "defines": []
  3365. },
  3366. {
  3367. "name": "COLOR_OVER_TIME_MODULE_ENABLE",
  3368. "type": "boolean",
  3369. "defines": []
  3370. },
  3371. {
  3372. "name": "ROTATION_OVER_TIME_MODULE_ENABLE",
  3373. "type": "boolean",
  3374. "defines": []
  3375. },
  3376. {
  3377. "name": "SIZE_OVER_TIME_MODULE_ENABLE",
  3378. "type": "boolean",
  3379. "defines": []
  3380. },
  3381. {
  3382. "name": "FORCE_OVER_TIME_MODULE_ENABLE",
  3383. "type": "boolean",
  3384. "defines": []
  3385. },
  3386. {
  3387. "name": "VELOCITY_OVER_TIME_MODULE_ENABLE",
  3388. "type": "boolean",
  3389. "defines": []
  3390. },
  3391. {
  3392. "name": "TEXTURE_ANIMATION_MODULE_ENABLE",
  3393. "type": "boolean",
  3394. "defines": []
  3395. },
  3396. {
  3397. "name": "CC_USE_WORLD_SPACE",
  3398. "type": "boolean",
  3399. "defines": []
  3400. }
  3401. ],
  3402. "name": "particles/builtin-particle-gpu|builtin/internal/particle-vs-gpu:gpvs_main|no-tint-fs:addSmooth"
  3403. },
  3404. {
  3405. "blocks": [
  3406. {
  3407. "name": "Constants",
  3408. "members": [
  3409. {
  3410. "name": "mainTiling_Offset",
  3411. "type": 16,
  3412. "count": 1
  3413. },
  3414. {
  3415. "name": "frameTile_velLenScale",
  3416. "type": 16,
  3417. "count": 1
  3418. },
  3419. {
  3420. "name": "scale",
  3421. "type": 16,
  3422. "count": 1
  3423. },
  3424. {
  3425. "name": "nodeRotation",
  3426. "type": 16,
  3427. "count": 1
  3428. }
  3429. ],
  3430. "defines": [],
  3431. "stageFlags": 1,
  3432. "binding": 0
  3433. },
  3434. {
  3435. "name": "SampleConstants",
  3436. "members": [
  3437. {
  3438. "name": "u_sampleInfo",
  3439. "type": 16,
  3440. "count": 1
  3441. }
  3442. ],
  3443. "defines": [],
  3444. "stageFlags": 1,
  3445. "binding": 1
  3446. },
  3447. {
  3448. "name": "TickConstants",
  3449. "members": [
  3450. {
  3451. "name": "u_worldRot",
  3452. "type": 16,
  3453. "count": 1
  3454. },
  3455. {
  3456. "name": "u_timeDelta",
  3457. "type": 16,
  3458. "count": 1
  3459. }
  3460. ],
  3461. "defines": [],
  3462. "stageFlags": 1,
  3463. "binding": 2
  3464. },
  3465. {
  3466. "name": "ColorConstant",
  3467. "members": [
  3468. {
  3469. "name": "u_color_mode",
  3470. "type": 5,
  3471. "count": 1
  3472. }
  3473. ],
  3474. "defines": [
  3475. "COLOR_OVER_TIME_MODULE_ENABLE"
  3476. ],
  3477. "stageFlags": 1,
  3478. "binding": 3
  3479. },
  3480. {
  3481. "name": "RotationConstant",
  3482. "members": [
  3483. {
  3484. "name": "u_rotation_mode",
  3485. "type": 5,
  3486. "count": 1
  3487. }
  3488. ],
  3489. "defines": [
  3490. "ROTATION_OVER_TIME_MODULE_ENABLE"
  3491. ],
  3492. "stageFlags": 1,
  3493. "binding": 4
  3494. },
  3495. {
  3496. "name": "SizeConstant",
  3497. "members": [
  3498. {
  3499. "name": "u_size_mode",
  3500. "type": 5,
  3501. "count": 1
  3502. }
  3503. ],
  3504. "defines": [
  3505. "SIZE_OVER_TIME_MODULE_ENABLE"
  3506. ],
  3507. "stageFlags": 1,
  3508. "binding": 5
  3509. },
  3510. {
  3511. "name": "ForceConstant",
  3512. "members": [
  3513. {
  3514. "name": "u_force_mode",
  3515. "type": 5,
  3516. "count": 1
  3517. },
  3518. {
  3519. "name": "u_force_space",
  3520. "type": 5,
  3521. "count": 1
  3522. }
  3523. ],
  3524. "defines": [
  3525. "FORCE_OVER_TIME_MODULE_ENABLE"
  3526. ],
  3527. "stageFlags": 1,
  3528. "binding": 6
  3529. },
  3530. {
  3531. "name": "VelocityConstant",
  3532. "members": [
  3533. {
  3534. "name": "u_velocity_mode",
  3535. "type": 5,
  3536. "count": 1
  3537. },
  3538. {
  3539. "name": "u_velocity_space",
  3540. "type": 5,
  3541. "count": 1
  3542. }
  3543. ],
  3544. "defines": [
  3545. "VELOCITY_OVER_TIME_MODULE_ENABLE"
  3546. ],
  3547. "stageFlags": 1,
  3548. "binding": 7
  3549. },
  3550. {
  3551. "name": "AnimationConstant",
  3552. "members": [
  3553. {
  3554. "name": "u_anim_info",
  3555. "type": 16,
  3556. "count": 1
  3557. }
  3558. ],
  3559. "defines": [
  3560. "TEXTURE_ANIMATION_MODULE_ENABLE"
  3561. ],
  3562. "stageFlags": 1,
  3563. "binding": 8
  3564. }
  3565. ],
  3566. "samplerTextures": [
  3567. {
  3568. "name": "color_over_time_tex0",
  3569. "type": 28,
  3570. "count": 1,
  3571. "defines": [
  3572. "COLOR_OVER_TIME_MODULE_ENABLE"
  3573. ],
  3574. "stageFlags": 1,
  3575. "binding": 9
  3576. },
  3577. {
  3578. "name": "rotation_over_time_tex0",
  3579. "type": 28,
  3580. "count": 1,
  3581. "defines": [
  3582. "ROTATION_OVER_TIME_MODULE_ENABLE"
  3583. ],
  3584. "stageFlags": 1,
  3585. "binding": 10
  3586. },
  3587. {
  3588. "name": "size_over_time_tex0",
  3589. "type": 28,
  3590. "count": 1,
  3591. "defines": [
  3592. "SIZE_OVER_TIME_MODULE_ENABLE"
  3593. ],
  3594. "stageFlags": 1,
  3595. "binding": 11
  3596. },
  3597. {
  3598. "name": "force_over_time_tex0",
  3599. "type": 28,
  3600. "count": 1,
  3601. "defines": [
  3602. "FORCE_OVER_TIME_MODULE_ENABLE"
  3603. ],
  3604. "stageFlags": 1,
  3605. "binding": 12
  3606. },
  3607. {
  3608. "name": "velocity_over_time_tex0",
  3609. "type": 28,
  3610. "count": 1,
  3611. "defines": [
  3612. "VELOCITY_OVER_TIME_MODULE_ENABLE"
  3613. ],
  3614. "stageFlags": 1,
  3615. "binding": 13
  3616. },
  3617. {
  3618. "name": "texture_animation_tex0",
  3619. "type": 28,
  3620. "count": 1,
  3621. "defines": [
  3622. "TEXTURE_ANIMATION_MODULE_ENABLE"
  3623. ],
  3624. "stageFlags": 1,
  3625. "binding": 14
  3626. },
  3627. {
  3628. "name": "mainTexture",
  3629. "type": 28,
  3630. "count": 1,
  3631. "defines": [],
  3632. "stageFlags": 16,
  3633. "binding": 15
  3634. }
  3635. ],
  3636. "samplers": [],
  3637. "textures": [],
  3638. "buffers": [],
  3639. "images": [],
  3640. "subpassInputs": [],
  3641. "attributes": [
  3642. {
  3643. "name": "a_position_starttime",
  3644. "defines": [],
  3645. "format": 44,
  3646. "location": 0
  3647. },
  3648. {
  3649. "name": "a_color",
  3650. "defines": [],
  3651. "format": 44,
  3652. "location": 1
  3653. },
  3654. {
  3655. "name": "a_dir_life",
  3656. "defines": [],
  3657. "format": 44,
  3658. "location": 2
  3659. },
  3660. {
  3661. "name": "a_rndSeed",
  3662. "defines": [],
  3663. "format": 11,
  3664. "location": 3
  3665. },
  3666. {
  3667. "name": "a_size_uv",
  3668. "defines": [
  3669. "!CC_INSTANCE_PARTICLE"
  3670. ],
  3671. "format": 44,
  3672. "location": 4
  3673. },
  3674. {
  3675. "name": "a_rotation_uv",
  3676. "defines": [
  3677. "!CC_INSTANCE_PARTICLE"
  3678. ],
  3679. "format": 44,
  3680. "location": 5
  3681. },
  3682. {
  3683. "name": "a_size_fid",
  3684. "defines": [
  3685. "CC_INSTANCE_PARTICLE"
  3686. ],
  3687. "format": 44,
  3688. "location": 6
  3689. },
  3690. {
  3691. "name": "a_rotation",
  3692. "defines": [
  3693. "CC_INSTANCE_PARTICLE"
  3694. ],
  3695. "format": 32,
  3696. "location": 7
  3697. },
  3698. {
  3699. "name": "a_uv",
  3700. "defines": [
  3701. "CC_INSTANCE_PARTICLE"
  3702. ],
  3703. "format": 32,
  3704. "location": 8
  3705. },
  3706. {
  3707. "name": "a_texCoord",
  3708. "defines": [
  3709. "CC_RENDER_MODE"
  3710. ],
  3711. "format": 32,
  3712. "location": 9
  3713. },
  3714. {
  3715. "name": "a_texCoord3",
  3716. "defines": [
  3717. "CC_RENDER_MODE"
  3718. ],
  3719. "format": 32,
  3720. "location": 10
  3721. },
  3722. {
  3723. "name": "a_normal",
  3724. "defines": [
  3725. "CC_RENDER_MODE"
  3726. ],
  3727. "format": 32,
  3728. "location": 11
  3729. },
  3730. {
  3731. "name": "a_color1",
  3732. "defines": [
  3733. "CC_RENDER_MODE"
  3734. ],
  3735. "format": 44,
  3736. "location": 12
  3737. }
  3738. ],
  3739. "varyings": [
  3740. {
  3741. "name": "uv",
  3742. "type": 14,
  3743. "count": 1,
  3744. "defines": [],
  3745. "stageFlags": 17,
  3746. "location": 0
  3747. },
  3748. {
  3749. "name": "color",
  3750. "type": 16,
  3751. "count": 1,
  3752. "defines": [],
  3753. "stageFlags": 17,
  3754. "location": 1
  3755. }
  3756. ],
  3757. "fragColors": [
  3758. {
  3759. "name": "cc_FragColor",
  3760. "typename": "vec4",
  3761. "type": 16,
  3762. "count": 1,
  3763. "defines": [],
  3764. "stageFlags": 16,
  3765. "location": 0
  3766. }
  3767. ],
  3768. "descriptors": [
  3769. {
  3770. "rate": 0,
  3771. "blocks": [
  3772. {
  3773. "tags": {
  3774. "builtin": "local"
  3775. },
  3776. "name": "CCLocal",
  3777. "members": [
  3778. {
  3779. "name": "cc_matWorld",
  3780. "typename": "mat4",
  3781. "type": 25,
  3782. "count": 1,
  3783. "precision": "highp "
  3784. },
  3785. {
  3786. "name": "cc_matWorldIT",
  3787. "typename": "mat4",
  3788. "type": 25,
  3789. "count": 1,
  3790. "precision": "highp "
  3791. },
  3792. {
  3793. "name": "cc_lightingMapUVParam",
  3794. "typename": "vec4",
  3795. "type": 16,
  3796. "count": 1,
  3797. "precision": "highp "
  3798. },
  3799. {
  3800. "name": "cc_localShadowBias",
  3801. "typename": "vec4",
  3802. "type": 16,
  3803. "count": 1,
  3804. "precision": "highp "
  3805. },
  3806. {
  3807. "name": "cc_reflectionProbeData1",
  3808. "typename": "vec4",
  3809. "type": 16,
  3810. "count": 1,
  3811. "precision": "highp "
  3812. },
  3813. {
  3814. "name": "cc_reflectionProbeData2",
  3815. "typename": "vec4",
  3816. "type": 16,
  3817. "count": 1,
  3818. "precision": "highp "
  3819. },
  3820. {
  3821. "name": "cc_reflectionProbeBlendData1",
  3822. "typename": "vec4",
  3823. "type": 16,
  3824. "count": 1,
  3825. "precision": "highp "
  3826. },
  3827. {
  3828. "name": "cc_reflectionProbeBlendData2",
  3829. "typename": "vec4",
  3830. "type": 16,
  3831. "count": 1,
  3832. "precision": "highp "
  3833. }
  3834. ],
  3835. "defines": [],
  3836. "stageFlags": 1
  3837. }
  3838. ],
  3839. "samplerTextures": [],
  3840. "samplers": [],
  3841. "textures": [],
  3842. "buffers": [],
  3843. "images": [],
  3844. "subpassInputs": []
  3845. },
  3846. {
  3847. "rate": 1,
  3848. "blocks": [
  3849. {
  3850. "name": "Constants",
  3851. "members": [
  3852. {
  3853. "name": "mainTiling_Offset",
  3854. "type": 16,
  3855. "count": 1
  3856. },
  3857. {
  3858. "name": "frameTile_velLenScale",
  3859. "type": 16,
  3860. "count": 1
  3861. },
  3862. {
  3863. "name": "scale",
  3864. "type": 16,
  3865. "count": 1
  3866. },
  3867. {
  3868. "name": "nodeRotation",
  3869. "type": 16,
  3870. "count": 1
  3871. }
  3872. ],
  3873. "defines": [],
  3874. "stageFlags": 1,
  3875. "binding": 0
  3876. },
  3877. {
  3878. "name": "SampleConstants",
  3879. "members": [
  3880. {
  3881. "name": "u_sampleInfo",
  3882. "type": 16,
  3883. "count": 1
  3884. }
  3885. ],
  3886. "defines": [],
  3887. "stageFlags": 1,
  3888. "binding": 1
  3889. },
  3890. {
  3891. "name": "TickConstants",
  3892. "members": [
  3893. {
  3894. "name": "u_worldRot",
  3895. "type": 16,
  3896. "count": 1
  3897. },
  3898. {
  3899. "name": "u_timeDelta",
  3900. "type": 16,
  3901. "count": 1
  3902. }
  3903. ],
  3904. "defines": [],
  3905. "stageFlags": 1,
  3906. "binding": 2
  3907. },
  3908. {
  3909. "name": "ColorConstant",
  3910. "members": [
  3911. {
  3912. "name": "u_color_mode",
  3913. "type": 5,
  3914. "count": 1
  3915. }
  3916. ],
  3917. "defines": [
  3918. "COLOR_OVER_TIME_MODULE_ENABLE"
  3919. ],
  3920. "stageFlags": 1,
  3921. "binding": 3
  3922. },
  3923. {
  3924. "name": "RotationConstant",
  3925. "members": [
  3926. {
  3927. "name": "u_rotation_mode",
  3928. "type": 5,
  3929. "count": 1
  3930. }
  3931. ],
  3932. "defines": [
  3933. "ROTATION_OVER_TIME_MODULE_ENABLE"
  3934. ],
  3935. "stageFlags": 1,
  3936. "binding": 4
  3937. },
  3938. {
  3939. "name": "SizeConstant",
  3940. "members": [
  3941. {
  3942. "name": "u_size_mode",
  3943. "type": 5,
  3944. "count": 1
  3945. }
  3946. ],
  3947. "defines": [
  3948. "SIZE_OVER_TIME_MODULE_ENABLE"
  3949. ],
  3950. "stageFlags": 1,
  3951. "binding": 5
  3952. },
  3953. {
  3954. "name": "ForceConstant",
  3955. "members": [
  3956. {
  3957. "name": "u_force_mode",
  3958. "type": 5,
  3959. "count": 1
  3960. },
  3961. {
  3962. "name": "u_force_space",
  3963. "type": 5,
  3964. "count": 1
  3965. }
  3966. ],
  3967. "defines": [
  3968. "FORCE_OVER_TIME_MODULE_ENABLE"
  3969. ],
  3970. "stageFlags": 1,
  3971. "binding": 6
  3972. },
  3973. {
  3974. "name": "VelocityConstant",
  3975. "members": [
  3976. {
  3977. "name": "u_velocity_mode",
  3978. "type": 5,
  3979. "count": 1
  3980. },
  3981. {
  3982. "name": "u_velocity_space",
  3983. "type": 5,
  3984. "count": 1
  3985. }
  3986. ],
  3987. "defines": [
  3988. "VELOCITY_OVER_TIME_MODULE_ENABLE"
  3989. ],
  3990. "stageFlags": 1,
  3991. "binding": 7
  3992. },
  3993. {
  3994. "name": "AnimationConstant",
  3995. "members": [
  3996. {
  3997. "name": "u_anim_info",
  3998. "type": 16,
  3999. "count": 1
  4000. }
  4001. ],
  4002. "defines": [
  4003. "TEXTURE_ANIMATION_MODULE_ENABLE"
  4004. ],
  4005. "stageFlags": 1,
  4006. "binding": 8
  4007. }
  4008. ],
  4009. "samplerTextures": [
  4010. {
  4011. "name": "color_over_time_tex0",
  4012. "type": 28,
  4013. "count": 1,
  4014. "defines": [
  4015. "COLOR_OVER_TIME_MODULE_ENABLE"
  4016. ],
  4017. "stageFlags": 1,
  4018. "binding": 9
  4019. },
  4020. {
  4021. "name": "rotation_over_time_tex0",
  4022. "type": 28,
  4023. "count": 1,
  4024. "defines": [
  4025. "ROTATION_OVER_TIME_MODULE_ENABLE"
  4026. ],
  4027. "stageFlags": 1,
  4028. "binding": 10
  4029. },
  4030. {
  4031. "name": "size_over_time_tex0",
  4032. "type": 28,
  4033. "count": 1,
  4034. "defines": [
  4035. "SIZE_OVER_TIME_MODULE_ENABLE"
  4036. ],
  4037. "stageFlags": 1,
  4038. "binding": 11
  4039. },
  4040. {
  4041. "name": "force_over_time_tex0",
  4042. "type": 28,
  4043. "count": 1,
  4044. "defines": [
  4045. "FORCE_OVER_TIME_MODULE_ENABLE"
  4046. ],
  4047. "stageFlags": 1,
  4048. "binding": 12
  4049. },
  4050. {
  4051. "name": "velocity_over_time_tex0",
  4052. "type": 28,
  4053. "count": 1,
  4054. "defines": [
  4055. "VELOCITY_OVER_TIME_MODULE_ENABLE"
  4056. ],
  4057. "stageFlags": 1,
  4058. "binding": 13
  4059. },
  4060. {
  4061. "name": "texture_animation_tex0",
  4062. "type": 28,
  4063. "count": 1,
  4064. "defines": [
  4065. "TEXTURE_ANIMATION_MODULE_ENABLE"
  4066. ],
  4067. "stageFlags": 1,
  4068. "binding": 14
  4069. },
  4070. {
  4071. "name": "mainTexture",
  4072. "type": 28,
  4073. "count": 1,
  4074. "defines": [],
  4075. "stageFlags": 16,
  4076. "binding": 15
  4077. }
  4078. ],
  4079. "samplers": [],
  4080. "textures": [],
  4081. "buffers": [],
  4082. "images": [],
  4083. "subpassInputs": []
  4084. },
  4085. {
  4086. "rate": 2,
  4087. "blocks": [],
  4088. "samplerTextures": [],
  4089. "samplers": [],
  4090. "textures": [],
  4091. "buffers": [],
  4092. "images": [],
  4093. "subpassInputs": []
  4094. },
  4095. {
  4096. "rate": 3,
  4097. "blocks": [
  4098. {
  4099. "tags": {
  4100. "builtin": "global"
  4101. },
  4102. "name": "CCGlobal",
  4103. "members": [
  4104. {
  4105. "name": "cc_time",
  4106. "typename": "vec4",
  4107. "type": 16,
  4108. "count": 1,
  4109. "precision": "highp "
  4110. },
  4111. {
  4112. "name": "cc_screenSize",
  4113. "typename": "vec4",
  4114. "type": 16,
  4115. "count": 1,
  4116. "precision": "mediump "
  4117. },
  4118. {
  4119. "name": "cc_nativeSize",
  4120. "typename": "vec4",
  4121. "type": 16,
  4122. "count": 1,
  4123. "precision": "mediump "
  4124. },
  4125. {
  4126. "name": "cc_probeInfo",
  4127. "typename": "vec4",
  4128. "type": 16,
  4129. "count": 1,
  4130. "precision": "mediump "
  4131. },
  4132. {
  4133. "name": "cc_debug_view_mode",
  4134. "typename": "vec4",
  4135. "type": 16,
  4136. "count": 1,
  4137. "precision": "mediump "
  4138. }
  4139. ],
  4140. "defines": [],
  4141. "stageFlags": 17
  4142. },
  4143. {
  4144. "tags": {
  4145. "builtin": "global"
  4146. },
  4147. "name": "CCCamera",
  4148. "members": [
  4149. {
  4150. "name": "cc_matView",
  4151. "typename": "mat4",
  4152. "type": 25,
  4153. "count": 1,
  4154. "precision": "highp "
  4155. },
  4156. {
  4157. "name": "cc_matViewInv",
  4158. "typename": "mat4",
  4159. "type": 25,
  4160. "count": 1,
  4161. "precision": "highp "
  4162. },
  4163. {
  4164. "name": "cc_matProj",
  4165. "typename": "mat4",
  4166. "type": 25,
  4167. "count": 1,
  4168. "precision": "highp "
  4169. },
  4170. {
  4171. "name": "cc_matProjInv",
  4172. "typename": "mat4",
  4173. "type": 25,
  4174. "count": 1,
  4175. "precision": "highp "
  4176. },
  4177. {
  4178. "name": "cc_matViewProj",
  4179. "typename": "mat4",
  4180. "type": 25,
  4181. "count": 1,
  4182. "precision": "highp "
  4183. },
  4184. {
  4185. "name": "cc_matViewProjInv",
  4186. "typename": "mat4",
  4187. "type": 25,
  4188. "count": 1,
  4189. "precision": "highp "
  4190. },
  4191. {
  4192. "name": "cc_cameraPos",
  4193. "typename": "vec4",
  4194. "type": 16,
  4195. "count": 1,
  4196. "precision": "highp "
  4197. },
  4198. {
  4199. "name": "cc_surfaceTransform",
  4200. "typename": "vec4",
  4201. "type": 16,
  4202. "count": 1,
  4203. "precision": "mediump "
  4204. },
  4205. {
  4206. "name": "cc_screenScale",
  4207. "typename": "vec4",
  4208. "type": 16,
  4209. "count": 1,
  4210. "precision": "mediump "
  4211. },
  4212. {
  4213. "name": "cc_exposure",
  4214. "typename": "vec4",
  4215. "type": 16,
  4216. "count": 1,
  4217. "precision": "mediump "
  4218. },
  4219. {
  4220. "name": "cc_mainLitDir",
  4221. "typename": "vec4",
  4222. "type": 16,
  4223. "count": 1,
  4224. "precision": "mediump "
  4225. },
  4226. {
  4227. "name": "cc_mainLitColor",
  4228. "typename": "vec4",
  4229. "type": 16,
  4230. "count": 1,
  4231. "precision": "mediump "
  4232. },
  4233. {
  4234. "name": "cc_ambientSky",
  4235. "typename": "vec4",
  4236. "type": 16,
  4237. "count": 1,
  4238. "precision": "mediump "
  4239. },
  4240. {
  4241. "name": "cc_ambientGround",
  4242. "typename": "vec4",
  4243. "type": 16,
  4244. "count": 1,
  4245. "precision": "mediump "
  4246. },
  4247. {
  4248. "name": "cc_fogColor",
  4249. "typename": "vec4",
  4250. "type": 16,
  4251. "count": 1,
  4252. "precision": "mediump "
  4253. },
  4254. {
  4255. "name": "cc_fogBase",
  4256. "typename": "vec4",
  4257. "type": 16,
  4258. "count": 1,
  4259. "precision": "mediump "
  4260. },
  4261. {
  4262. "name": "cc_fogAdd",
  4263. "typename": "vec4",
  4264. "type": 16,
  4265. "count": 1,
  4266. "precision": "mediump "
  4267. },
  4268. {
  4269. "name": "cc_nearFar",
  4270. "typename": "vec4",
  4271. "type": 16,
  4272. "count": 1,
  4273. "precision": "mediump "
  4274. },
  4275. {
  4276. "name": "cc_viewPort",
  4277. "typename": "vec4",
  4278. "type": 16,
  4279. "count": 1,
  4280. "precision": "mediump "
  4281. }
  4282. ],
  4283. "defines": [],
  4284. "stageFlags": 17
  4285. }
  4286. ],
  4287. "samplerTextures": [],
  4288. "samplers": [],
  4289. "textures": [],
  4290. "buffers": [],
  4291. "images": [],
  4292. "subpassInputs": []
  4293. }
  4294. ],
  4295. "hash": 3967087977,
  4296. "glsl4": {
  4297. "vert": "\nprecision mediump float;\nvec4 quaternionFromAxis (vec3 xAxis,vec3 yAxis,vec3 zAxis){\n mat3 m = mat3(xAxis,yAxis,zAxis);\n float trace = m[0][0] + m[1][1] + m[2][2];\n vec4 quat;\n if (trace > 0.) {\n float s = 0.5 / sqrt(trace + 1.0);\n quat.w = 0.25 / s;\n quat.x = (m[2][1] - m[1][2]) * s;\n quat.y = (m[0][2] - m[2][0]) * s;\n quat.z = (m[1][0] - m[0][1]) * s;\n } else if ((m[0][0] > m[1][1]) && (m[0][0] > m[2][2])) {\n float s = 2.0 * sqrt(1.0 + m[0][0] - m[1][1] - m[2][2]);\n quat.w = (m[2][1] - m[1][2]) / s;\n quat.x = 0.25 * s;\n quat.y = (m[0][1] + m[1][0]) / s;\n quat.z = (m[0][2] + m[2][0]) / s;\n } else if (m[1][1] > m[2][2]) {\n float s = 2.0 * sqrt(1.0 + m[1][1] - m[0][0] - m[2][2]);\n quat.w = (m[0][2] - m[2][0]) / s;\n quat.x = (m[0][1] + m[1][0]) / s;\n quat.y = 0.25 * s;\n quat.z = (m[1][2] + m[2][1]) / s;\n } else {\n float s = 2.0 * sqrt(1.0 + m[2][2] - m[0][0] - m[1][1]);\n quat.w = (m[1][0] - m[0][1]) / s;\n quat.x = (m[0][2] + m[2][0]) / s;\n quat.y = (m[1][2] + m[2][1]) / s;\n quat.z = 0.25 * s;\n }\n float len = quat.x * quat.x + quat.y * quat.y + quat.z * quat.z + quat.w * quat.w;\n if (len > 0.) {\n len = 1. / sqrt(len);\n quat.x = quat.x * len;\n quat.y = quat.y * len;\n quat.z = quat.z * len;\n quat.w = quat.w * len;\n }\n return quat;\n}\nvec4 quaternionFromEuler (vec3 angle){\n float x = angle.x / 2.;\n float y = angle.y / 2.;\n float z = angle.z / 2.;\n float sx = sin(x);\n float cx = cos(x);\n float sy = sin(y);\n float cy = cos(y);\n float sz = sin(z);\n float cz = cos(z);\n vec4 quat = vec4(0);\n quat.x = sx * cy * cz + cx * sy * sz;\n quat.y = cx * sy * cz + sx * cy * sz;\n quat.z = cx * cy * sz - sx * sy * cz;\n quat.w = cx * cy * cz - sx * sy * sz;\n return quat;\n}\nmat4 matrixFromRT (vec4 q, vec3 p){\n float x2 = q.x + q.x;\n float y2 = q.y + q.y;\n float z2 = q.z + q.z;\n float xx = q.x * x2;\n float xy = q.x * y2;\n float xz = q.x * z2;\n float yy = q.y * y2;\n float yz = q.y * z2;\n float zz = q.z * z2;\n float wx = q.w * x2;\n float wy = q.w * y2;\n float wz = q.w * z2;\n return mat4(\n 1. - (yy + zz), xy + wz, xz - wy, 0,\n xy - wz, 1. - (xx + zz), yz + wx, 0,\n xz + wy, yz - wx, 1. - (xx + yy), 0,\n p.x, p.y, p.z, 1\n );\n}\nmat4 matFromRTS (vec4 q, vec3 t, vec3 s){\n float x = q.x, y = q.y, z = q.z, w = q.w;\n float x2 = x + x;\n float y2 = y + y;\n float z2 = z + z;\n float xx = x * x2;\n float xy = x * y2;\n float xz = x * z2;\n float yy = y * y2;\n float yz = y * z2;\n float zz = z * z2;\n float wx = w * x2;\n float wy = w * y2;\n float wz = w * z2;\n float sx = s.x;\n float sy = s.y;\n float sz = s.z;\n return mat4((1. - (yy + zz)) * sx, (xy + wz) * sx, (xz - wy) * sx, 0,\n (xy - wz) * sy, (1. - (xx + zz)) * sy, (yz + wx) * sy, 0,\n (xz + wy) * sz, (yz - wx) * sz, (1. - (xx + yy)) * sz, 0,\n t.x, t.y, t.z, 1);\n}\nvec4 quatMultiply (vec4 a, vec4 b){\n vec4 quat;\n quat.x = a.x * b.w + a.w * b.x + a.y * b.z - a.z * b.y;\n quat.y = a.y * b.w + a.w * b.y + a.z * b.x - a.x * b.z;\n quat.z = a.z * b.w + a.w * b.z + a.x * b.y - a.y * b.x;\n quat.w = a.w * b.w - a.x * b.x - a.y * b.y - a.z * b.z;\n return quat;\n}\nvoid rotateVecFromQuat (inout vec3 v, vec4 q){\n float ix = q.w * v.x + q.y * v.z - q.z * v.y;\n float iy = q.w * v.y + q.z * v.x - q.x * v.z;\n float iz = q.w * v.z + q.x * v.y - q.y * v.x;\n float iw = -q.x * v.x - q.y * v.y - q.z * v.z;\n v.x = ix * q.w + iw * -q.x + iy * -q.z - iz * -q.y;\n v.y = iy * q.w + iw * -q.y + iz * -q.x - ix * -q.z;\n v.z = iz * q.w + iw * -q.z + ix * -q.y - iy * -q.x;\n}\nvec3 rotateInLocalSpace (vec3 pos, vec3 xAxis, vec3 yAxis, vec3 zAxis, vec4 q){\n vec4 viewQuat = quaternionFromAxis(xAxis, yAxis, zAxis);\n vec4 rotQuat = quatMultiply(viewQuat, q);\n rotateVecFromQuat(pos, rotQuat);\n return pos;\n}\nmat3 quatToMat3(vec4 q) {\n vec3 m0 = vec3(\n 1.0 - 2.0 * q.y * q.y - 2.0 * q.z * q.z,\n 2.0 * q.x * q.y + 2.0 * q.w * q.z,\n 2.0 * q.x * q.z - 2.0 * q.w * q.y);\n\tvec3 m1 = vec3(\n 2.0 * q.x * q.y - 2.0 * q.w * q.z,\n 1.0 - 2.0 * q.x * q.x - 2.0 * q.z * q.z,\n 2.0 * q.y * q.z + 2.0 * q.w * q.x);\n\tvec3 m2 = vec3(\n 2.0 * q.x * q.z + 2.0 * q.w * q.y,\n 2.0 * q.y * q.z - 2.0 * q.w * q.x,\n 1.0 - 2.0 * q.x * q.x - 2.0 * q.y * q.y);\n return mat3(m0, m1, m2);\n}\nvec4 mat3ToQuat(mat3 mat) {\n float tr = mat[0][0] + mat[1][1] + mat[2][2];\n\tfloat qw, qx, qy, qz;\n if (tr > 0.0) {\n float S = sqrt(tr + 1.0) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = 0.25 * S;\n\t qx = (mat[1][2] - mat[2][1]) * invS;\n\t qy = (mat[2][0] - mat[0][2]) * invS;\n\t qz = (mat[0][1] - mat[1][0]) * invS;\n } else if ((mat[0][0] > mat[1][1])&&(mat[0][0] > mat[2][2])) {\n float S = sqrt(1.0 + mat[0][0] - mat[1][1] - mat[2][2]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[1][2] - mat[2][1]) * invS;\n\t qx = 0.25 * S;\n\t qy = (mat[1][0] + mat[0][1]) * invS;\n\t qz = (mat[2][0] + mat[0][2]) * invS;\n } else if (mat[1][1] > mat[2][2]) {\n\t float S = sqrt(1.0 + mat[1][1] - mat[0][0] - mat[2][2]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[2][0] - mat[0][2]) * invS;\n\t qx = (mat[1][0] + mat[0][1]) * invS;\n\t qy = 0.25 * S;\n\t qz = (mat[2][1] + mat[1][2]) * invS;\n } else {\n\t float S = sqrt(1.0 + mat[2][2] - mat[0][0] - mat[1][1]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[0][1] - mat[1][0]) * invS;\n\t qx = (mat[2][0] + mat[0][2]) * invS;\n\t qy = (mat[2][1] + mat[1][2]) * invS;\n\t qz = 0.25 * S;\n }\n return vec4(qx, qy, qz, qw);\n}\nvec4 eulerToQuat(vec3 euler) {\n vec3 er = euler * 0.5;\n float x = er.x, y = er.y, z = er.z;\n float sx = sin(x);\n float cx = cos(x);\n float sy = sin(y);\n float cy = cos(y);\n float sz = sin(z);\n float cz = cos(z);\n vec4 quat;\n quat.x = sx * cy * cz + cx * sy * sz;\n quat.y = cx * sy * cz + sx * cy * sz;\n quat.z = cx * cy * sz - sx * sy * cz;\n quat.w = cx * cy * cz - sx * sy * sz;\n return quat;\n}\nlayout(set = 1, binding = 0) uniform Constants {\n vec4 mainTiling_Offset;\n vec4 frameTile_velLenScale;\n vec4 scale;\n vec4 nodeRotation;\n};\nlayout(set = 0, binding = 0) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(set = 0, binding = 1) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nlayout(set = 2, binding = 0) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n};\nlayout(location = 0) out mediump vec2 uv;\nlayout(location = 1) out mediump vec4 color;\nvoid computeVertPos (inout vec4 pos, vec2 vertOffset, vec4 q, vec3 s\n#if CC_RENDER_MODE == 0 || CC_RENDER_MODE == 3\n , mat4 viewInv\n#endif\n#if CC_RENDER_MODE == 1\n , vec3 eye\n , vec4 velocity\n , float velocityScale\n , float lengthScale\n , float xIndex\n#endif\n) {\n#if CC_RENDER_MODE == 0\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n vec3 camX = normalize(vec3(viewInv[0][0], viewInv[1][0], viewInv[2][0]));\n vec3 camY = normalize(vec3(viewInv[0][1], viewInv[1][1], viewInv[2][1]));\n vec3 camZ = normalize(vec3(viewInv[0][2], viewInv[1][2], viewInv[2][2]));\n pos.xyz += rotateInLocalSpace(viewSpaceVert, camX, camY, camZ, q);\n#elif CC_RENDER_MODE == 1\n vec3 camRight = normalize(cross(pos.xyz - eye, velocity.xyz)) * s.x;\n vec3 camUp = velocity.xyz * velocityScale + normalize(velocity.xyz) * lengthScale * s.y;\n pos.xyz += (camRight * abs(vertOffset.x) * sign(vertOffset.y)) - camUp * xIndex;\n#elif CC_RENDER_MODE == 2\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n vec3 camX = vec3(1, 0, 0);\n vec3 camY = vec3(0, 0, -1);\n pos.xyz += rotateInLocalSpace(viewSpaceVert, camX, camY, cross(camX, camY), q);\n#elif CC_RENDER_MODE == 3\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n rotateVecFromQuat(viewSpaceVert, q);\n vec3 camX = normalize(vec3(cc_matView[0][0], cc_matView[1][0], cc_matView[2][0]));\n vec3 camY = vec3(0, 1, 0);\n vec3 offset = camX * viewSpaceVert.x + camY * viewSpaceVert.y;\n pos.xyz += offset;\n#else\n pos.x += vertOffset.x;\n pos.y += vertOffset.y;\n#endif\n}\nvec2 computeUV (float frameIndex, vec2 vertIndex, vec2 frameTile){\n vec2 aniUV = vec2(0, floor(frameIndex * frameTile.y));\n aniUV.x = floor(frameIndex * frameTile.x * frameTile.y - aniUV.y * frameTile.x);\n#if CC_RENDER_MODE != 4\n vertIndex.y = 1. - vertIndex.y;\n#endif\n return (aniUV.xy + vertIndex) / vec2(frameTile.x, frameTile.y);\n}\nlayout(set = 1, binding = 1) uniform SampleConstants {\n vec4 u_sampleInfo;\n};\nlayout(set = 1, binding = 2) uniform TickConstants {\n vec4 u_worldRot;\n vec4 u_timeDelta;\n};\nlayout(location = 0) in vec4 a_position_starttime;\nlayout(location = 1) in vec4 a_color;\nlayout(location = 2) in vec4 a_dir_life;\nlayout(location = 3) in float a_rndSeed;\n#if !CC_INSTANCE_PARTICLE\n layout(location = 4) in vec4 a_size_uv;\n layout(location = 5) in vec4 a_rotation_uv;\n#endif\n#if CC_INSTANCE_PARTICLE\n layout(location = 6) in vec4 a_size_fid;\n layout(location = 7) in vec3 a_rotation;\n layout(location = 8) in vec3 a_uv;\n#endif\n#if CC_RENDER_MODE == 4\n layout(location = 9) in vec3 a_texCoord;\n layout(location = 10) in vec3 a_texCoord3;\n layout(location = 11) in vec3 a_normal;\n layout(location = 12) in vec4 a_color1;\n#endif\nvec3 unpackCurveData (sampler2D tex, vec2 coord) {\n vec4 a = texture(tex, coord);\n vec4 b = texture(tex, coord + u_sampleInfo.y);\n float c = fract(coord.x * u_sampleInfo.x);\n return mix(a.xyz, b.xyz, c);\n}\nvec3 unpackCurveData (sampler2D tex, vec2 coord, out float w) {\n vec4 a = texture(tex, coord);\n vec4 b = texture(tex, coord + u_sampleInfo.y);\n float c = fract(coord.x * u_sampleInfo.x);\n w = mix(a.w, b.w, c);\n return mix(a.xyz, b.xyz, c);\n}\nfloat pseudoRandom(float x) {\n#if USE_VK_SHADER\n float o = x;\n x = mod(x - 1.0, 2.0) - 1.0;\n float freqVar = 10.16640753482;\n float y = sin(freqVar * floor(o * 0.5 - 0.5));\n float v = max(0.0, 1.0-abs(x));\n v *= 0.7071067812;\n v = y < 0.0 ? -v : v;\n return v;\n#endif\n#if !USE_VK_SHADER\n float seed = mod(x, 233280.);\n float q = (seed * 9301. + 49297.) / 233280.;\n return fract(q);\n#endif\n}\n#if COLOR_OVER_TIME_MODULE_ENABLE\n layout(set = 1, binding = 9) uniform sampler2D color_over_time_tex0;\n layout(set = 1, binding = 3) uniform ColorConstant {\n int u_color_mode;\n };\n#endif\n#if ROTATION_OVER_TIME_MODULE_ENABLE\n layout(set = 1, binding = 10) uniform sampler2D rotation_over_time_tex0;\n layout(set = 1, binding = 4) uniform RotationConstant {\n int u_rotation_mode;\n };\n#endif\n#if SIZE_OVER_TIME_MODULE_ENABLE\n layout(set = 1, binding = 11) uniform sampler2D size_over_time_tex0;\n layout(set = 1, binding = 5) uniform SizeConstant {\n int u_size_mode;\n };\n#endif\n#if FORCE_OVER_TIME_MODULE_ENABLE\n layout(set = 1, binding = 12) uniform sampler2D force_over_time_tex0;\n layout(set = 1, binding = 6) uniform ForceConstant {\n int u_force_mode;\n int u_force_space;\n };\n#endif\n#if VELOCITY_OVER_TIME_MODULE_ENABLE\n layout(set = 1, binding = 13) uniform sampler2D velocity_over_time_tex0;\n layout(set = 1, binding = 7) uniform VelocityConstant {\n int u_velocity_mode;\n int u_velocity_space;\n };\n#endif\n#if TEXTURE_ANIMATION_MODULE_ENABLE\n layout(set = 1, binding = 14) uniform sampler2D texture_animation_tex0;\n layout(set = 1, binding = 8) uniform AnimationConstant {\n vec4 u_anim_info;\n };\n#endif\nfloat repeat (float t, float length) {\n return t - floor(t / length) * length;\n}\nvec4 rotateQuat (vec4 p, vec4 q) {\n vec3 iv = cross(q.xyz, p.xyz) + q.w * p.xyz;\n vec3 res = p.xyz + 2.0 * cross(q.xyz, iv);\n return vec4(res.xyz, p.w);\n}\nvec4 gpvs_main () {\n float activeTime = u_timeDelta.x - a_position_starttime.w;\n float normalizedTime = clamp(activeTime / a_dir_life.w, 0.0, 1.0);\n vec2 timeCoord0 = vec2(normalizedTime, 0.);\n vec2 timeCoord1 = vec2(normalizedTime, 1.);\n #if CC_RENDER_MODE == 4\n vec2 vertIdx = vec2(a_texCoord.x, a_texCoord.y);\n #endif\n #if CC_RENDER_MODE != 4\n #if !CC_INSTANCE_PARTICLE\n vec2 vertIdx = vec2(a_size_uv.w, a_rotation_uv.w);\n #endif\n #if CC_INSTANCE_PARTICLE\n vec2 vertIdx = a_uv.xy;\n #endif\n #endif\n vec4 velocity = vec4(a_dir_life.xyz, 0.);\n vec4 pos = vec4(a_position_starttime.xyz, 1.);\n #if !CC_INSTANCE_PARTICLE\n vec3 size = a_size_uv.xyz;\n #endif\n #if CC_INSTANCE_PARTICLE\n vec3 size = a_size_fid.xyz;\n #endif\n #if SIZE_OVER_TIME_MODULE_ENABLE\n if (u_size_mode == 1) {\n size *= unpackCurveData(size_over_time_tex0, timeCoord0);\n } else {\n vec3 size_0 = unpackCurveData(size_over_time_tex0, timeCoord0);\n vec3 size_1 = unpackCurveData(size_over_time_tex0, timeCoord1);\n float factor_s = pseudoRandom(a_rndSeed + 39825.);\n size *= mix(size_0, size_1, factor_s);\n }\n #endif\n vec3 compScale = scale.xyz * size;\n #if FORCE_OVER_TIME_MODULE_ENABLE\n vec3 forceAnim = vec3(0.);\n if (u_force_mode == 1) {\n forceAnim = unpackCurveData(force_over_time_tex0, timeCoord0);\n } else {\n vec3 force_0 = unpackCurveData(force_over_time_tex0, timeCoord0);\n vec3 force_1 = unpackCurveData(force_over_time_tex0, timeCoord1);\n float factor_f = pseudoRandom(a_rndSeed + 212165.);\n forceAnim = mix(force_0, force_1, factor_f);\n }\n vec4 forceTrack = vec4(forceAnim, 0.);\n if (u_force_space == 0) {\n forceTrack = rotateQuat(forceTrack, u_worldRot);\n }\n velocity.xyz += forceTrack.xyz;\n #endif\n #if VELOCITY_OVER_TIME_MODULE_ENABLE\n float speedModifier0 = 1.;\n float speedModifier1 = 1.;\n vec3 velocityAnim = vec3(0.);\n if (u_velocity_mode == 1) {\n velocityAnim = unpackCurveData(velocity_over_time_tex0, timeCoord0, speedModifier0);\n } else {\n vec3 vectory_0 = unpackCurveData(velocity_over_time_tex0, timeCoord0, speedModifier0);\n vec3 vectory_1 = unpackCurveData(velocity_over_time_tex0, timeCoord1, speedModifier1);\n float factor_v = pseudoRandom(a_rndSeed + 197866.);\n velocityAnim = mix(vectory_0, vectory_1, factor_v);\n speedModifier0 = mix(speedModifier0, speedModifier1, factor_v);\n }\n vec4 velocityTrack = vec4(velocityAnim, 0.);\n if (u_velocity_space == 0) {\n velocityTrack = rotateQuat(velocityTrack, u_worldRot);\n }\n velocity.xyz += velocityTrack.xyz;\n velocity.xyz *= speedModifier0;\n #endif\n pos.xyz += velocity.xyz * normalizedTime * a_dir_life.w;\n #if !CC_USE_WORLD_SPACE\n pos = cc_matWorld * pos;\n #if CC_RENDER_MODE == 1\n velocity = rotateQuat(velocity, u_worldRot);\n #endif\n #endif\n #if !CC_INSTANCE_PARTICLE\n vec3 startRotation = a_rotation_uv.xyz;\n #endif\n #if CC_INSTANCE_PARTICLE\n vec3 startRotation = a_rotation;\n #endif\n #if CC_RENDER_MODE != 4\n #if CC_RENDER_MODE == 0\n vec3 rotEuler = startRotation.xyz;\n #elif CC_RENDER_MODE == 1\n vec3 rotEuler = vec3(0.);\n #endif\n #if CC_RENDER_MODE != 0 && CC_RENDER_MODE != 1\n vec3 rotEuler = vec3(0., 0., startRotation.z);\n #endif\n vec4 rot = quaternionFromEuler(rotEuler);\n #endif\n #if CC_RENDER_MODE == 4\n vec4 rot = quaternionFromEuler(startRotation);\n #endif\n #if ROTATION_OVER_TIME_MODULE_ENABLE\n if (u_rotation_mode == 1) {\n vec3 euler = unpackCurveData(rotation_over_time_tex0, timeCoord0) * normalizedTime * a_dir_life.w;\n vec4 quat = eulerToQuat(euler);\n mat3 mLocal = quatToMat3(quat);\n mat3 mStart = quatToMat3(rot);\n rot = mat3ToQuat(mStart * mLocal);\n } else {\n vec3 rotation_0 = unpackCurveData(rotation_over_time_tex0, timeCoord0);\n vec3 rotation_1 = unpackCurveData(rotation_over_time_tex0, timeCoord1);\n float factor_r = pseudoRandom(a_rndSeed + 125292.);\n vec3 euler = mix(rotation_0, rotation_1, factor_r) * normalizedTime * a_dir_life.w;\n #if CC_RENDER_MODE == 3 || CC_RENDER_MODE == 2\n euler = vec3(0.0, 0.0, euler.z);\n #endif\n vec4 quat = eulerToQuat(euler);\n mat3 mLocal = quatToMat3(quat);\n mat3 mStart = quatToMat3(rot);\n rot = mat3ToQuat(mStart * mLocal);\n }\n #endif\n #if COLOR_OVER_TIME_MODULE_ENABLE\n if (u_color_mode == 1) {\n color = a_color * texture(color_over_time_tex0, timeCoord0);\n } else {\n vec4 color_0 = texture(color_over_time_tex0, timeCoord0);\n vec4 color_1 = texture(color_over_time_tex0, timeCoord1);\n float factor_c = pseudoRandom(a_rndSeed + 91041.);\n color = a_color * mix(color_0, color_1, factor_c);\n }\n #endif\n #if !COLOR_OVER_TIME_MODULE_ENABLE\n color = a_color;\n #endif\n #if CC_RENDER_MODE != 4\n vec2 cornerOffset = vec2((vertIdx - 0.5));\n #if CC_RENDER_MODE == 1\n rot = vec4(0.0, 0.0, 0.0, 1.0);\n #endif\n computeVertPos(pos, cornerOffset, rot, compScale\n #if CC_RENDER_MODE == 0 || CC_RENDER_MODE == 3\n , cc_matViewInv\n #endif\n #if CC_RENDER_MODE == 1\n , cc_cameraPos.xyz\n , velocity\n , frameTile_velLenScale.z\n , frameTile_velLenScale.w\n #if !CC_INSTANCE_PARTICLE\n , a_size_uv.w\n #endif\n #if CC_INSTANCE_PARTICLE\n , a_uv.x\n #endif\n #endif\n );\n #endif\n #if CC_RENDER_MODE == 4\n mat3 rotMat = quatToMat3(rot);\n mat3 nodeMat = quatToMat3(nodeRotation);\n rotMat = nodeMat * rotMat;\n rot = mat3ToQuat(rotMat);\n mat4 xformNoScale = matrixFromRT(rot, pos.xyz);\n mat4 xform = matFromRTS(rot, pos.xyz, compScale);\n pos = xform * vec4(a_texCoord3, 1);\n vec4 normal = xformNoScale * vec4(a_normal, 0);\n color *= a_color1;\n #endif\n pos = cc_matViewProj * pos;\n float frameIndex = 0.;\n #if TEXTURE_ANIMATION_MODULE_ENABLE\n float startFrame = 0.;\n vec3 frameInfo = vec3(0.);\n if (int(u_anim_info.x) == 1) {\n frameInfo = unpackCurveData(texture_animation_tex0, timeCoord0);\n } else {\n vec3 frameInfo0 = unpackCurveData(texture_animation_tex0, timeCoord0);\n vec3 frameInfo1 = unpackCurveData(texture_animation_tex0, timeCoord1);\n float factor_t = pseudoRandom(a_rndSeed + 90794.);\n frameInfo = mix(frameInfo0, frameInfo1, factor_t);\n }\n startFrame = frameInfo.x / u_anim_info.y;\n float EPSILON = 1e-6;\n frameIndex = repeat(u_anim_info.z * (frameInfo.y + startFrame), 1. + EPSILON);\n #endif\n uv = computeUV(frameIndex, vertIdx, frameTile_velLenScale.xy) * mainTiling_Offset.xy + mainTiling_Offset.zw;\n return pos;\n}\nvoid main() { gl_Position = gpvs_main(); }",
  4298. "frag": "\nprecision mediump float;\nlayout(set = 0, binding = 0) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(set = 0, binding = 1) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nvec4 CCFragOutput (vec4 color) {\n return color;\n}\nlayout(location = 0) in vec2 uv;\nlayout(location = 1) in vec4 color;\nlayout(set = 1, binding = 15) uniform sampler2D mainTexture;\nvec4 premultiplied () {\n vec4 col = color * texture(mainTexture, uv) * color.a;\n return CCFragOutput(col);\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = premultiplied(); }"
  4299. },
  4300. "glsl3": {
  4301. "vert": "\nprecision mediump float;\nvec4 quaternionFromAxis (vec3 xAxis,vec3 yAxis,vec3 zAxis){\n mat3 m = mat3(xAxis,yAxis,zAxis);\n float trace = m[0][0] + m[1][1] + m[2][2];\n vec4 quat;\n if (trace > 0.) {\n float s = 0.5 / sqrt(trace + 1.0);\n quat.w = 0.25 / s;\n quat.x = (m[2][1] - m[1][2]) * s;\n quat.y = (m[0][2] - m[2][0]) * s;\n quat.z = (m[1][0] - m[0][1]) * s;\n } else if ((m[0][0] > m[1][1]) && (m[0][0] > m[2][2])) {\n float s = 2.0 * sqrt(1.0 + m[0][0] - m[1][1] - m[2][2]);\n quat.w = (m[2][1] - m[1][2]) / s;\n quat.x = 0.25 * s;\n quat.y = (m[0][1] + m[1][0]) / s;\n quat.z = (m[0][2] + m[2][0]) / s;\n } else if (m[1][1] > m[2][2]) {\n float s = 2.0 * sqrt(1.0 + m[1][1] - m[0][0] - m[2][2]);\n quat.w = (m[0][2] - m[2][0]) / s;\n quat.x = (m[0][1] + m[1][0]) / s;\n quat.y = 0.25 * s;\n quat.z = (m[1][2] + m[2][1]) / s;\n } else {\n float s = 2.0 * sqrt(1.0 + m[2][2] - m[0][0] - m[1][1]);\n quat.w = (m[1][0] - m[0][1]) / s;\n quat.x = (m[0][2] + m[2][0]) / s;\n quat.y = (m[1][2] + m[2][1]) / s;\n quat.z = 0.25 * s;\n }\n float len = quat.x * quat.x + quat.y * quat.y + quat.z * quat.z + quat.w * quat.w;\n if (len > 0.) {\n len = 1. / sqrt(len);\n quat.x = quat.x * len;\n quat.y = quat.y * len;\n quat.z = quat.z * len;\n quat.w = quat.w * len;\n }\n return quat;\n}\nvec4 quaternionFromEuler (vec3 angle){\n float x = angle.x / 2.;\n float y = angle.y / 2.;\n float z = angle.z / 2.;\n float sx = sin(x);\n float cx = cos(x);\n float sy = sin(y);\n float cy = cos(y);\n float sz = sin(z);\n float cz = cos(z);\n vec4 quat = vec4(0);\n quat.x = sx * cy * cz + cx * sy * sz;\n quat.y = cx * sy * cz + sx * cy * sz;\n quat.z = cx * cy * sz - sx * sy * cz;\n quat.w = cx * cy * cz - sx * sy * sz;\n return quat;\n}\nmat4 matrixFromRT (vec4 q, vec3 p){\n float x2 = q.x + q.x;\n float y2 = q.y + q.y;\n float z2 = q.z + q.z;\n float xx = q.x * x2;\n float xy = q.x * y2;\n float xz = q.x * z2;\n float yy = q.y * y2;\n float yz = q.y * z2;\n float zz = q.z * z2;\n float wx = q.w * x2;\n float wy = q.w * y2;\n float wz = q.w * z2;\n return mat4(\n 1. - (yy + zz), xy + wz, xz - wy, 0,\n xy - wz, 1. - (xx + zz), yz + wx, 0,\n xz + wy, yz - wx, 1. - (xx + yy), 0,\n p.x, p.y, p.z, 1\n );\n}\nmat4 matFromRTS (vec4 q, vec3 t, vec3 s){\n float x = q.x, y = q.y, z = q.z, w = q.w;\n float x2 = x + x;\n float y2 = y + y;\n float z2 = z + z;\n float xx = x * x2;\n float xy = x * y2;\n float xz = x * z2;\n float yy = y * y2;\n float yz = y * z2;\n float zz = z * z2;\n float wx = w * x2;\n float wy = w * y2;\n float wz = w * z2;\n float sx = s.x;\n float sy = s.y;\n float sz = s.z;\n return mat4((1. - (yy + zz)) * sx, (xy + wz) * sx, (xz - wy) * sx, 0,\n (xy - wz) * sy, (1. - (xx + zz)) * sy, (yz + wx) * sy, 0,\n (xz + wy) * sz, (yz - wx) * sz, (1. - (xx + yy)) * sz, 0,\n t.x, t.y, t.z, 1);\n}\nvec4 quatMultiply (vec4 a, vec4 b){\n vec4 quat;\n quat.x = a.x * b.w + a.w * b.x + a.y * b.z - a.z * b.y;\n quat.y = a.y * b.w + a.w * b.y + a.z * b.x - a.x * b.z;\n quat.z = a.z * b.w + a.w * b.z + a.x * b.y - a.y * b.x;\n quat.w = a.w * b.w - a.x * b.x - a.y * b.y - a.z * b.z;\n return quat;\n}\nvoid rotateVecFromQuat (inout vec3 v, vec4 q){\n float ix = q.w * v.x + q.y * v.z - q.z * v.y;\n float iy = q.w * v.y + q.z * v.x - q.x * v.z;\n float iz = q.w * v.z + q.x * v.y - q.y * v.x;\n float iw = -q.x * v.x - q.y * v.y - q.z * v.z;\n v.x = ix * q.w + iw * -q.x + iy * -q.z - iz * -q.y;\n v.y = iy * q.w + iw * -q.y + iz * -q.x - ix * -q.z;\n v.z = iz * q.w + iw * -q.z + ix * -q.y - iy * -q.x;\n}\nvec3 rotateInLocalSpace (vec3 pos, vec3 xAxis, vec3 yAxis, vec3 zAxis, vec4 q){\n vec4 viewQuat = quaternionFromAxis(xAxis, yAxis, zAxis);\n vec4 rotQuat = quatMultiply(viewQuat, q);\n rotateVecFromQuat(pos, rotQuat);\n return pos;\n}\nmat3 quatToMat3(vec4 q) {\n vec3 m0 = vec3(\n 1.0 - 2.0 * q.y * q.y - 2.0 * q.z * q.z,\n 2.0 * q.x * q.y + 2.0 * q.w * q.z,\n 2.0 * q.x * q.z - 2.0 * q.w * q.y);\n\tvec3 m1 = vec3(\n 2.0 * q.x * q.y - 2.0 * q.w * q.z,\n 1.0 - 2.0 * q.x * q.x - 2.0 * q.z * q.z,\n 2.0 * q.y * q.z + 2.0 * q.w * q.x);\n\tvec3 m2 = vec3(\n 2.0 * q.x * q.z + 2.0 * q.w * q.y,\n 2.0 * q.y * q.z - 2.0 * q.w * q.x,\n 1.0 - 2.0 * q.x * q.x - 2.0 * q.y * q.y);\n return mat3(m0, m1, m2);\n}\nvec4 mat3ToQuat(mat3 mat) {\n float tr = mat[0][0] + mat[1][1] + mat[2][2];\n\tfloat qw, qx, qy, qz;\n if (tr > 0.0) {\n float S = sqrt(tr + 1.0) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = 0.25 * S;\n\t qx = (mat[1][2] - mat[2][1]) * invS;\n\t qy = (mat[2][0] - mat[0][2]) * invS;\n\t qz = (mat[0][1] - mat[1][0]) * invS;\n } else if ((mat[0][0] > mat[1][1])&&(mat[0][0] > mat[2][2])) {\n float S = sqrt(1.0 + mat[0][0] - mat[1][1] - mat[2][2]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[1][2] - mat[2][1]) * invS;\n\t qx = 0.25 * S;\n\t qy = (mat[1][0] + mat[0][1]) * invS;\n\t qz = (mat[2][0] + mat[0][2]) * invS;\n } else if (mat[1][1] > mat[2][2]) {\n\t float S = sqrt(1.0 + mat[1][1] - mat[0][0] - mat[2][2]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[2][0] - mat[0][2]) * invS;\n\t qx = (mat[1][0] + mat[0][1]) * invS;\n\t qy = 0.25 * S;\n\t qz = (mat[2][1] + mat[1][2]) * invS;\n } else {\n\t float S = sqrt(1.0 + mat[2][2] - mat[0][0] - mat[1][1]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[0][1] - mat[1][0]) * invS;\n\t qx = (mat[2][0] + mat[0][2]) * invS;\n\t qy = (mat[2][1] + mat[1][2]) * invS;\n\t qz = 0.25 * S;\n }\n return vec4(qx, qy, qz, qw);\n}\nvec4 eulerToQuat(vec3 euler) {\n vec3 er = euler * 0.5;\n float x = er.x, y = er.y, z = er.z;\n float sx = sin(x);\n float cx = cos(x);\n float sy = sin(y);\n float cy = cos(y);\n float sz = sin(z);\n float cz = cos(z);\n vec4 quat;\n quat.x = sx * cy * cz + cx * sy * sz;\n quat.y = cx * sy * cz + sx * cy * sz;\n quat.z = cx * cy * sz - sx * sy * cz;\n quat.w = cx * cy * cz - sx * sy * sz;\n return quat;\n}\nlayout(std140) uniform Constants {\n vec4 mainTiling_Offset;\n vec4 frameTile_velLenScale;\n vec4 scale;\n vec4 nodeRotation;\n};\nlayout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nlayout(std140) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n};\nout mediump vec2 uv;\nout mediump vec4 color;\nvoid computeVertPos (inout vec4 pos, vec2 vertOffset, vec4 q, vec3 s\n#if CC_RENDER_MODE == 0 || CC_RENDER_MODE == 3\n , mat4 viewInv\n#endif\n#if CC_RENDER_MODE == 1\n , vec3 eye\n , vec4 velocity\n , float velocityScale\n , float lengthScale\n , float xIndex\n#endif\n) {\n#if CC_RENDER_MODE == 0\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n vec3 camX = normalize(vec3(viewInv[0][0], viewInv[1][0], viewInv[2][0]));\n vec3 camY = normalize(vec3(viewInv[0][1], viewInv[1][1], viewInv[2][1]));\n vec3 camZ = normalize(vec3(viewInv[0][2], viewInv[1][2], viewInv[2][2]));\n pos.xyz += rotateInLocalSpace(viewSpaceVert, camX, camY, camZ, q);\n#elif CC_RENDER_MODE == 1\n vec3 camRight = normalize(cross(pos.xyz - eye, velocity.xyz)) * s.x;\n vec3 camUp = velocity.xyz * velocityScale + normalize(velocity.xyz) * lengthScale * s.y;\n pos.xyz += (camRight * abs(vertOffset.x) * sign(vertOffset.y)) - camUp * xIndex;\n#elif CC_RENDER_MODE == 2\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n vec3 camX = vec3(1, 0, 0);\n vec3 camY = vec3(0, 0, -1);\n pos.xyz += rotateInLocalSpace(viewSpaceVert, camX, camY, cross(camX, camY), q);\n#elif CC_RENDER_MODE == 3\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n rotateVecFromQuat(viewSpaceVert, q);\n vec3 camX = normalize(vec3(cc_matView[0][0], cc_matView[1][0], cc_matView[2][0]));\n vec3 camY = vec3(0, 1, 0);\n vec3 offset = camX * viewSpaceVert.x + camY * viewSpaceVert.y;\n pos.xyz += offset;\n#else\n pos.x += vertOffset.x;\n pos.y += vertOffset.y;\n#endif\n}\nvec2 computeUV (float frameIndex, vec2 vertIndex, vec2 frameTile){\n vec2 aniUV = vec2(0, floor(frameIndex * frameTile.y));\n aniUV.x = floor(frameIndex * frameTile.x * frameTile.y - aniUV.y * frameTile.x);\n#if CC_RENDER_MODE != 4\n vertIndex.y = 1. - vertIndex.y;\n#endif\n return (aniUV.xy + vertIndex) / vec2(frameTile.x, frameTile.y);\n}\nlayout(std140) uniform SampleConstants {\n vec4 u_sampleInfo;\n};\nlayout(std140) uniform TickConstants {\n vec4 u_worldRot;\n vec4 u_timeDelta;\n};\nin vec4 a_position_starttime;\nin vec4 a_color;\nin vec4 a_dir_life;\nin float a_rndSeed;\n#if !CC_INSTANCE_PARTICLE\n in vec4 a_size_uv;\n in vec4 a_rotation_uv;\n#endif\n#if CC_INSTANCE_PARTICLE\n in vec4 a_size_fid;\n in vec3 a_rotation;\n in vec3 a_uv;\n#endif\n#if CC_RENDER_MODE == 4\n in vec3 a_texCoord;\n in vec3 a_texCoord3;\n in vec3 a_normal;\n in vec4 a_color1;\n#endif\nvec3 unpackCurveData (sampler2D tex, vec2 coord) {\n vec4 a = texture(tex, coord);\n vec4 b = texture(tex, coord + u_sampleInfo.y);\n float c = fract(coord.x * u_sampleInfo.x);\n return mix(a.xyz, b.xyz, c);\n}\nvec3 unpackCurveData (sampler2D tex, vec2 coord, out float w) {\n vec4 a = texture(tex, coord);\n vec4 b = texture(tex, coord + u_sampleInfo.y);\n float c = fract(coord.x * u_sampleInfo.x);\n w = mix(a.w, b.w, c);\n return mix(a.xyz, b.xyz, c);\n}\nfloat pseudoRandom(float x) {\n#if USE_VK_SHADER\n float o = x;\n x = mod(x - 1.0, 2.0) - 1.0;\n float freqVar = 10.16640753482;\n float y = sin(freqVar * floor(o * 0.5 - 0.5));\n float v = max(0.0, 1.0-abs(x));\n v *= 0.7071067812;\n v = y < 0.0 ? -v : v;\n return v;\n#endif\n#if !USE_VK_SHADER\n float seed = mod(x, 233280.);\n float q = (seed * 9301. + 49297.) / 233280.;\n return fract(q);\n#endif\n}\n#if COLOR_OVER_TIME_MODULE_ENABLE\n uniform sampler2D color_over_time_tex0;\n layout(std140) uniform ColorConstant {\n int u_color_mode;\n };\n#endif\n#if ROTATION_OVER_TIME_MODULE_ENABLE\n uniform sampler2D rotation_over_time_tex0;\n layout(std140) uniform RotationConstant {\n int u_rotation_mode;\n };\n#endif\n#if SIZE_OVER_TIME_MODULE_ENABLE\n uniform sampler2D size_over_time_tex0;\n layout(std140) uniform SizeConstant {\n int u_size_mode;\n };\n#endif\n#if FORCE_OVER_TIME_MODULE_ENABLE\n uniform sampler2D force_over_time_tex0;\n layout(std140) uniform ForceConstant {\n int u_force_mode;\n int u_force_space;\n };\n#endif\n#if VELOCITY_OVER_TIME_MODULE_ENABLE\n uniform sampler2D velocity_over_time_tex0;\n layout(std140) uniform VelocityConstant {\n int u_velocity_mode;\n int u_velocity_space;\n };\n#endif\n#if TEXTURE_ANIMATION_MODULE_ENABLE\n uniform sampler2D texture_animation_tex0;\n layout(std140) uniform AnimationConstant {\n vec4 u_anim_info;\n };\n#endif\nfloat repeat (float t, float length) {\n return t - floor(t / length) * length;\n}\nvec4 rotateQuat (vec4 p, vec4 q) {\n vec3 iv = cross(q.xyz, p.xyz) + q.w * p.xyz;\n vec3 res = p.xyz + 2.0 * cross(q.xyz, iv);\n return vec4(res.xyz, p.w);\n}\nvec4 gpvs_main () {\n float activeTime = u_timeDelta.x - a_position_starttime.w;\n float normalizedTime = clamp(activeTime / a_dir_life.w, 0.0, 1.0);\n vec2 timeCoord0 = vec2(normalizedTime, 0.);\n vec2 timeCoord1 = vec2(normalizedTime, 1.);\n #if CC_RENDER_MODE == 4\n vec2 vertIdx = vec2(a_texCoord.x, a_texCoord.y);\n #endif\n #if CC_RENDER_MODE != 4\n #if !CC_INSTANCE_PARTICLE\n vec2 vertIdx = vec2(a_size_uv.w, a_rotation_uv.w);\n #endif\n #if CC_INSTANCE_PARTICLE\n vec2 vertIdx = a_uv.xy;\n #endif\n #endif\n vec4 velocity = vec4(a_dir_life.xyz, 0.);\n vec4 pos = vec4(a_position_starttime.xyz, 1.);\n #if !CC_INSTANCE_PARTICLE\n vec3 size = a_size_uv.xyz;\n #endif\n #if CC_INSTANCE_PARTICLE\n vec3 size = a_size_fid.xyz;\n #endif\n #if SIZE_OVER_TIME_MODULE_ENABLE\n if (u_size_mode == 1) {\n size *= unpackCurveData(size_over_time_tex0, timeCoord0);\n } else {\n vec3 size_0 = unpackCurveData(size_over_time_tex0, timeCoord0);\n vec3 size_1 = unpackCurveData(size_over_time_tex0, timeCoord1);\n float factor_s = pseudoRandom(a_rndSeed + 39825.);\n size *= mix(size_0, size_1, factor_s);\n }\n #endif\n vec3 compScale = scale.xyz * size;\n #if FORCE_OVER_TIME_MODULE_ENABLE\n vec3 forceAnim = vec3(0.);\n if (u_force_mode == 1) {\n forceAnim = unpackCurveData(force_over_time_tex0, timeCoord0);\n } else {\n vec3 force_0 = unpackCurveData(force_over_time_tex0, timeCoord0);\n vec3 force_1 = unpackCurveData(force_over_time_tex0, timeCoord1);\n float factor_f = pseudoRandom(a_rndSeed + 212165.);\n forceAnim = mix(force_0, force_1, factor_f);\n }\n vec4 forceTrack = vec4(forceAnim, 0.);\n if (u_force_space == 0) {\n forceTrack = rotateQuat(forceTrack, u_worldRot);\n }\n velocity.xyz += forceTrack.xyz;\n #endif\n #if VELOCITY_OVER_TIME_MODULE_ENABLE\n float speedModifier0 = 1.;\n float speedModifier1 = 1.;\n vec3 velocityAnim = vec3(0.);\n if (u_velocity_mode == 1) {\n velocityAnim = unpackCurveData(velocity_over_time_tex0, timeCoord0, speedModifier0);\n } else {\n vec3 vectory_0 = unpackCurveData(velocity_over_time_tex0, timeCoord0, speedModifier0);\n vec3 vectory_1 = unpackCurveData(velocity_over_time_tex0, timeCoord1, speedModifier1);\n float factor_v = pseudoRandom(a_rndSeed + 197866.);\n velocityAnim = mix(vectory_0, vectory_1, factor_v);\n speedModifier0 = mix(speedModifier0, speedModifier1, factor_v);\n }\n vec4 velocityTrack = vec4(velocityAnim, 0.);\n if (u_velocity_space == 0) {\n velocityTrack = rotateQuat(velocityTrack, u_worldRot);\n }\n velocity.xyz += velocityTrack.xyz;\n velocity.xyz *= speedModifier0;\n #endif\n pos.xyz += velocity.xyz * normalizedTime * a_dir_life.w;\n #if !CC_USE_WORLD_SPACE\n pos = cc_matWorld * pos;\n #if CC_RENDER_MODE == 1\n velocity = rotateQuat(velocity, u_worldRot);\n #endif\n #endif\n #if !CC_INSTANCE_PARTICLE\n vec3 startRotation = a_rotation_uv.xyz;\n #endif\n #if CC_INSTANCE_PARTICLE\n vec3 startRotation = a_rotation;\n #endif\n #if CC_RENDER_MODE != 4\n #if CC_RENDER_MODE == 0\n vec3 rotEuler = startRotation.xyz;\n #elif CC_RENDER_MODE == 1\n vec3 rotEuler = vec3(0.);\n #endif\n #if CC_RENDER_MODE != 0 && CC_RENDER_MODE != 1\n vec3 rotEuler = vec3(0., 0., startRotation.z);\n #endif\n vec4 rot = quaternionFromEuler(rotEuler);\n #endif\n #if CC_RENDER_MODE == 4\n vec4 rot = quaternionFromEuler(startRotation);\n #endif\n #if ROTATION_OVER_TIME_MODULE_ENABLE\n if (u_rotation_mode == 1) {\n vec3 euler = unpackCurveData(rotation_over_time_tex0, timeCoord0) * normalizedTime * a_dir_life.w;\n vec4 quat = eulerToQuat(euler);\n mat3 mLocal = quatToMat3(quat);\n mat3 mStart = quatToMat3(rot);\n rot = mat3ToQuat(mStart * mLocal);\n } else {\n vec3 rotation_0 = unpackCurveData(rotation_over_time_tex0, timeCoord0);\n vec3 rotation_1 = unpackCurveData(rotation_over_time_tex0, timeCoord1);\n float factor_r = pseudoRandom(a_rndSeed + 125292.);\n vec3 euler = mix(rotation_0, rotation_1, factor_r) * normalizedTime * a_dir_life.w;\n #if CC_RENDER_MODE == 3 || CC_RENDER_MODE == 2\n euler = vec3(0.0, 0.0, euler.z);\n #endif\n vec4 quat = eulerToQuat(euler);\n mat3 mLocal = quatToMat3(quat);\n mat3 mStart = quatToMat3(rot);\n rot = mat3ToQuat(mStart * mLocal);\n }\n #endif\n #if COLOR_OVER_TIME_MODULE_ENABLE\n if (u_color_mode == 1) {\n color = a_color * texture(color_over_time_tex0, timeCoord0);\n } else {\n vec4 color_0 = texture(color_over_time_tex0, timeCoord0);\n vec4 color_1 = texture(color_over_time_tex0, timeCoord1);\n float factor_c = pseudoRandom(a_rndSeed + 91041.);\n color = a_color * mix(color_0, color_1, factor_c);\n }\n #endif\n #if !COLOR_OVER_TIME_MODULE_ENABLE\n color = a_color;\n #endif\n #if CC_RENDER_MODE != 4\n vec2 cornerOffset = vec2((vertIdx - 0.5));\n #if CC_RENDER_MODE == 1\n rot = vec4(0.0, 0.0, 0.0, 1.0);\n #endif\n computeVertPos(pos, cornerOffset, rot, compScale\n #if CC_RENDER_MODE == 0 || CC_RENDER_MODE == 3\n , cc_matViewInv\n #endif\n #if CC_RENDER_MODE == 1\n , cc_cameraPos.xyz\n , velocity\n , frameTile_velLenScale.z\n , frameTile_velLenScale.w\n #if !CC_INSTANCE_PARTICLE\n , a_size_uv.w\n #endif\n #if CC_INSTANCE_PARTICLE\n , a_uv.x\n #endif\n #endif\n );\n #endif\n #if CC_RENDER_MODE == 4\n mat3 rotMat = quatToMat3(rot);\n mat3 nodeMat = quatToMat3(nodeRotation);\n rotMat = nodeMat * rotMat;\n rot = mat3ToQuat(rotMat);\n mat4 xformNoScale = matrixFromRT(rot, pos.xyz);\n mat4 xform = matFromRTS(rot, pos.xyz, compScale);\n pos = xform * vec4(a_texCoord3, 1);\n vec4 normal = xformNoScale * vec4(a_normal, 0);\n color *= a_color1;\n #endif\n pos = cc_matViewProj * pos;\n float frameIndex = 0.;\n #if TEXTURE_ANIMATION_MODULE_ENABLE\n float startFrame = 0.;\n vec3 frameInfo = vec3(0.);\n if (int(u_anim_info.x) == 1) {\n frameInfo = unpackCurveData(texture_animation_tex0, timeCoord0);\n } else {\n vec3 frameInfo0 = unpackCurveData(texture_animation_tex0, timeCoord0);\n vec3 frameInfo1 = unpackCurveData(texture_animation_tex0, timeCoord1);\n float factor_t = pseudoRandom(a_rndSeed + 90794.);\n frameInfo = mix(frameInfo0, frameInfo1, factor_t);\n }\n startFrame = frameInfo.x / u_anim_info.y;\n float EPSILON = 1e-6;\n frameIndex = repeat(u_anim_info.z * (frameInfo.y + startFrame), 1. + EPSILON);\n #endif\n uv = computeUV(frameIndex, vertIdx, frameTile_velLenScale.xy) * mainTiling_Offset.xy + mainTiling_Offset.zw;\n return pos;\n}\nvoid main() { gl_Position = gpvs_main(); }",
  4302. "frag": "\nprecision mediump float;\nlayout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nvec4 CCFragOutput (vec4 color) {\n return color;\n}\nin vec2 uv;\nin vec4 color;\nuniform sampler2D mainTexture;\nvec4 premultiplied () {\n vec4 col = color * texture(mainTexture, uv) * color.a;\n return CCFragOutput(col);\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = premultiplied(); }"
  4303. },
  4304. "glsl1": {
  4305. "vert": "\nprecision mediump float;\nvec4 quaternionFromAxis (vec3 xAxis,vec3 yAxis,vec3 zAxis){\n mat3 m = mat3(xAxis,yAxis,zAxis);\n float trace = m[0][0] + m[1][1] + m[2][2];\n vec4 quat;\n if (trace > 0.) {\n float s = 0.5 / sqrt(trace + 1.0);\n quat.w = 0.25 / s;\n quat.x = (m[2][1] - m[1][2]) * s;\n quat.y = (m[0][2] - m[2][0]) * s;\n quat.z = (m[1][0] - m[0][1]) * s;\n } else if ((m[0][0] > m[1][1]) && (m[0][0] > m[2][2])) {\n float s = 2.0 * sqrt(1.0 + m[0][0] - m[1][1] - m[2][2]);\n quat.w = (m[2][1] - m[1][2]) / s;\n quat.x = 0.25 * s;\n quat.y = (m[0][1] + m[1][0]) / s;\n quat.z = (m[0][2] + m[2][0]) / s;\n } else if (m[1][1] > m[2][2]) {\n float s = 2.0 * sqrt(1.0 + m[1][1] - m[0][0] - m[2][2]);\n quat.w = (m[0][2] - m[2][0]) / s;\n quat.x = (m[0][1] + m[1][0]) / s;\n quat.y = 0.25 * s;\n quat.z = (m[1][2] + m[2][1]) / s;\n } else {\n float s = 2.0 * sqrt(1.0 + m[2][2] - m[0][0] - m[1][1]);\n quat.w = (m[1][0] - m[0][1]) / s;\n quat.x = (m[0][2] + m[2][0]) / s;\n quat.y = (m[1][2] + m[2][1]) / s;\n quat.z = 0.25 * s;\n }\n float len = quat.x * quat.x + quat.y * quat.y + quat.z * quat.z + quat.w * quat.w;\n if (len > 0.) {\n len = 1. / sqrt(len);\n quat.x = quat.x * len;\n quat.y = quat.y * len;\n quat.z = quat.z * len;\n quat.w = quat.w * len;\n }\n return quat;\n}\nvec4 quaternionFromEuler (vec3 angle){\n float x = angle.x / 2.;\n float y = angle.y / 2.;\n float z = angle.z / 2.;\n float sx = sin(x);\n float cx = cos(x);\n float sy = sin(y);\n float cy = cos(y);\n float sz = sin(z);\n float cz = cos(z);\n vec4 quat = vec4(0);\n quat.x = sx * cy * cz + cx * sy * sz;\n quat.y = cx * sy * cz + sx * cy * sz;\n quat.z = cx * cy * sz - sx * sy * cz;\n quat.w = cx * cy * cz - sx * sy * sz;\n return quat;\n}\nmat4 matrixFromRT (vec4 q, vec3 p){\n float x2 = q.x + q.x;\n float y2 = q.y + q.y;\n float z2 = q.z + q.z;\n float xx = q.x * x2;\n float xy = q.x * y2;\n float xz = q.x * z2;\n float yy = q.y * y2;\n float yz = q.y * z2;\n float zz = q.z * z2;\n float wx = q.w * x2;\n float wy = q.w * y2;\n float wz = q.w * z2;\n return mat4(\n 1. - (yy + zz), xy + wz, xz - wy, 0,\n xy - wz, 1. - (xx + zz), yz + wx, 0,\n xz + wy, yz - wx, 1. - (xx + yy), 0,\n p.x, p.y, p.z, 1\n );\n}\nmat4 matFromRTS (vec4 q, vec3 t, vec3 s){\n float x = q.x, y = q.y, z = q.z, w = q.w;\n float x2 = x + x;\n float y2 = y + y;\n float z2 = z + z;\n float xx = x * x2;\n float xy = x * y2;\n float xz = x * z2;\n float yy = y * y2;\n float yz = y * z2;\n float zz = z * z2;\n float wx = w * x2;\n float wy = w * y2;\n float wz = w * z2;\n float sx = s.x;\n float sy = s.y;\n float sz = s.z;\n return mat4((1. - (yy + zz)) * sx, (xy + wz) * sx, (xz - wy) * sx, 0,\n (xy - wz) * sy, (1. - (xx + zz)) * sy, (yz + wx) * sy, 0,\n (xz + wy) * sz, (yz - wx) * sz, (1. - (xx + yy)) * sz, 0,\n t.x, t.y, t.z, 1);\n}\nvec4 quatMultiply (vec4 a, vec4 b){\n vec4 quat;\n quat.x = a.x * b.w + a.w * b.x + a.y * b.z - a.z * b.y;\n quat.y = a.y * b.w + a.w * b.y + a.z * b.x - a.x * b.z;\n quat.z = a.z * b.w + a.w * b.z + a.x * b.y - a.y * b.x;\n quat.w = a.w * b.w - a.x * b.x - a.y * b.y - a.z * b.z;\n return quat;\n}\nvoid rotateVecFromQuat (inout vec3 v, vec4 q){\n float ix = q.w * v.x + q.y * v.z - q.z * v.y;\n float iy = q.w * v.y + q.z * v.x - q.x * v.z;\n float iz = q.w * v.z + q.x * v.y - q.y * v.x;\n float iw = -q.x * v.x - q.y * v.y - q.z * v.z;\n v.x = ix * q.w + iw * -q.x + iy * -q.z - iz * -q.y;\n v.y = iy * q.w + iw * -q.y + iz * -q.x - ix * -q.z;\n v.z = iz * q.w + iw * -q.z + ix * -q.y - iy * -q.x;\n}\nvec3 rotateInLocalSpace (vec3 pos, vec3 xAxis, vec3 yAxis, vec3 zAxis, vec4 q){\n vec4 viewQuat = quaternionFromAxis(xAxis, yAxis, zAxis);\n vec4 rotQuat = quatMultiply(viewQuat, q);\n rotateVecFromQuat(pos, rotQuat);\n return pos;\n}\nmat3 quatToMat3(vec4 q) {\n vec3 m0 = vec3(\n 1.0 - 2.0 * q.y * q.y - 2.0 * q.z * q.z,\n 2.0 * q.x * q.y + 2.0 * q.w * q.z,\n 2.0 * q.x * q.z - 2.0 * q.w * q.y);\n\tvec3 m1 = vec3(\n 2.0 * q.x * q.y - 2.0 * q.w * q.z,\n 1.0 - 2.0 * q.x * q.x - 2.0 * q.z * q.z,\n 2.0 * q.y * q.z + 2.0 * q.w * q.x);\n\tvec3 m2 = vec3(\n 2.0 * q.x * q.z + 2.0 * q.w * q.y,\n 2.0 * q.y * q.z - 2.0 * q.w * q.x,\n 1.0 - 2.0 * q.x * q.x - 2.0 * q.y * q.y);\n return mat3(m0, m1, m2);\n}\nvec4 mat3ToQuat(mat3 mat) {\n float tr = mat[0][0] + mat[1][1] + mat[2][2];\n\tfloat qw, qx, qy, qz;\n if (tr > 0.0) {\n float S = sqrt(tr + 1.0) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = 0.25 * S;\n\t qx = (mat[1][2] - mat[2][1]) * invS;\n\t qy = (mat[2][0] - mat[0][2]) * invS;\n\t qz = (mat[0][1] - mat[1][0]) * invS;\n } else if ((mat[0][0] > mat[1][1])&&(mat[0][0] > mat[2][2])) {\n float S = sqrt(1.0 + mat[0][0] - mat[1][1] - mat[2][2]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[1][2] - mat[2][1]) * invS;\n\t qx = 0.25 * S;\n\t qy = (mat[1][0] + mat[0][1]) * invS;\n\t qz = (mat[2][0] + mat[0][2]) * invS;\n } else if (mat[1][1] > mat[2][2]) {\n\t float S = sqrt(1.0 + mat[1][1] - mat[0][0] - mat[2][2]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[2][0] - mat[0][2]) * invS;\n\t qx = (mat[1][0] + mat[0][1]) * invS;\n\t qy = 0.25 * S;\n\t qz = (mat[2][1] + mat[1][2]) * invS;\n } else {\n\t float S = sqrt(1.0 + mat[2][2] - mat[0][0] - mat[1][1]) * 2.0;\n\t float invS = 1.0 / S;\n\t qw = (mat[0][1] - mat[1][0]) * invS;\n\t qx = (mat[2][0] + mat[0][2]) * invS;\n\t qy = (mat[2][1] + mat[1][2]) * invS;\n\t qz = 0.25 * S;\n }\n return vec4(qx, qy, qz, qw);\n}\nvec4 eulerToQuat(vec3 euler) {\n vec3 er = euler * 0.5;\n float x = er.x, y = er.y, z = er.z;\n float sx = sin(x);\n float cx = cos(x);\n float sy = sin(y);\n float cy = cos(y);\n float sz = sin(z);\n float cz = cos(z);\n vec4 quat;\n quat.x = sx * cy * cz + cx * sy * sz;\n quat.y = cx * sy * cz + sx * cy * sz;\n quat.z = cx * cy * sz - sx * sy * cz;\n quat.w = cx * cy * cz - sx * sy * sz;\n return quat;\n}\n uniform vec4 mainTiling_Offset;\n uniform vec4 frameTile_velLenScale;\n uniform vec4 scale;\n uniform vec4 nodeRotation;\nuniform highp mat4 cc_matView;\n uniform highp mat4 cc_matViewInv;\n uniform highp mat4 cc_matViewProj;\n uniform highp vec4 cc_cameraPos;\nuniform highp mat4 cc_matWorld;\nvarying mediump vec2 uv;\nvarying mediump vec4 color;\nvoid computeVertPos (inout vec4 pos, vec2 vertOffset, vec4 q, vec3 s\n#if CC_RENDER_MODE == 0 || CC_RENDER_MODE == 3\n , mat4 viewInv\n#endif\n#if CC_RENDER_MODE == 1\n , vec3 eye\n , vec4 velocity\n , float velocityScale\n , float lengthScale\n , float xIndex\n#endif\n) {\n#if CC_RENDER_MODE == 0\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n vec3 camX = normalize(vec3(viewInv[0][0], viewInv[1][0], viewInv[2][0]));\n vec3 camY = normalize(vec3(viewInv[0][1], viewInv[1][1], viewInv[2][1]));\n vec3 camZ = normalize(vec3(viewInv[0][2], viewInv[1][2], viewInv[2][2]));\n pos.xyz += rotateInLocalSpace(viewSpaceVert, camX, camY, camZ, q);\n#elif CC_RENDER_MODE == 1\n vec3 camRight = normalize(cross(pos.xyz - eye, velocity.xyz)) * s.x;\n vec3 camUp = velocity.xyz * velocityScale + normalize(velocity.xyz) * lengthScale * s.y;\n pos.xyz += (camRight * abs(vertOffset.x) * sign(vertOffset.y)) - camUp * xIndex;\n#elif CC_RENDER_MODE == 2\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n vec3 camX = vec3(1, 0, 0);\n vec3 camY = vec3(0, 0, -1);\n pos.xyz += rotateInLocalSpace(viewSpaceVert, camX, camY, cross(camX, camY), q);\n#elif CC_RENDER_MODE == 3\n vec3 viewSpaceVert = vec3(vertOffset.x * s.x, vertOffset.y * s.y, 0.);\n rotateVecFromQuat(viewSpaceVert, q);\n vec3 camX = normalize(vec3(cc_matView[0][0], cc_matView[1][0], cc_matView[2][0]));\n vec3 camY = vec3(0, 1, 0);\n vec3 offset = camX * viewSpaceVert.x + camY * viewSpaceVert.y;\n pos.xyz += offset;\n#else\n pos.x += vertOffset.x;\n pos.y += vertOffset.y;\n#endif\n}\nvec2 computeUV (float frameIndex, vec2 vertIndex, vec2 frameTile){\n vec2 aniUV = vec2(0, floor(frameIndex * frameTile.y));\n aniUV.x = floor(frameIndex * frameTile.x * frameTile.y - aniUV.y * frameTile.x);\n#if CC_RENDER_MODE != 4\n vertIndex.y = 1. - vertIndex.y;\n#endif\n return (aniUV.xy + vertIndex) / vec2(frameTile.x, frameTile.y);\n}\n uniform vec4 u_sampleInfo;\n uniform vec4 u_worldRot;\n uniform vec4 u_timeDelta;\nattribute vec4 a_position_starttime;\nattribute vec4 a_color;\nattribute vec4 a_dir_life;\nattribute float a_rndSeed;\n#if !CC_INSTANCE_PARTICLE\n attribute vec4 a_size_uv;\n attribute vec4 a_rotation_uv;\n#endif\n#if CC_INSTANCE_PARTICLE\n attribute vec4 a_size_fid;\n attribute vec3 a_rotation;\n attribute vec3 a_uv;\n#endif\n#if CC_RENDER_MODE == 4\n attribute vec3 a_texCoord;\n attribute vec3 a_texCoord3;\n attribute vec3 a_normal;\n attribute vec4 a_color1;\n#endif\nvec3 unpackCurveData (sampler2D tex, vec2 coord) {\n vec4 a = texture2D(tex, coord);\n vec4 b = texture2D(tex, coord + u_sampleInfo.y);\n float c = fract(coord.x * u_sampleInfo.x);\n return mix(a.xyz, b.xyz, c);\n}\nvec3 unpackCurveData (sampler2D tex, vec2 coord, out float w) {\n vec4 a = texture2D(tex, coord);\n vec4 b = texture2D(tex, coord + u_sampleInfo.y);\n float c = fract(coord.x * u_sampleInfo.x);\n w = mix(a.w, b.w, c);\n return mix(a.xyz, b.xyz, c);\n}\nfloat pseudoRandom(float x) {\n#if USE_VK_SHADER\n float o = x;\n x = mod(x - 1.0, 2.0) - 1.0;\n float freqVar = 10.16640753482;\n float y = sin(freqVar * floor(o * 0.5 - 0.5));\n float v = max(0.0, 1.0-abs(x));\n v *= 0.7071067812;\n v = y < 0.0 ? -v : v;\n return v;\n#endif\n#if !USE_VK_SHADER\n float seed = mod(x, 233280.);\n float q = (seed * 9301. + 49297.) / 233280.;\n return fract(q);\n#endif\n}\n#if COLOR_OVER_TIME_MODULE_ENABLE\n uniform sampler2D color_over_time_tex0;\n uniform int u_color_mode;\n#endif\n#if ROTATION_OVER_TIME_MODULE_ENABLE\n uniform sampler2D rotation_over_time_tex0;\n uniform int u_rotation_mode;\n#endif\n#if SIZE_OVER_TIME_MODULE_ENABLE\n uniform sampler2D size_over_time_tex0;\n uniform int u_size_mode;\n#endif\n#if FORCE_OVER_TIME_MODULE_ENABLE\n uniform sampler2D force_over_time_tex0;\n uniform int u_force_mode;\n uniform int u_force_space;\n#endif\n#if VELOCITY_OVER_TIME_MODULE_ENABLE\n uniform sampler2D velocity_over_time_tex0;\n uniform int u_velocity_mode;\n uniform int u_velocity_space;\n#endif\n#if TEXTURE_ANIMATION_MODULE_ENABLE\n uniform sampler2D texture_animation_tex0;\n uniform vec4 u_anim_info;\n#endif\nfloat repeat (float t, float length) {\n return t - floor(t / length) * length;\n}\nvec4 rotateQuat (vec4 p, vec4 q) {\n vec3 iv = cross(q.xyz, p.xyz) + q.w * p.xyz;\n vec3 res = p.xyz + 2.0 * cross(q.xyz, iv);\n return vec4(res.xyz, p.w);\n}\nvec4 gpvs_main () {\n float activeTime = u_timeDelta.x - a_position_starttime.w;\n float normalizedTime = clamp(activeTime / a_dir_life.w, 0.0, 1.0);\n vec2 timeCoord0 = vec2(normalizedTime, 0.);\n vec2 timeCoord1 = vec2(normalizedTime, 1.);\n #if CC_RENDER_MODE == 4\n vec2 vertIdx = vec2(a_texCoord.x, a_texCoord.y);\n #endif\n #if CC_RENDER_MODE != 4\n #if !CC_INSTANCE_PARTICLE\n vec2 vertIdx = vec2(a_size_uv.w, a_rotation_uv.w);\n #endif\n #if CC_INSTANCE_PARTICLE\n vec2 vertIdx = a_uv.xy;\n #endif\n #endif\n vec4 velocity = vec4(a_dir_life.xyz, 0.);\n vec4 pos = vec4(a_position_starttime.xyz, 1.);\n #if !CC_INSTANCE_PARTICLE\n vec3 size = a_size_uv.xyz;\n #endif\n #if CC_INSTANCE_PARTICLE\n vec3 size = a_size_fid.xyz;\n #endif\n #if SIZE_OVER_TIME_MODULE_ENABLE\n if (u_size_mode == 1) {\n size *= unpackCurveData(size_over_time_tex0, timeCoord0);\n } else {\n vec3 size_0 = unpackCurveData(size_over_time_tex0, timeCoord0);\n vec3 size_1 = unpackCurveData(size_over_time_tex0, timeCoord1);\n float factor_s = pseudoRandom(a_rndSeed + 39825.);\n size *= mix(size_0, size_1, factor_s);\n }\n #endif\n vec3 compScale = scale.xyz * size;\n #if FORCE_OVER_TIME_MODULE_ENABLE\n vec3 forceAnim = vec3(0.);\n if (u_force_mode == 1) {\n forceAnim = unpackCurveData(force_over_time_tex0, timeCoord0);\n } else {\n vec3 force_0 = unpackCurveData(force_over_time_tex0, timeCoord0);\n vec3 force_1 = unpackCurveData(force_over_time_tex0, timeCoord1);\n float factor_f = pseudoRandom(a_rndSeed + 212165.);\n forceAnim = mix(force_0, force_1, factor_f);\n }\n vec4 forceTrack = vec4(forceAnim, 0.);\n if (u_force_space == 0) {\n forceTrack = rotateQuat(forceTrack, u_worldRot);\n }\n velocity.xyz += forceTrack.xyz;\n #endif\n #if VELOCITY_OVER_TIME_MODULE_ENABLE\n float speedModifier0 = 1.;\n float speedModifier1 = 1.;\n vec3 velocityAnim = vec3(0.);\n if (u_velocity_mode == 1) {\n velocityAnim = unpackCurveData(velocity_over_time_tex0, timeCoord0, speedModifier0);\n } else {\n vec3 vectory_0 = unpackCurveData(velocity_over_time_tex0, timeCoord0, speedModifier0);\n vec3 vectory_1 = unpackCurveData(velocity_over_time_tex0, timeCoord1, speedModifier1);\n float factor_v = pseudoRandom(a_rndSeed + 197866.);\n velocityAnim = mix(vectory_0, vectory_1, factor_v);\n speedModifier0 = mix(speedModifier0, speedModifier1, factor_v);\n }\n vec4 velocityTrack = vec4(velocityAnim, 0.);\n if (u_velocity_space == 0) {\n velocityTrack = rotateQuat(velocityTrack, u_worldRot);\n }\n velocity.xyz += velocityTrack.xyz;\n velocity.xyz *= speedModifier0;\n #endif\n pos.xyz += velocity.xyz * normalizedTime * a_dir_life.w;\n #if !CC_USE_WORLD_SPACE\n pos = cc_matWorld * pos;\n #if CC_RENDER_MODE == 1\n velocity = rotateQuat(velocity, u_worldRot);\n #endif\n #endif\n #if !CC_INSTANCE_PARTICLE\n vec3 startRotation = a_rotation_uv.xyz;\n #endif\n #if CC_INSTANCE_PARTICLE\n vec3 startRotation = a_rotation;\n #endif\n #if CC_RENDER_MODE != 4\n #if CC_RENDER_MODE == 0\n vec3 rotEuler = startRotation.xyz;\n #elif CC_RENDER_MODE == 1\n vec3 rotEuler = vec3(0.);\n #endif\n #if CC_RENDER_MODE != 0 && CC_RENDER_MODE != 1\n vec3 rotEuler = vec3(0., 0., startRotation.z);\n #endif\n vec4 rot = quaternionFromEuler(rotEuler);\n #endif\n #if CC_RENDER_MODE == 4\n vec4 rot = quaternionFromEuler(startRotation);\n #endif\n #if ROTATION_OVER_TIME_MODULE_ENABLE\n if (u_rotation_mode == 1) {\n vec3 euler = unpackCurveData(rotation_over_time_tex0, timeCoord0) * normalizedTime * a_dir_life.w;\n vec4 quat = eulerToQuat(euler);\n mat3 mLocal = quatToMat3(quat);\n mat3 mStart = quatToMat3(rot);\n rot = mat3ToQuat(mStart * mLocal);\n } else {\n vec3 rotation_0 = unpackCurveData(rotation_over_time_tex0, timeCoord0);\n vec3 rotation_1 = unpackCurveData(rotation_over_time_tex0, timeCoord1);\n float factor_r = pseudoRandom(a_rndSeed + 125292.);\n vec3 euler = mix(rotation_0, rotation_1, factor_r) * normalizedTime * a_dir_life.w;\n #if CC_RENDER_MODE == 3 || CC_RENDER_MODE == 2\n euler = vec3(0.0, 0.0, euler.z);\n #endif\n vec4 quat = eulerToQuat(euler);\n mat3 mLocal = quatToMat3(quat);\n mat3 mStart = quatToMat3(rot);\n rot = mat3ToQuat(mStart * mLocal);\n }\n #endif\n #if COLOR_OVER_TIME_MODULE_ENABLE\n if (u_color_mode == 1) {\n color = a_color * texture2D(color_over_time_tex0, timeCoord0);\n } else {\n vec4 color_0 = texture2D(color_over_time_tex0, timeCoord0);\n vec4 color_1 = texture2D(color_over_time_tex0, timeCoord1);\n float factor_c = pseudoRandom(a_rndSeed + 91041.);\n color = a_color * mix(color_0, color_1, factor_c);\n }\n #endif\n #if !COLOR_OVER_TIME_MODULE_ENABLE\n color = a_color;\n #endif\n #if CC_RENDER_MODE != 4\n vec2 cornerOffset = vec2((vertIdx - 0.5));\n #if CC_RENDER_MODE == 1\n rot = vec4(0.0, 0.0, 0.0, 1.0);\n #endif\n computeVertPos(pos, cornerOffset, rot, compScale\n #if CC_RENDER_MODE == 0 || CC_RENDER_MODE == 3\n , cc_matViewInv\n #endif\n #if CC_RENDER_MODE == 1\n , cc_cameraPos.xyz\n , velocity\n , frameTile_velLenScale.z\n , frameTile_velLenScale.w\n #if !CC_INSTANCE_PARTICLE\n , a_size_uv.w\n #endif\n #if CC_INSTANCE_PARTICLE\n , a_uv.x\n #endif\n #endif\n );\n #endif\n #if CC_RENDER_MODE == 4\n mat3 rotMat = quatToMat3(rot);\n mat3 nodeMat = quatToMat3(nodeRotation);\n rotMat = nodeMat * rotMat;\n rot = mat3ToQuat(rotMat);\n mat4 xformNoScale = matrixFromRT(rot, pos.xyz);\n mat4 xform = matFromRTS(rot, pos.xyz, compScale);\n pos = xform * vec4(a_texCoord3, 1);\n vec4 normal = xformNoScale * vec4(a_normal, 0);\n color *= a_color1;\n #endif\n pos = cc_matViewProj * pos;\n float frameIndex = 0.;\n #if TEXTURE_ANIMATION_MODULE_ENABLE\n float startFrame = 0.;\n vec3 frameInfo = vec3(0.);\n if (int(u_anim_info.x) == 1) {\n frameInfo = unpackCurveData(texture_animation_tex0, timeCoord0);\n } else {\n vec3 frameInfo0 = unpackCurveData(texture_animation_tex0, timeCoord0);\n vec3 frameInfo1 = unpackCurveData(texture_animation_tex0, timeCoord1);\n float factor_t = pseudoRandom(a_rndSeed + 90794.);\n frameInfo = mix(frameInfo0, frameInfo1, factor_t);\n }\n startFrame = frameInfo.x / u_anim_info.y;\n float EPSILON = 1e-6;\n frameIndex = repeat(u_anim_info.z * (frameInfo.y + startFrame), 1. + EPSILON);\n #endif\n uv = computeUV(frameIndex, vertIdx, frameTile_velLenScale.xy) * mainTiling_Offset.xy + mainTiling_Offset.zw;\n return pos;\n}\nvoid main() { gl_Position = gpvs_main(); }",
  4306. "frag": "\nprecision mediump float;\nvec4 CCFragOutput (vec4 color) {\n return color;\n}\nvarying vec2 uv;\nvarying vec4 color;\nuniform sampler2D mainTexture;\nvec4 premultiplied () {\n vec4 col = color * texture2D(mainTexture, uv) * color.a;\n return CCFragOutput(col);\n}\nvoid main() { gl_FragColor = premultiplied(); }"
  4307. },
  4308. "builtins": {
  4309. "globals": {
  4310. "blocks": [
  4311. {
  4312. "name": "CCGlobal",
  4313. "defines": []
  4314. },
  4315. {
  4316. "name": "CCCamera",
  4317. "defines": []
  4318. }
  4319. ],
  4320. "samplerTextures": [],
  4321. "buffers": [],
  4322. "images": []
  4323. },
  4324. "locals": {
  4325. "blocks": [
  4326. {
  4327. "name": "CCLocal",
  4328. "defines": []
  4329. }
  4330. ],
  4331. "samplerTextures": [],
  4332. "buffers": [],
  4333. "images": []
  4334. },
  4335. "statistics": {
  4336. "CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS": 71,
  4337. "CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS": 42
  4338. }
  4339. },
  4340. "defines": [
  4341. {
  4342. "name": "CC_RENDER_MODE",
  4343. "type": "number",
  4344. "defines": [],
  4345. "range": [
  4346. 0,
  4347. 4
  4348. ]
  4349. },
  4350. {
  4351. "name": "CC_INSTANCE_PARTICLE",
  4352. "type": "boolean",
  4353. "defines": []
  4354. },
  4355. {
  4356. "name": "USE_VK_SHADER",
  4357. "type": "boolean",
  4358. "defines": []
  4359. },
  4360. {
  4361. "name": "COLOR_OVER_TIME_MODULE_ENABLE",
  4362. "type": "boolean",
  4363. "defines": []
  4364. },
  4365. {
  4366. "name": "ROTATION_OVER_TIME_MODULE_ENABLE",
  4367. "type": "boolean",
  4368. "defines": []
  4369. },
  4370. {
  4371. "name": "SIZE_OVER_TIME_MODULE_ENABLE",
  4372. "type": "boolean",
  4373. "defines": []
  4374. },
  4375. {
  4376. "name": "FORCE_OVER_TIME_MODULE_ENABLE",
  4377. "type": "boolean",
  4378. "defines": []
  4379. },
  4380. {
  4381. "name": "VELOCITY_OVER_TIME_MODULE_ENABLE",
  4382. "type": "boolean",
  4383. "defines": []
  4384. },
  4385. {
  4386. "name": "TEXTURE_ANIMATION_MODULE_ENABLE",
  4387. "type": "boolean",
  4388. "defines": []
  4389. },
  4390. {
  4391. "name": "CC_USE_WORLD_SPACE",
  4392. "type": "boolean",
  4393. "defines": []
  4394. }
  4395. ],
  4396. "name": "particles/builtin-particle-gpu|builtin/internal/particle-vs-gpu:gpvs_main|no-tint-fs:premultiplied"
  4397. }
  4398. ],
  4399. "combinations": [],
  4400. "hideInEditor": false
  4401. }