d1346436-ac96-4271-b863-1f4fdead95b0.json 215 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625
  1. {
  2. "__type__": "cc.EffectAsset",
  3. "_name": "particles/builtin-particle",
  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|builtin/internal/particle-vs-legacy:lpvs_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|builtin/internal/particle-vs-legacy:lpvs_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|builtin/internal/particle-vs-legacy:lpvs_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|builtin/internal/particle-vs-legacy:lpvs_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|builtin/internal/particle-vs-legacy:lpvs_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|builtin/internal/particle-vs-legacy:lpvs_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|builtin/internal/particle-vs-legacy:lpvs_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|builtin/internal/particle-vs-legacy:lpvs_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|builtin/internal/particle-vs-legacy:lpvs_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|builtin/internal/particle-vs-legacy:lpvs_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": "FragConstants",
  402. "members": [
  403. {
  404. "name": "tintColor",
  405. "type": 16,
  406. "count": 1
  407. }
  408. ],
  409. "defines": [],
  410. "stageFlags": 16,
  411. "binding": 1
  412. }
  413. ],
  414. "samplerTextures": [
  415. {
  416. "name": "mainTexture",
  417. "type": 28,
  418. "count": 1,
  419. "defines": [],
  420. "stageFlags": 16,
  421. "binding": 2
  422. }
  423. ],
  424. "samplers": [],
  425. "textures": [],
  426. "buffers": [],
  427. "images": [],
  428. "subpassInputs": [],
  429. "attributes": [
  430. {
  431. "name": "a_texCoord1",
  432. "defines": [],
  433. "format": 32,
  434. "location": 0
  435. },
  436. {
  437. "name": "a_texCoord2",
  438. "defines": [],
  439. "format": 32,
  440. "location": 1
  441. },
  442. {
  443. "name": "a_color",
  444. "defines": [],
  445. "format": 44,
  446. "location": 2
  447. },
  448. {
  449. "name": "a_texCoord",
  450. "defines": [],
  451. "format": 32,
  452. "location": 3
  453. },
  454. {
  455. "name": "a_position",
  456. "defines": [
  457. "!CC_INSTANCE_PARTICLE"
  458. ],
  459. "format": 32,
  460. "location": 4
  461. },
  462. {
  463. "name": "a_texCoord4",
  464. "defines": [
  465. "CC_INSTANCE_PARTICLE"
  466. ],
  467. "format": 44,
  468. "location": 5
  469. },
  470. {
  471. "name": "a_color1",
  472. "defines": [
  473. "CC_RENDER_MODE"
  474. ],
  475. "format": 32,
  476. "location": 9
  477. },
  478. {
  479. "name": "a_texCoord3",
  480. "defines": [
  481. "CC_RENDER_MODE"
  482. ],
  483. "format": 32,
  484. "location": 7
  485. },
  486. {
  487. "name": "a_normal",
  488. "defines": [
  489. "CC_RENDER_MODE"
  490. ],
  491. "format": 32,
  492. "location": 8
  493. }
  494. ],
  495. "varyings": [
  496. {
  497. "name": "uv",
  498. "type": 14,
  499. "count": 1,
  500. "defines": [],
  501. "stageFlags": 17,
  502. "location": 0
  503. },
  504. {
  505. "name": "color",
  506. "type": 16,
  507. "count": 1,
  508. "defines": [],
  509. "stageFlags": 17,
  510. "location": 1
  511. }
  512. ],
  513. "fragColors": [
  514. {
  515. "name": "cc_FragColor",
  516. "typename": "vec4",
  517. "type": 16,
  518. "count": 1,
  519. "defines": [],
  520. "stageFlags": 16,
  521. "location": 0
  522. }
  523. ],
  524. "descriptors": [
  525. {
  526. "rate": 0,
  527. "blocks": [
  528. {
  529. "tags": {
  530. "builtin": "local"
  531. },
  532. "name": "CCLocal",
  533. "members": [
  534. {
  535. "name": "cc_matWorld",
  536. "typename": "mat4",
  537. "type": 25,
  538. "count": 1,
  539. "precision": "highp "
  540. },
  541. {
  542. "name": "cc_matWorldIT",
  543. "typename": "mat4",
  544. "type": 25,
  545. "count": 1,
  546. "precision": "highp "
  547. },
  548. {
  549. "name": "cc_lightingMapUVParam",
  550. "typename": "vec4",
  551. "type": 16,
  552. "count": 1,
  553. "precision": "highp "
  554. },
  555. {
  556. "name": "cc_localShadowBias",
  557. "typename": "vec4",
  558. "type": 16,
  559. "count": 1,
  560. "precision": "highp "
  561. },
  562. {
  563. "name": "cc_reflectionProbeData1",
  564. "typename": "vec4",
  565. "type": 16,
  566. "count": 1,
  567. "precision": "highp "
  568. },
  569. {
  570. "name": "cc_reflectionProbeData2",
  571. "typename": "vec4",
  572. "type": 16,
  573. "count": 1,
  574. "precision": "highp "
  575. },
  576. {
  577. "name": "cc_reflectionProbeBlendData1",
  578. "typename": "vec4",
  579. "type": 16,
  580. "count": 1,
  581. "precision": "highp "
  582. },
  583. {
  584. "name": "cc_reflectionProbeBlendData2",
  585. "typename": "vec4",
  586. "type": 16,
  587. "count": 1,
  588. "precision": "highp "
  589. }
  590. ],
  591. "defines": [],
  592. "stageFlags": 1
  593. }
  594. ],
  595. "samplerTextures": [],
  596. "samplers": [],
  597. "textures": [],
  598. "buffers": [],
  599. "images": [],
  600. "subpassInputs": []
  601. },
  602. {
  603. "rate": 1,
  604. "blocks": [
  605. {
  606. "name": "Constants",
  607. "members": [
  608. {
  609. "name": "mainTiling_Offset",
  610. "type": 16,
  611. "count": 1
  612. },
  613. {
  614. "name": "frameTile_velLenScale",
  615. "type": 16,
  616. "count": 1
  617. },
  618. {
  619. "name": "scale",
  620. "type": 16,
  621. "count": 1
  622. },
  623. {
  624. "name": "nodeRotation",
  625. "type": 16,
  626. "count": 1
  627. }
  628. ],
  629. "defines": [],
  630. "stageFlags": 1,
  631. "binding": 0
  632. },
  633. {
  634. "name": "FragConstants",
  635. "members": [
  636. {
  637. "name": "tintColor",
  638. "type": 16,
  639. "count": 1
  640. }
  641. ],
  642. "defines": [],
  643. "stageFlags": 16,
  644. "binding": 1
  645. }
  646. ],
  647. "samplerTextures": [
  648. {
  649. "name": "mainTexture",
  650. "type": 28,
  651. "count": 1,
  652. "defines": [],
  653. "stageFlags": 16,
  654. "binding": 2
  655. }
  656. ],
  657. "samplers": [],
  658. "textures": [],
  659. "buffers": [],
  660. "images": [],
  661. "subpassInputs": []
  662. },
  663. {
  664. "rate": 2,
  665. "blocks": [],
  666. "samplerTextures": [],
  667. "samplers": [],
  668. "textures": [],
  669. "buffers": [],
  670. "images": [],
  671. "subpassInputs": []
  672. },
  673. {
  674. "rate": 3,
  675. "blocks": [
  676. {
  677. "tags": {
  678. "builtin": "global"
  679. },
  680. "name": "CCGlobal",
  681. "members": [
  682. {
  683. "name": "cc_time",
  684. "typename": "vec4",
  685. "type": 16,
  686. "count": 1,
  687. "precision": "highp "
  688. },
  689. {
  690. "name": "cc_screenSize",
  691. "typename": "vec4",
  692. "type": 16,
  693. "count": 1,
  694. "precision": "mediump "
  695. },
  696. {
  697. "name": "cc_nativeSize",
  698. "typename": "vec4",
  699. "type": 16,
  700. "count": 1,
  701. "precision": "mediump "
  702. },
  703. {
  704. "name": "cc_probeInfo",
  705. "typename": "vec4",
  706. "type": 16,
  707. "count": 1,
  708. "precision": "mediump "
  709. },
  710. {
  711. "name": "cc_debug_view_mode",
  712. "typename": "vec4",
  713. "type": 16,
  714. "count": 1,
  715. "precision": "mediump "
  716. }
  717. ],
  718. "defines": [],
  719. "stageFlags": 17
  720. },
  721. {
  722. "tags": {
  723. "builtin": "global"
  724. },
  725. "name": "CCCamera",
  726. "members": [
  727. {
  728. "name": "cc_matView",
  729. "typename": "mat4",
  730. "type": 25,
  731. "count": 1,
  732. "precision": "highp "
  733. },
  734. {
  735. "name": "cc_matViewInv",
  736. "typename": "mat4",
  737. "type": 25,
  738. "count": 1,
  739. "precision": "highp "
  740. },
  741. {
  742. "name": "cc_matProj",
  743. "typename": "mat4",
  744. "type": 25,
  745. "count": 1,
  746. "precision": "highp "
  747. },
  748. {
  749. "name": "cc_matProjInv",
  750. "typename": "mat4",
  751. "type": 25,
  752. "count": 1,
  753. "precision": "highp "
  754. },
  755. {
  756. "name": "cc_matViewProj",
  757. "typename": "mat4",
  758. "type": 25,
  759. "count": 1,
  760. "precision": "highp "
  761. },
  762. {
  763. "name": "cc_matViewProjInv",
  764. "typename": "mat4",
  765. "type": 25,
  766. "count": 1,
  767. "precision": "highp "
  768. },
  769. {
  770. "name": "cc_cameraPos",
  771. "typename": "vec4",
  772. "type": 16,
  773. "count": 1,
  774. "precision": "highp "
  775. },
  776. {
  777. "name": "cc_surfaceTransform",
  778. "typename": "vec4",
  779. "type": 16,
  780. "count": 1,
  781. "precision": "mediump "
  782. },
  783. {
  784. "name": "cc_screenScale",
  785. "typename": "vec4",
  786. "type": 16,
  787. "count": 1,
  788. "precision": "mediump "
  789. },
  790. {
  791. "name": "cc_exposure",
  792. "typename": "vec4",
  793. "type": 16,
  794. "count": 1,
  795. "precision": "mediump "
  796. },
  797. {
  798. "name": "cc_mainLitDir",
  799. "typename": "vec4",
  800. "type": 16,
  801. "count": 1,
  802. "precision": "mediump "
  803. },
  804. {
  805. "name": "cc_mainLitColor",
  806. "typename": "vec4",
  807. "type": 16,
  808. "count": 1,
  809. "precision": "mediump "
  810. },
  811. {
  812. "name": "cc_ambientSky",
  813. "typename": "vec4",
  814. "type": 16,
  815. "count": 1,
  816. "precision": "mediump "
  817. },
  818. {
  819. "name": "cc_ambientGround",
  820. "typename": "vec4",
  821. "type": 16,
  822. "count": 1,
  823. "precision": "mediump "
  824. },
  825. {
  826. "name": "cc_fogColor",
  827. "typename": "vec4",
  828. "type": 16,
  829. "count": 1,
  830. "precision": "mediump "
  831. },
  832. {
  833. "name": "cc_fogBase",
  834. "typename": "vec4",
  835. "type": 16,
  836. "count": 1,
  837. "precision": "mediump "
  838. },
  839. {
  840. "name": "cc_fogAdd",
  841. "typename": "vec4",
  842. "type": 16,
  843. "count": 1,
  844. "precision": "mediump "
  845. },
  846. {
  847. "name": "cc_nearFar",
  848. "typename": "vec4",
  849. "type": 16,
  850. "count": 1,
  851. "precision": "mediump "
  852. },
  853. {
  854. "name": "cc_viewPort",
  855. "typename": "vec4",
  856. "type": 16,
  857. "count": 1,
  858. "precision": "mediump "
  859. }
  860. ],
  861. "defines": [],
  862. "stageFlags": 17
  863. }
  864. ],
  865. "samplerTextures": [],
  866. "samplers": [],
  867. "textures": [],
  868. "buffers": [],
  869. "images": [],
  870. "subpassInputs": []
  871. }
  872. ],
  873. "hash": 3958058022,
  874. "glsl4": {
  875. "vert": "\nprecision highp 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}\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(location = 0) in vec3 a_texCoord1;\nlayout(location = 1) in vec3 a_texCoord2;\nlayout(location = 2) in vec4 a_color;\nlayout(location = 3) in vec3 a_texCoord;\n#if !CC_INSTANCE_PARTICLE\n layout(location = 4) in vec3 a_position;\n#endif\n#if CC_INSTANCE_PARTICLE\n layout(location = 5) in vec4 a_texCoord4;\n#endif\n#if CC_RENDER_MODE == 1\n layout(location = 9) in vec3 a_color1;\n#endif\n#if CC_RENDER_MODE == 4\n layout(location = 7) in vec3 a_texCoord3;\n layout(location = 8) in vec3 a_normal;\n layout(location = 9) in vec4 a_color1;\n#endif\nvec4 lpvs_main () {\n vec3 compScale = scale.xyz * a_texCoord1;\n #if !CC_INSTANCE_PARTICLE\n vec4 pos = vec4(a_position.xyz, 1);\n #endif\n #if CC_INSTANCE_PARTICLE\n vec4 pos = vec4(a_texCoord4.xyz, 1);\n #endif\n #if CC_RENDER_MODE == 1\n vec4 velocity = vec4(a_color1.xyz, 0);\n #endif\n #if !CC_USE_WORLD_SPACE\n pos = cc_matWorld * pos;\n #if CC_RENDER_MODE == 1\n velocity = cc_matWorld * velocity;\n #endif\n #endif\n #if ROTATION_OVER_TIME_MODULE_ENABLE\n vec3 rotTmp = a_texCoord2;\n float mulFactor = 1.0;\n if (rotTmp.x > 10.0 * 0.5) {\n rotTmp.x -= 10.0;\n mulFactor = -1.0;\n }\n vec4 rot = vec4(rotTmp, 0.0);\n rot.w = mulFactor * sqrt(abs(1.0 - rot.x * rot.x - rot.y * rot.y - rot.z * rot.z));\n #endif\n #if !ROTATION_OVER_TIME_MODULE_ENABLE\n #if CC_RENDER_MODE != 4\n #if CC_RENDER_MODE == 0\n vec3 rotEuler = a_texCoord2;\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., a_texCoord2.z);\n #endif\n vec4 rot = quaternionFromEuler(rotEuler);\n #endif\n #if CC_RENDER_MODE == 4\n vec4 rot = quaternionFromEuler(a_texCoord2);\n #endif\n #endif\n #if CC_RENDER_MODE != 4\n vec2 cornerOffset = vec2((a_texCoord.xy - 0.5));\n #if CC_RENDER_MODE == 0 || CC_RENDER_MODE == 3\n computeVertPos(pos, cornerOffset, rot, compScale, cc_matViewInv);\n #elif CC_RENDER_MODE == 1\n computeVertPos(pos, cornerOffset, rot, compScale, cc_cameraPos.xyz, velocity, frameTile_velLenScale.z, frameTile_velLenScale.w, a_texCoord.x);\n #elif 2\n computeVertPos(pos, cornerOffset, rot, compScale);\n #endif\n color = a_color;\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_color * a_color1;\n #endif\n #if !CC_INSTANCE_PARTICLE\n uv = computeUV(a_texCoord.z, a_texCoord.xy, frameTile_velLenScale.xy) * mainTiling_Offset.xy + mainTiling_Offset.zw;\n #endif\n #if CC_INSTANCE_PARTICLE\n uv = computeUV(a_texCoord4.w, a_texCoord.xy, frameTile_velLenScale.xy) * mainTiling_Offset.xy + mainTiling_Offset.zw;\n #endif\n pos = cc_matViewProj * pos;\n return pos;\n}\nvoid main() { gl_Position = lpvs_main(); }",
  876. "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 = 2) uniform sampler2D mainTexture;\nlayout(set = 1, binding = 1) 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(); }"
  877. },
  878. "glsl3": {
  879. "vert": "\nprecision highp 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}\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}\nin vec3 a_texCoord1;\nin vec3 a_texCoord2;\nin vec4 a_color;\nin vec3 a_texCoord;\n#if !CC_INSTANCE_PARTICLE\n in vec3 a_position;\n#endif\n#if CC_INSTANCE_PARTICLE\n in vec4 a_texCoord4;\n#endif\n#if CC_RENDER_MODE == 1\n in vec3 a_color1;\n#endif\n#if CC_RENDER_MODE == 4\n in vec3 a_texCoord3;\n in vec3 a_normal;\n in vec4 a_color1;\n#endif\nvec4 lpvs_main () {\n vec3 compScale = scale.xyz * a_texCoord1;\n #if !CC_INSTANCE_PARTICLE\n vec4 pos = vec4(a_position.xyz, 1);\n #endif\n #if CC_INSTANCE_PARTICLE\n vec4 pos = vec4(a_texCoord4.xyz, 1);\n #endif\n #if CC_RENDER_MODE == 1\n vec4 velocity = vec4(a_color1.xyz, 0);\n #endif\n #if !CC_USE_WORLD_SPACE\n pos = cc_matWorld * pos;\n #if CC_RENDER_MODE == 1\n velocity = cc_matWorld * velocity;\n #endif\n #endif\n #if ROTATION_OVER_TIME_MODULE_ENABLE\n vec3 rotTmp = a_texCoord2;\n float mulFactor = 1.0;\n if (rotTmp.x > 10.0 * 0.5) {\n rotTmp.x -= 10.0;\n mulFactor = -1.0;\n }\n vec4 rot = vec4(rotTmp, 0.0);\n rot.w = mulFactor * sqrt(abs(1.0 - rot.x * rot.x - rot.y * rot.y - rot.z * rot.z));\n #endif\n #if !ROTATION_OVER_TIME_MODULE_ENABLE\n #if CC_RENDER_MODE != 4\n #if CC_RENDER_MODE == 0\n vec3 rotEuler = a_texCoord2;\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., a_texCoord2.z);\n #endif\n vec4 rot = quaternionFromEuler(rotEuler);\n #endif\n #if CC_RENDER_MODE == 4\n vec4 rot = quaternionFromEuler(a_texCoord2);\n #endif\n #endif\n #if CC_RENDER_MODE != 4\n vec2 cornerOffset = vec2((a_texCoord.xy - 0.5));\n #if CC_RENDER_MODE == 0 || CC_RENDER_MODE == 3\n computeVertPos(pos, cornerOffset, rot, compScale, cc_matViewInv);\n #elif CC_RENDER_MODE == 1\n computeVertPos(pos, cornerOffset, rot, compScale, cc_cameraPos.xyz, velocity, frameTile_velLenScale.z, frameTile_velLenScale.w, a_texCoord.x);\n #elif 2\n computeVertPos(pos, cornerOffset, rot, compScale);\n #endif\n color = a_color;\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_color * a_color1;\n #endif\n #if !CC_INSTANCE_PARTICLE\n uv = computeUV(a_texCoord.z, a_texCoord.xy, frameTile_velLenScale.xy) * mainTiling_Offset.xy + mainTiling_Offset.zw;\n #endif\n #if CC_INSTANCE_PARTICLE\n uv = computeUV(a_texCoord4.w, a_texCoord.xy, frameTile_velLenScale.xy) * mainTiling_Offset.xy + mainTiling_Offset.zw;\n #endif\n pos = cc_matViewProj * pos;\n return pos;\n}\nvoid main() { gl_Position = lpvs_main(); }",
  880. "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(); }"
  881. },
  882. "glsl1": {
  883. "vert": "\nprecision highp 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}\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}\nattribute vec3 a_texCoord1;\nattribute vec3 a_texCoord2;\nattribute vec4 a_color;\nattribute vec3 a_texCoord;\n#if !CC_INSTANCE_PARTICLE\n attribute vec3 a_position;\n#endif\n#if CC_INSTANCE_PARTICLE\n attribute vec4 a_texCoord4;\n#endif\n#if CC_RENDER_MODE == 1\n attribute vec3 a_color1;\n#endif\n#if CC_RENDER_MODE == 4\n attribute vec3 a_texCoord3;\n attribute vec3 a_normal;\n attribute vec4 a_color1;\n#endif\nvec4 lpvs_main () {\n vec3 compScale = scale.xyz * a_texCoord1;\n #if !CC_INSTANCE_PARTICLE\n vec4 pos = vec4(a_position.xyz, 1);\n #endif\n #if CC_INSTANCE_PARTICLE\n vec4 pos = vec4(a_texCoord4.xyz, 1);\n #endif\n #if CC_RENDER_MODE == 1\n vec4 velocity = vec4(a_color1.xyz, 0);\n #endif\n #if !CC_USE_WORLD_SPACE\n pos = cc_matWorld * pos;\n #if CC_RENDER_MODE == 1\n velocity = cc_matWorld * velocity;\n #endif\n #endif\n #if ROTATION_OVER_TIME_MODULE_ENABLE\n vec3 rotTmp = a_texCoord2;\n float mulFactor = 1.0;\n if (rotTmp.x > 10.0 * 0.5) {\n rotTmp.x -= 10.0;\n mulFactor = -1.0;\n }\n vec4 rot = vec4(rotTmp, 0.0);\n rot.w = mulFactor * sqrt(abs(1.0 - rot.x * rot.x - rot.y * rot.y - rot.z * rot.z));\n #endif\n #if !ROTATION_OVER_TIME_MODULE_ENABLE\n #if CC_RENDER_MODE != 4\n #if CC_RENDER_MODE == 0\n vec3 rotEuler = a_texCoord2;\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., a_texCoord2.z);\n #endif\n vec4 rot = quaternionFromEuler(rotEuler);\n #endif\n #if CC_RENDER_MODE == 4\n vec4 rot = quaternionFromEuler(a_texCoord2);\n #endif\n #endif\n #if CC_RENDER_MODE != 4\n vec2 cornerOffset = vec2((a_texCoord.xy - 0.5));\n #if CC_RENDER_MODE == 0 || CC_RENDER_MODE == 3\n computeVertPos(pos, cornerOffset, rot, compScale, cc_matViewInv);\n #elif CC_RENDER_MODE == 1\n computeVertPos(pos, cornerOffset, rot, compScale, cc_cameraPos.xyz, velocity, frameTile_velLenScale.z, frameTile_velLenScale.w, a_texCoord.x);\n #elif 2\n computeVertPos(pos, cornerOffset, rot, compScale);\n #endif\n color = a_color;\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_color * a_color1;\n #endif\n #if !CC_INSTANCE_PARTICLE\n uv = computeUV(a_texCoord.z, a_texCoord.xy, frameTile_velLenScale.xy) * mainTiling_Offset.xy + mainTiling_Offset.zw;\n #endif\n #if CC_INSTANCE_PARTICLE\n uv = computeUV(a_texCoord4.w, a_texCoord.xy, frameTile_velLenScale.xy) * mainTiling_Offset.xy + mainTiling_Offset.zw;\n #endif\n pos = cc_matViewProj * pos;\n return pos;\n}\nvoid main() { gl_Position = lpvs_main(); }",
  884. "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(); }"
  885. },
  886. "builtins": {
  887. "globals": {
  888. "blocks": [
  889. {
  890. "name": "CCGlobal",
  891. "defines": []
  892. },
  893. {
  894. "name": "CCCamera",
  895. "defines": []
  896. }
  897. ],
  898. "samplerTextures": [],
  899. "buffers": [],
  900. "images": []
  901. },
  902. "locals": {
  903. "blocks": [
  904. {
  905. "name": "CCLocal",
  906. "defines": []
  907. }
  908. ],
  909. "samplerTextures": [],
  910. "buffers": [],
  911. "images": []
  912. },
  913. "statistics": {
  914. "CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS": 60,
  915. "CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS": 43
  916. }
  917. },
  918. "defines": [
  919. {
  920. "name": "CC_RENDER_MODE",
  921. "type": "number",
  922. "defines": [],
  923. "range": [
  924. 0,
  925. 4
  926. ]
  927. },
  928. {
  929. "name": "CC_INSTANCE_PARTICLE",
  930. "type": "boolean",
  931. "defines": []
  932. },
  933. {
  934. "name": "CC_USE_WORLD_SPACE",
  935. "type": "boolean",
  936. "defines": []
  937. },
  938. {
  939. "name": "ROTATION_OVER_TIME_MODULE_ENABLE",
  940. "type": "boolean",
  941. "defines": []
  942. }
  943. ],
  944. "name": "particles/builtin-particle|builtin/internal/particle-vs-legacy:lpvs_main|tinted-fs:add"
  945. },
  946. {
  947. "blocks": [
  948. {
  949. "name": "Constants",
  950. "members": [
  951. {
  952. "name": "mainTiling_Offset",
  953. "type": 16,
  954. "count": 1
  955. },
  956. {
  957. "name": "frameTile_velLenScale",
  958. "type": 16,
  959. "count": 1
  960. },
  961. {
  962. "name": "scale",
  963. "type": 16,
  964. "count": 1
  965. },
  966. {
  967. "name": "nodeRotation",
  968. "type": 16,
  969. "count": 1
  970. }
  971. ],
  972. "defines": [],
  973. "stageFlags": 1,
  974. "binding": 0
  975. },
  976. {
  977. "name": "FragConstants",
  978. "members": [
  979. {
  980. "name": "tintColor",
  981. "type": 16,
  982. "count": 1
  983. }
  984. ],
  985. "defines": [],
  986. "stageFlags": 16,
  987. "binding": 1
  988. }
  989. ],
  990. "samplerTextures": [
  991. {
  992. "name": "mainTexture",
  993. "type": 28,
  994. "count": 1,
  995. "defines": [],
  996. "stageFlags": 16,
  997. "binding": 2
  998. }
  999. ],
  1000. "samplers": [],
  1001. "textures": [],
  1002. "buffers": [],
  1003. "images": [],
  1004. "subpassInputs": [],
  1005. "attributes": [
  1006. {
  1007. "name": "a_texCoord1",
  1008. "defines": [],
  1009. "format": 32,
  1010. "location": 0
  1011. },
  1012. {
  1013. "name": "a_texCoord2",
  1014. "defines": [],
  1015. "format": 32,
  1016. "location": 1
  1017. },
  1018. {
  1019. "name": "a_color",
  1020. "defines": [],
  1021. "format": 44,
  1022. "location": 2
  1023. },
  1024. {
  1025. "name": "a_texCoord",
  1026. "defines": [],
  1027. "format": 32,
  1028. "location": 3
  1029. },
  1030. {
  1031. "name": "a_position",
  1032. "defines": [
  1033. "!CC_INSTANCE_PARTICLE"
  1034. ],
  1035. "format": 32,
  1036. "location": 4
  1037. },
  1038. {
  1039. "name": "a_texCoord4",
  1040. "defines": [
  1041. "CC_INSTANCE_PARTICLE"
  1042. ],
  1043. "format": 44,
  1044. "location": 5
  1045. },
  1046. {
  1047. "name": "a_color1",
  1048. "defines": [
  1049. "CC_RENDER_MODE"
  1050. ],
  1051. "format": 32,
  1052. "location": 9
  1053. },
  1054. {
  1055. "name": "a_texCoord3",
  1056. "defines": [
  1057. "CC_RENDER_MODE"
  1058. ],
  1059. "format": 32,
  1060. "location": 7
  1061. },
  1062. {
  1063. "name": "a_normal",
  1064. "defines": [
  1065. "CC_RENDER_MODE"
  1066. ],
  1067. "format": 32,
  1068. "location": 8
  1069. }
  1070. ],
  1071. "varyings": [
  1072. {
  1073. "name": "uv",
  1074. "type": 14,
  1075. "count": 1,
  1076. "defines": [],
  1077. "stageFlags": 17,
  1078. "location": 0
  1079. },
  1080. {
  1081. "name": "color",
  1082. "type": 16,
  1083. "count": 1,
  1084. "defines": [],
  1085. "stageFlags": 17,
  1086. "location": 1
  1087. }
  1088. ],
  1089. "fragColors": [
  1090. {
  1091. "name": "cc_FragColor",
  1092. "typename": "vec4",
  1093. "type": 16,
  1094. "count": 1,
  1095. "defines": [],
  1096. "stageFlags": 16,
  1097. "location": 0
  1098. }
  1099. ],
  1100. "descriptors": [
  1101. {
  1102. "rate": 0,
  1103. "blocks": [
  1104. {
  1105. "tags": {
  1106. "builtin": "local"
  1107. },
  1108. "name": "CCLocal",
  1109. "members": [
  1110. {
  1111. "name": "cc_matWorld",
  1112. "typename": "mat4",
  1113. "type": 25,
  1114. "count": 1,
  1115. "precision": "highp "
  1116. },
  1117. {
  1118. "name": "cc_matWorldIT",
  1119. "typename": "mat4",
  1120. "type": 25,
  1121. "count": 1,
  1122. "precision": "highp "
  1123. },
  1124. {
  1125. "name": "cc_lightingMapUVParam",
  1126. "typename": "vec4",
  1127. "type": 16,
  1128. "count": 1,
  1129. "precision": "highp "
  1130. },
  1131. {
  1132. "name": "cc_localShadowBias",
  1133. "typename": "vec4",
  1134. "type": 16,
  1135. "count": 1,
  1136. "precision": "highp "
  1137. },
  1138. {
  1139. "name": "cc_reflectionProbeData1",
  1140. "typename": "vec4",
  1141. "type": 16,
  1142. "count": 1,
  1143. "precision": "highp "
  1144. },
  1145. {
  1146. "name": "cc_reflectionProbeData2",
  1147. "typename": "vec4",
  1148. "type": 16,
  1149. "count": 1,
  1150. "precision": "highp "
  1151. },
  1152. {
  1153. "name": "cc_reflectionProbeBlendData1",
  1154. "typename": "vec4",
  1155. "type": 16,
  1156. "count": 1,
  1157. "precision": "highp "
  1158. },
  1159. {
  1160. "name": "cc_reflectionProbeBlendData2",
  1161. "typename": "vec4",
  1162. "type": 16,
  1163. "count": 1,
  1164. "precision": "highp "
  1165. }
  1166. ],
  1167. "defines": [],
  1168. "stageFlags": 1
  1169. }
  1170. ],
  1171. "samplerTextures": [],
  1172. "samplers": [],
  1173. "textures": [],
  1174. "buffers": [],
  1175. "images": [],
  1176. "subpassInputs": []
  1177. },
  1178. {
  1179. "rate": 1,
  1180. "blocks": [
  1181. {
  1182. "name": "Constants",
  1183. "members": [
  1184. {
  1185. "name": "mainTiling_Offset",
  1186. "type": 16,
  1187. "count": 1
  1188. },
  1189. {
  1190. "name": "frameTile_velLenScale",
  1191. "type": 16,
  1192. "count": 1
  1193. },
  1194. {
  1195. "name": "scale",
  1196. "type": 16,
  1197. "count": 1
  1198. },
  1199. {
  1200. "name": "nodeRotation",
  1201. "type": 16,
  1202. "count": 1
  1203. }
  1204. ],
  1205. "defines": [],
  1206. "stageFlags": 1,
  1207. "binding": 0
  1208. },
  1209. {
  1210. "name": "FragConstants",
  1211. "members": [
  1212. {
  1213. "name": "tintColor",
  1214. "type": 16,
  1215. "count": 1
  1216. }
  1217. ],
  1218. "defines": [],
  1219. "stageFlags": 16,
  1220. "binding": 1
  1221. }
  1222. ],
  1223. "samplerTextures": [
  1224. {
  1225. "name": "mainTexture",
  1226. "type": 28,
  1227. "count": 1,
  1228. "defines": [],
  1229. "stageFlags": 16,
  1230. "binding": 2
  1231. }
  1232. ],
  1233. "samplers": [],
  1234. "textures": [],
  1235. "buffers": [],
  1236. "images": [],
  1237. "subpassInputs": []
  1238. },
  1239. {
  1240. "rate": 2,
  1241. "blocks": [],
  1242. "samplerTextures": [],
  1243. "samplers": [],
  1244. "textures": [],
  1245. "buffers": [],
  1246. "images": [],
  1247. "subpassInputs": []
  1248. },
  1249. {
  1250. "rate": 3,
  1251. "blocks": [
  1252. {
  1253. "tags": {
  1254. "builtin": "global"
  1255. },
  1256. "name": "CCGlobal",
  1257. "members": [
  1258. {
  1259. "name": "cc_time",
  1260. "typename": "vec4",
  1261. "type": 16,
  1262. "count": 1,
  1263. "precision": "highp "
  1264. },
  1265. {
  1266. "name": "cc_screenSize",
  1267. "typename": "vec4",
  1268. "type": 16,
  1269. "count": 1,
  1270. "precision": "mediump "
  1271. },
  1272. {
  1273. "name": "cc_nativeSize",
  1274. "typename": "vec4",
  1275. "type": 16,
  1276. "count": 1,
  1277. "precision": "mediump "
  1278. },
  1279. {
  1280. "name": "cc_probeInfo",
  1281. "typename": "vec4",
  1282. "type": 16,
  1283. "count": 1,
  1284. "precision": "mediump "
  1285. },
  1286. {
  1287. "name": "cc_debug_view_mode",
  1288. "typename": "vec4",
  1289. "type": 16,
  1290. "count": 1,
  1291. "precision": "mediump "
  1292. }
  1293. ],
  1294. "defines": [],
  1295. "stageFlags": 17
  1296. },
  1297. {
  1298. "tags": {
  1299. "builtin": "global"
  1300. },
  1301. "name": "CCCamera",
  1302. "members": [
  1303. {
  1304. "name": "cc_matView",
  1305. "typename": "mat4",
  1306. "type": 25,
  1307. "count": 1,
  1308. "precision": "highp "
  1309. },
  1310. {
  1311. "name": "cc_matViewInv",
  1312. "typename": "mat4",
  1313. "type": 25,
  1314. "count": 1,
  1315. "precision": "highp "
  1316. },
  1317. {
  1318. "name": "cc_matProj",
  1319. "typename": "mat4",
  1320. "type": 25,
  1321. "count": 1,
  1322. "precision": "highp "
  1323. },
  1324. {
  1325. "name": "cc_matProjInv",
  1326. "typename": "mat4",
  1327. "type": 25,
  1328. "count": 1,
  1329. "precision": "highp "
  1330. },
  1331. {
  1332. "name": "cc_matViewProj",
  1333. "typename": "mat4",
  1334. "type": 25,
  1335. "count": 1,
  1336. "precision": "highp "
  1337. },
  1338. {
  1339. "name": "cc_matViewProjInv",
  1340. "typename": "mat4",
  1341. "type": 25,
  1342. "count": 1,
  1343. "precision": "highp "
  1344. },
  1345. {
  1346. "name": "cc_cameraPos",
  1347. "typename": "vec4",
  1348. "type": 16,
  1349. "count": 1,
  1350. "precision": "highp "
  1351. },
  1352. {
  1353. "name": "cc_surfaceTransform",
  1354. "typename": "vec4",
  1355. "type": 16,
  1356. "count": 1,
  1357. "precision": "mediump "
  1358. },
  1359. {
  1360. "name": "cc_screenScale",
  1361. "typename": "vec4",
  1362. "type": 16,
  1363. "count": 1,
  1364. "precision": "mediump "
  1365. },
  1366. {
  1367. "name": "cc_exposure",
  1368. "typename": "vec4",
  1369. "type": 16,
  1370. "count": 1,
  1371. "precision": "mediump "
  1372. },
  1373. {
  1374. "name": "cc_mainLitDir",
  1375. "typename": "vec4",
  1376. "type": 16,
  1377. "count": 1,
  1378. "precision": "mediump "
  1379. },
  1380. {
  1381. "name": "cc_mainLitColor",
  1382. "typename": "vec4",
  1383. "type": 16,
  1384. "count": 1,
  1385. "precision": "mediump "
  1386. },
  1387. {
  1388. "name": "cc_ambientSky",
  1389. "typename": "vec4",
  1390. "type": 16,
  1391. "count": 1,
  1392. "precision": "mediump "
  1393. },
  1394. {
  1395. "name": "cc_ambientGround",
  1396. "typename": "vec4",
  1397. "type": 16,
  1398. "count": 1,
  1399. "precision": "mediump "
  1400. },
  1401. {
  1402. "name": "cc_fogColor",
  1403. "typename": "vec4",
  1404. "type": 16,
  1405. "count": 1,
  1406. "precision": "mediump "
  1407. },
  1408. {
  1409. "name": "cc_fogBase",
  1410. "typename": "vec4",
  1411. "type": 16,
  1412. "count": 1,
  1413. "precision": "mediump "
  1414. },
  1415. {
  1416. "name": "cc_fogAdd",
  1417. "typename": "vec4",
  1418. "type": 16,
  1419. "count": 1,
  1420. "precision": "mediump "
  1421. },
  1422. {
  1423. "name": "cc_nearFar",
  1424. "typename": "vec4",
  1425. "type": 16,
  1426. "count": 1,
  1427. "precision": "mediump "
  1428. },
  1429. {
  1430. "name": "cc_viewPort",
  1431. "typename": "vec4",
  1432. "type": 16,
  1433. "count": 1,
  1434. "precision": "mediump "
  1435. }
  1436. ],
  1437. "defines": [],
  1438. "stageFlags": 17
  1439. }
  1440. ],
  1441. "samplerTextures": [],
  1442. "samplers": [],
  1443. "textures": [],
  1444. "buffers": [],
  1445. "images": [],
  1446. "subpassInputs": []
  1447. }
  1448. ],
  1449. "hash": 3441772896,
  1450. "glsl4": {
  1451. "vert": "\nprecision highp 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}\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(location = 0) in vec3 a_texCoord1;\nlayout(location = 1) in vec3 a_texCoord2;\nlayout(location = 2) in vec4 a_color;\nlayout(location = 3) in vec3 a_texCoord;\n#if !CC_INSTANCE_PARTICLE\n layout(location = 4) in vec3 a_position;\n#endif\n#if CC_INSTANCE_PARTICLE\n layout(location = 5) in vec4 a_texCoord4;\n#endif\n#if CC_RENDER_MODE == 1\n layout(location = 9) in vec3 a_color1;\n#endif\n#if CC_RENDER_MODE == 4\n layout(location = 7) in vec3 a_texCoord3;\n layout(location = 8) in vec3 a_normal;\n layout(location = 9) in vec4 a_color1;\n#endif\nvec4 lpvs_main () {\n vec3 compScale = scale.xyz * a_texCoord1;\n #if !CC_INSTANCE_PARTICLE\n vec4 pos = vec4(a_position.xyz, 1);\n #endif\n #if CC_INSTANCE_PARTICLE\n vec4 pos = vec4(a_texCoord4.xyz, 1);\n #endif\n #if CC_RENDER_MODE == 1\n vec4 velocity = vec4(a_color1.xyz, 0);\n #endif\n #if !CC_USE_WORLD_SPACE\n pos = cc_matWorld * pos;\n #if CC_RENDER_MODE == 1\n velocity = cc_matWorld * velocity;\n #endif\n #endif\n #if ROTATION_OVER_TIME_MODULE_ENABLE\n vec3 rotTmp = a_texCoord2;\n float mulFactor = 1.0;\n if (rotTmp.x > 10.0 * 0.5) {\n rotTmp.x -= 10.0;\n mulFactor = -1.0;\n }\n vec4 rot = vec4(rotTmp, 0.0);\n rot.w = mulFactor * sqrt(abs(1.0 - rot.x * rot.x - rot.y * rot.y - rot.z * rot.z));\n #endif\n #if !ROTATION_OVER_TIME_MODULE_ENABLE\n #if CC_RENDER_MODE != 4\n #if CC_RENDER_MODE == 0\n vec3 rotEuler = a_texCoord2;\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., a_texCoord2.z);\n #endif\n vec4 rot = quaternionFromEuler(rotEuler);\n #endif\n #if CC_RENDER_MODE == 4\n vec4 rot = quaternionFromEuler(a_texCoord2);\n #endif\n #endif\n #if CC_RENDER_MODE != 4\n vec2 cornerOffset = vec2((a_texCoord.xy - 0.5));\n #if CC_RENDER_MODE == 0 || CC_RENDER_MODE == 3\n computeVertPos(pos, cornerOffset, rot, compScale, cc_matViewInv);\n #elif CC_RENDER_MODE == 1\n computeVertPos(pos, cornerOffset, rot, compScale, cc_cameraPos.xyz, velocity, frameTile_velLenScale.z, frameTile_velLenScale.w, a_texCoord.x);\n #elif 2\n computeVertPos(pos, cornerOffset, rot, compScale);\n #endif\n color = a_color;\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_color * a_color1;\n #endif\n #if !CC_INSTANCE_PARTICLE\n uv = computeUV(a_texCoord.z, a_texCoord.xy, frameTile_velLenScale.xy) * mainTiling_Offset.xy + mainTiling_Offset.zw;\n #endif\n #if CC_INSTANCE_PARTICLE\n uv = computeUV(a_texCoord4.w, a_texCoord.xy, frameTile_velLenScale.xy) * mainTiling_Offset.xy + mainTiling_Offset.zw;\n #endif\n pos = cc_matViewProj * pos;\n return pos;\n}\nvoid main() { gl_Position = lpvs_main(); }",
  1452. "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 = 2) uniform sampler2D mainTexture;\nlayout(set = 1, binding = 1) 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(); }"
  1453. },
  1454. "glsl3": {
  1455. "vert": "\nprecision highp 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}\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}\nin vec3 a_texCoord1;\nin vec3 a_texCoord2;\nin vec4 a_color;\nin vec3 a_texCoord;\n#if !CC_INSTANCE_PARTICLE\n in vec3 a_position;\n#endif\n#if CC_INSTANCE_PARTICLE\n in vec4 a_texCoord4;\n#endif\n#if CC_RENDER_MODE == 1\n in vec3 a_color1;\n#endif\n#if CC_RENDER_MODE == 4\n in vec3 a_texCoord3;\n in vec3 a_normal;\n in vec4 a_color1;\n#endif\nvec4 lpvs_main () {\n vec3 compScale = scale.xyz * a_texCoord1;\n #if !CC_INSTANCE_PARTICLE\n vec4 pos = vec4(a_position.xyz, 1);\n #endif\n #if CC_INSTANCE_PARTICLE\n vec4 pos = vec4(a_texCoord4.xyz, 1);\n #endif\n #if CC_RENDER_MODE == 1\n vec4 velocity = vec4(a_color1.xyz, 0);\n #endif\n #if !CC_USE_WORLD_SPACE\n pos = cc_matWorld * pos;\n #if CC_RENDER_MODE == 1\n velocity = cc_matWorld * velocity;\n #endif\n #endif\n #if ROTATION_OVER_TIME_MODULE_ENABLE\n vec3 rotTmp = a_texCoord2;\n float mulFactor = 1.0;\n if (rotTmp.x > 10.0 * 0.5) {\n rotTmp.x -= 10.0;\n mulFactor = -1.0;\n }\n vec4 rot = vec4(rotTmp, 0.0);\n rot.w = mulFactor * sqrt(abs(1.0 - rot.x * rot.x - rot.y * rot.y - rot.z * rot.z));\n #endif\n #if !ROTATION_OVER_TIME_MODULE_ENABLE\n #if CC_RENDER_MODE != 4\n #if CC_RENDER_MODE == 0\n vec3 rotEuler = a_texCoord2;\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., a_texCoord2.z);\n #endif\n vec4 rot = quaternionFromEuler(rotEuler);\n #endif\n #if CC_RENDER_MODE == 4\n vec4 rot = quaternionFromEuler(a_texCoord2);\n #endif\n #endif\n #if CC_RENDER_MODE != 4\n vec2 cornerOffset = vec2((a_texCoord.xy - 0.5));\n #if CC_RENDER_MODE == 0 || CC_RENDER_MODE == 3\n computeVertPos(pos, cornerOffset, rot, compScale, cc_matViewInv);\n #elif CC_RENDER_MODE == 1\n computeVertPos(pos, cornerOffset, rot, compScale, cc_cameraPos.xyz, velocity, frameTile_velLenScale.z, frameTile_velLenScale.w, a_texCoord.x);\n #elif 2\n computeVertPos(pos, cornerOffset, rot, compScale);\n #endif\n color = a_color;\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_color * a_color1;\n #endif\n #if !CC_INSTANCE_PARTICLE\n uv = computeUV(a_texCoord.z, a_texCoord.xy, frameTile_velLenScale.xy) * mainTiling_Offset.xy + mainTiling_Offset.zw;\n #endif\n #if CC_INSTANCE_PARTICLE\n uv = computeUV(a_texCoord4.w, a_texCoord.xy, frameTile_velLenScale.xy) * mainTiling_Offset.xy + mainTiling_Offset.zw;\n #endif\n pos = cc_matViewProj * pos;\n return pos;\n}\nvoid main() { gl_Position = lpvs_main(); }",
  1456. "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(); }"
  1457. },
  1458. "glsl1": {
  1459. "vert": "\nprecision highp 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}\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}\nattribute vec3 a_texCoord1;\nattribute vec3 a_texCoord2;\nattribute vec4 a_color;\nattribute vec3 a_texCoord;\n#if !CC_INSTANCE_PARTICLE\n attribute vec3 a_position;\n#endif\n#if CC_INSTANCE_PARTICLE\n attribute vec4 a_texCoord4;\n#endif\n#if CC_RENDER_MODE == 1\n attribute vec3 a_color1;\n#endif\n#if CC_RENDER_MODE == 4\n attribute vec3 a_texCoord3;\n attribute vec3 a_normal;\n attribute vec4 a_color1;\n#endif\nvec4 lpvs_main () {\n vec3 compScale = scale.xyz * a_texCoord1;\n #if !CC_INSTANCE_PARTICLE\n vec4 pos = vec4(a_position.xyz, 1);\n #endif\n #if CC_INSTANCE_PARTICLE\n vec4 pos = vec4(a_texCoord4.xyz, 1);\n #endif\n #if CC_RENDER_MODE == 1\n vec4 velocity = vec4(a_color1.xyz, 0);\n #endif\n #if !CC_USE_WORLD_SPACE\n pos = cc_matWorld * pos;\n #if CC_RENDER_MODE == 1\n velocity = cc_matWorld * velocity;\n #endif\n #endif\n #if ROTATION_OVER_TIME_MODULE_ENABLE\n vec3 rotTmp = a_texCoord2;\n float mulFactor = 1.0;\n if (rotTmp.x > 10.0 * 0.5) {\n rotTmp.x -= 10.0;\n mulFactor = -1.0;\n }\n vec4 rot = vec4(rotTmp, 0.0);\n rot.w = mulFactor * sqrt(abs(1.0 - rot.x * rot.x - rot.y * rot.y - rot.z * rot.z));\n #endif\n #if !ROTATION_OVER_TIME_MODULE_ENABLE\n #if CC_RENDER_MODE != 4\n #if CC_RENDER_MODE == 0\n vec3 rotEuler = a_texCoord2;\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., a_texCoord2.z);\n #endif\n vec4 rot = quaternionFromEuler(rotEuler);\n #endif\n #if CC_RENDER_MODE == 4\n vec4 rot = quaternionFromEuler(a_texCoord2);\n #endif\n #endif\n #if CC_RENDER_MODE != 4\n vec2 cornerOffset = vec2((a_texCoord.xy - 0.5));\n #if CC_RENDER_MODE == 0 || CC_RENDER_MODE == 3\n computeVertPos(pos, cornerOffset, rot, compScale, cc_matViewInv);\n #elif CC_RENDER_MODE == 1\n computeVertPos(pos, cornerOffset, rot, compScale, cc_cameraPos.xyz, velocity, frameTile_velLenScale.z, frameTile_velLenScale.w, a_texCoord.x);\n #elif 2\n computeVertPos(pos, cornerOffset, rot, compScale);\n #endif\n color = a_color;\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_color * a_color1;\n #endif\n #if !CC_INSTANCE_PARTICLE\n uv = computeUV(a_texCoord.z, a_texCoord.xy, frameTile_velLenScale.xy) * mainTiling_Offset.xy + mainTiling_Offset.zw;\n #endif\n #if CC_INSTANCE_PARTICLE\n uv = computeUV(a_texCoord4.w, a_texCoord.xy, frameTile_velLenScale.xy) * mainTiling_Offset.xy + mainTiling_Offset.zw;\n #endif\n pos = cc_matViewProj * pos;\n return pos;\n}\nvoid main() { gl_Position = lpvs_main(); }",
  1460. "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(); }"
  1461. },
  1462. "builtins": {
  1463. "globals": {
  1464. "blocks": [
  1465. {
  1466. "name": "CCGlobal",
  1467. "defines": []
  1468. },
  1469. {
  1470. "name": "CCCamera",
  1471. "defines": []
  1472. }
  1473. ],
  1474. "samplerTextures": [],
  1475. "buffers": [],
  1476. "images": []
  1477. },
  1478. "locals": {
  1479. "blocks": [
  1480. {
  1481. "name": "CCLocal",
  1482. "defines": []
  1483. }
  1484. ],
  1485. "samplerTextures": [],
  1486. "buffers": [],
  1487. "images": []
  1488. },
  1489. "statistics": {
  1490. "CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS": 60,
  1491. "CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS": 43
  1492. }
  1493. },
  1494. "defines": [
  1495. {
  1496. "name": "CC_RENDER_MODE",
  1497. "type": "number",
  1498. "defines": [],
  1499. "range": [
  1500. 0,
  1501. 4
  1502. ]
  1503. },
  1504. {
  1505. "name": "CC_INSTANCE_PARTICLE",
  1506. "type": "boolean",
  1507. "defines": []
  1508. },
  1509. {
  1510. "name": "CC_USE_WORLD_SPACE",
  1511. "type": "boolean",
  1512. "defines": []
  1513. },
  1514. {
  1515. "name": "ROTATION_OVER_TIME_MODULE_ENABLE",
  1516. "type": "boolean",
  1517. "defines": []
  1518. }
  1519. ],
  1520. "name": "particles/builtin-particle|builtin/internal/particle-vs-legacy:lpvs_main|tinted-fs:multiply"
  1521. },
  1522. {
  1523. "blocks": [
  1524. {
  1525. "name": "Constants",
  1526. "members": [
  1527. {
  1528. "name": "mainTiling_Offset",
  1529. "type": 16,
  1530. "count": 1
  1531. },
  1532. {
  1533. "name": "frameTile_velLenScale",
  1534. "type": 16,
  1535. "count": 1
  1536. },
  1537. {
  1538. "name": "scale",
  1539. "type": 16,
  1540. "count": 1
  1541. },
  1542. {
  1543. "name": "nodeRotation",
  1544. "type": 16,
  1545. "count": 1
  1546. }
  1547. ],
  1548. "defines": [],
  1549. "stageFlags": 1,
  1550. "binding": 0
  1551. }
  1552. ],
  1553. "samplerTextures": [
  1554. {
  1555. "name": "mainTexture",
  1556. "type": 28,
  1557. "count": 1,
  1558. "defines": [],
  1559. "stageFlags": 16,
  1560. "binding": 1
  1561. }
  1562. ],
  1563. "samplers": [],
  1564. "textures": [],
  1565. "buffers": [],
  1566. "images": [],
  1567. "subpassInputs": [],
  1568. "attributes": [
  1569. {
  1570. "name": "a_texCoord1",
  1571. "defines": [],
  1572. "format": 32,
  1573. "location": 0
  1574. },
  1575. {
  1576. "name": "a_texCoord2",
  1577. "defines": [],
  1578. "format": 32,
  1579. "location": 1
  1580. },
  1581. {
  1582. "name": "a_color",
  1583. "defines": [],
  1584. "format": 44,
  1585. "location": 2
  1586. },
  1587. {
  1588. "name": "a_texCoord",
  1589. "defines": [],
  1590. "format": 32,
  1591. "location": 3
  1592. },
  1593. {
  1594. "name": "a_position",
  1595. "defines": [
  1596. "!CC_INSTANCE_PARTICLE"
  1597. ],
  1598. "format": 32,
  1599. "location": 4
  1600. },
  1601. {
  1602. "name": "a_texCoord4",
  1603. "defines": [
  1604. "CC_INSTANCE_PARTICLE"
  1605. ],
  1606. "format": 44,
  1607. "location": 5
  1608. },
  1609. {
  1610. "name": "a_color1",
  1611. "defines": [
  1612. "CC_RENDER_MODE"
  1613. ],
  1614. "format": 32,
  1615. "location": 9
  1616. },
  1617. {
  1618. "name": "a_texCoord3",
  1619. "defines": [
  1620. "CC_RENDER_MODE"
  1621. ],
  1622. "format": 32,
  1623. "location": 7
  1624. },
  1625. {
  1626. "name": "a_normal",
  1627. "defines": [
  1628. "CC_RENDER_MODE"
  1629. ],
  1630. "format": 32,
  1631. "location": 8
  1632. }
  1633. ],
  1634. "varyings": [
  1635. {
  1636. "name": "uv",
  1637. "type": 14,
  1638. "count": 1,
  1639. "defines": [],
  1640. "stageFlags": 17,
  1641. "location": 0
  1642. },
  1643. {
  1644. "name": "color",
  1645. "type": 16,
  1646. "count": 1,
  1647. "defines": [],
  1648. "stageFlags": 17,
  1649. "location": 1
  1650. }
  1651. ],
  1652. "fragColors": [
  1653. {
  1654. "name": "cc_FragColor",
  1655. "typename": "vec4",
  1656. "type": 16,
  1657. "count": 1,
  1658. "defines": [],
  1659. "stageFlags": 16,
  1660. "location": 0
  1661. }
  1662. ],
  1663. "descriptors": [
  1664. {
  1665. "rate": 0,
  1666. "blocks": [
  1667. {
  1668. "tags": {
  1669. "builtin": "local"
  1670. },
  1671. "name": "CCLocal",
  1672. "members": [
  1673. {
  1674. "name": "cc_matWorld",
  1675. "typename": "mat4",
  1676. "type": 25,
  1677. "count": 1,
  1678. "precision": "highp "
  1679. },
  1680. {
  1681. "name": "cc_matWorldIT",
  1682. "typename": "mat4",
  1683. "type": 25,
  1684. "count": 1,
  1685. "precision": "highp "
  1686. },
  1687. {
  1688. "name": "cc_lightingMapUVParam",
  1689. "typename": "vec4",
  1690. "type": 16,
  1691. "count": 1,
  1692. "precision": "highp "
  1693. },
  1694. {
  1695. "name": "cc_localShadowBias",
  1696. "typename": "vec4",
  1697. "type": 16,
  1698. "count": 1,
  1699. "precision": "highp "
  1700. },
  1701. {
  1702. "name": "cc_reflectionProbeData1",
  1703. "typename": "vec4",
  1704. "type": 16,
  1705. "count": 1,
  1706. "precision": "highp "
  1707. },
  1708. {
  1709. "name": "cc_reflectionProbeData2",
  1710. "typename": "vec4",
  1711. "type": 16,
  1712. "count": 1,
  1713. "precision": "highp "
  1714. },
  1715. {
  1716. "name": "cc_reflectionProbeBlendData1",
  1717. "typename": "vec4",
  1718. "type": 16,
  1719. "count": 1,
  1720. "precision": "highp "
  1721. },
  1722. {
  1723. "name": "cc_reflectionProbeBlendData2",
  1724. "typename": "vec4",
  1725. "type": 16,
  1726. "count": 1,
  1727. "precision": "highp "
  1728. }
  1729. ],
  1730. "defines": [],
  1731. "stageFlags": 1
  1732. }
  1733. ],
  1734. "samplerTextures": [],
  1735. "samplers": [],
  1736. "textures": [],
  1737. "buffers": [],
  1738. "images": [],
  1739. "subpassInputs": []
  1740. },
  1741. {
  1742. "rate": 1,
  1743. "blocks": [
  1744. {
  1745. "name": "Constants",
  1746. "members": [
  1747. {
  1748. "name": "mainTiling_Offset",
  1749. "type": 16,
  1750. "count": 1
  1751. },
  1752. {
  1753. "name": "frameTile_velLenScale",
  1754. "type": 16,
  1755. "count": 1
  1756. },
  1757. {
  1758. "name": "scale",
  1759. "type": 16,
  1760. "count": 1
  1761. },
  1762. {
  1763. "name": "nodeRotation",
  1764. "type": 16,
  1765. "count": 1
  1766. }
  1767. ],
  1768. "defines": [],
  1769. "stageFlags": 1,
  1770. "binding": 0
  1771. }
  1772. ],
  1773. "samplerTextures": [
  1774. {
  1775. "name": "mainTexture",
  1776. "type": 28,
  1777. "count": 1,
  1778. "defines": [],
  1779. "stageFlags": 16,
  1780. "binding": 1
  1781. }
  1782. ],
  1783. "samplers": [],
  1784. "textures": [],
  1785. "buffers": [],
  1786. "images": [],
  1787. "subpassInputs": []
  1788. },
  1789. {
  1790. "rate": 2,
  1791. "blocks": [],
  1792. "samplerTextures": [],
  1793. "samplers": [],
  1794. "textures": [],
  1795. "buffers": [],
  1796. "images": [],
  1797. "subpassInputs": []
  1798. },
  1799. {
  1800. "rate": 3,
  1801. "blocks": [
  1802. {
  1803. "tags": {
  1804. "builtin": "global"
  1805. },
  1806. "name": "CCGlobal",
  1807. "members": [
  1808. {
  1809. "name": "cc_time",
  1810. "typename": "vec4",
  1811. "type": 16,
  1812. "count": 1,
  1813. "precision": "highp "
  1814. },
  1815. {
  1816. "name": "cc_screenSize",
  1817. "typename": "vec4",
  1818. "type": 16,
  1819. "count": 1,
  1820. "precision": "mediump "
  1821. },
  1822. {
  1823. "name": "cc_nativeSize",
  1824. "typename": "vec4",
  1825. "type": 16,
  1826. "count": 1,
  1827. "precision": "mediump "
  1828. },
  1829. {
  1830. "name": "cc_probeInfo",
  1831. "typename": "vec4",
  1832. "type": 16,
  1833. "count": 1,
  1834. "precision": "mediump "
  1835. },
  1836. {
  1837. "name": "cc_debug_view_mode",
  1838. "typename": "vec4",
  1839. "type": 16,
  1840. "count": 1,
  1841. "precision": "mediump "
  1842. }
  1843. ],
  1844. "defines": [],
  1845. "stageFlags": 17
  1846. },
  1847. {
  1848. "tags": {
  1849. "builtin": "global"
  1850. },
  1851. "name": "CCCamera",
  1852. "members": [
  1853. {
  1854. "name": "cc_matView",
  1855. "typename": "mat4",
  1856. "type": 25,
  1857. "count": 1,
  1858. "precision": "highp "
  1859. },
  1860. {
  1861. "name": "cc_matViewInv",
  1862. "typename": "mat4",
  1863. "type": 25,
  1864. "count": 1,
  1865. "precision": "highp "
  1866. },
  1867. {
  1868. "name": "cc_matProj",
  1869. "typename": "mat4",
  1870. "type": 25,
  1871. "count": 1,
  1872. "precision": "highp "
  1873. },
  1874. {
  1875. "name": "cc_matProjInv",
  1876. "typename": "mat4",
  1877. "type": 25,
  1878. "count": 1,
  1879. "precision": "highp "
  1880. },
  1881. {
  1882. "name": "cc_matViewProj",
  1883. "typename": "mat4",
  1884. "type": 25,
  1885. "count": 1,
  1886. "precision": "highp "
  1887. },
  1888. {
  1889. "name": "cc_matViewProjInv",
  1890. "typename": "mat4",
  1891. "type": 25,
  1892. "count": 1,
  1893. "precision": "highp "
  1894. },
  1895. {
  1896. "name": "cc_cameraPos",
  1897. "typename": "vec4",
  1898. "type": 16,
  1899. "count": 1,
  1900. "precision": "highp "
  1901. },
  1902. {
  1903. "name": "cc_surfaceTransform",
  1904. "typename": "vec4",
  1905. "type": 16,
  1906. "count": 1,
  1907. "precision": "mediump "
  1908. },
  1909. {
  1910. "name": "cc_screenScale",
  1911. "typename": "vec4",
  1912. "type": 16,
  1913. "count": 1,
  1914. "precision": "mediump "
  1915. },
  1916. {
  1917. "name": "cc_exposure",
  1918. "typename": "vec4",
  1919. "type": 16,
  1920. "count": 1,
  1921. "precision": "mediump "
  1922. },
  1923. {
  1924. "name": "cc_mainLitDir",
  1925. "typename": "vec4",
  1926. "type": 16,
  1927. "count": 1,
  1928. "precision": "mediump "
  1929. },
  1930. {
  1931. "name": "cc_mainLitColor",
  1932. "typename": "vec4",
  1933. "type": 16,
  1934. "count": 1,
  1935. "precision": "mediump "
  1936. },
  1937. {
  1938. "name": "cc_ambientSky",
  1939. "typename": "vec4",
  1940. "type": 16,
  1941. "count": 1,
  1942. "precision": "mediump "
  1943. },
  1944. {
  1945. "name": "cc_ambientGround",
  1946. "typename": "vec4",
  1947. "type": 16,
  1948. "count": 1,
  1949. "precision": "mediump "
  1950. },
  1951. {
  1952. "name": "cc_fogColor",
  1953. "typename": "vec4",
  1954. "type": 16,
  1955. "count": 1,
  1956. "precision": "mediump "
  1957. },
  1958. {
  1959. "name": "cc_fogBase",
  1960. "typename": "vec4",
  1961. "type": 16,
  1962. "count": 1,
  1963. "precision": "mediump "
  1964. },
  1965. {
  1966. "name": "cc_fogAdd",
  1967. "typename": "vec4",
  1968. "type": 16,
  1969. "count": 1,
  1970. "precision": "mediump "
  1971. },
  1972. {
  1973. "name": "cc_nearFar",
  1974. "typename": "vec4",
  1975. "type": 16,
  1976. "count": 1,
  1977. "precision": "mediump "
  1978. },
  1979. {
  1980. "name": "cc_viewPort",
  1981. "typename": "vec4",
  1982. "type": 16,
  1983. "count": 1,
  1984. "precision": "mediump "
  1985. }
  1986. ],
  1987. "defines": [],
  1988. "stageFlags": 17
  1989. }
  1990. ],
  1991. "samplerTextures": [],
  1992. "samplers": [],
  1993. "textures": [],
  1994. "buffers": [],
  1995. "images": [],
  1996. "subpassInputs": []
  1997. }
  1998. ],
  1999. "hash": 868591613,
  2000. "glsl4": {
  2001. "vert": "\nprecision highp 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}\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(location = 0) in vec3 a_texCoord1;\nlayout(location = 1) in vec3 a_texCoord2;\nlayout(location = 2) in vec4 a_color;\nlayout(location = 3) in vec3 a_texCoord;\n#if !CC_INSTANCE_PARTICLE\n layout(location = 4) in vec3 a_position;\n#endif\n#if CC_INSTANCE_PARTICLE\n layout(location = 5) in vec4 a_texCoord4;\n#endif\n#if CC_RENDER_MODE == 1\n layout(location = 9) in vec3 a_color1;\n#endif\n#if CC_RENDER_MODE == 4\n layout(location = 7) in vec3 a_texCoord3;\n layout(location = 8) in vec3 a_normal;\n layout(location = 9) in vec4 a_color1;\n#endif\nvec4 lpvs_main () {\n vec3 compScale = scale.xyz * a_texCoord1;\n #if !CC_INSTANCE_PARTICLE\n vec4 pos = vec4(a_position.xyz, 1);\n #endif\n #if CC_INSTANCE_PARTICLE\n vec4 pos = vec4(a_texCoord4.xyz, 1);\n #endif\n #if CC_RENDER_MODE == 1\n vec4 velocity = vec4(a_color1.xyz, 0);\n #endif\n #if !CC_USE_WORLD_SPACE\n pos = cc_matWorld * pos;\n #if CC_RENDER_MODE == 1\n velocity = cc_matWorld * velocity;\n #endif\n #endif\n #if ROTATION_OVER_TIME_MODULE_ENABLE\n vec3 rotTmp = a_texCoord2;\n float mulFactor = 1.0;\n if (rotTmp.x > 10.0 * 0.5) {\n rotTmp.x -= 10.0;\n mulFactor = -1.0;\n }\n vec4 rot = vec4(rotTmp, 0.0);\n rot.w = mulFactor * sqrt(abs(1.0 - rot.x * rot.x - rot.y * rot.y - rot.z * rot.z));\n #endif\n #if !ROTATION_OVER_TIME_MODULE_ENABLE\n #if CC_RENDER_MODE != 4\n #if CC_RENDER_MODE == 0\n vec3 rotEuler = a_texCoord2;\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., a_texCoord2.z);\n #endif\n vec4 rot = quaternionFromEuler(rotEuler);\n #endif\n #if CC_RENDER_MODE == 4\n vec4 rot = quaternionFromEuler(a_texCoord2);\n #endif\n #endif\n #if CC_RENDER_MODE != 4\n vec2 cornerOffset = vec2((a_texCoord.xy - 0.5));\n #if CC_RENDER_MODE == 0 || CC_RENDER_MODE == 3\n computeVertPos(pos, cornerOffset, rot, compScale, cc_matViewInv);\n #elif CC_RENDER_MODE == 1\n computeVertPos(pos, cornerOffset, rot, compScale, cc_cameraPos.xyz, velocity, frameTile_velLenScale.z, frameTile_velLenScale.w, a_texCoord.x);\n #elif 2\n computeVertPos(pos, cornerOffset, rot, compScale);\n #endif\n color = a_color;\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_color * a_color1;\n #endif\n #if !CC_INSTANCE_PARTICLE\n uv = computeUV(a_texCoord.z, a_texCoord.xy, frameTile_velLenScale.xy) * mainTiling_Offset.xy + mainTiling_Offset.zw;\n #endif\n #if CC_INSTANCE_PARTICLE\n uv = computeUV(a_texCoord4.w, a_texCoord.xy, frameTile_velLenScale.xy) * mainTiling_Offset.xy + mainTiling_Offset.zw;\n #endif\n pos = cc_matViewProj * pos;\n return pos;\n}\nvoid main() { gl_Position = lpvs_main(); }",
  2002. "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 = 1) 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(); }"
  2003. },
  2004. "glsl3": {
  2005. "vert": "\nprecision highp 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}\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}\nin vec3 a_texCoord1;\nin vec3 a_texCoord2;\nin vec4 a_color;\nin vec3 a_texCoord;\n#if !CC_INSTANCE_PARTICLE\n in vec3 a_position;\n#endif\n#if CC_INSTANCE_PARTICLE\n in vec4 a_texCoord4;\n#endif\n#if CC_RENDER_MODE == 1\n in vec3 a_color1;\n#endif\n#if CC_RENDER_MODE == 4\n in vec3 a_texCoord3;\n in vec3 a_normal;\n in vec4 a_color1;\n#endif\nvec4 lpvs_main () {\n vec3 compScale = scale.xyz * a_texCoord1;\n #if !CC_INSTANCE_PARTICLE\n vec4 pos = vec4(a_position.xyz, 1);\n #endif\n #if CC_INSTANCE_PARTICLE\n vec4 pos = vec4(a_texCoord4.xyz, 1);\n #endif\n #if CC_RENDER_MODE == 1\n vec4 velocity = vec4(a_color1.xyz, 0);\n #endif\n #if !CC_USE_WORLD_SPACE\n pos = cc_matWorld * pos;\n #if CC_RENDER_MODE == 1\n velocity = cc_matWorld * velocity;\n #endif\n #endif\n #if ROTATION_OVER_TIME_MODULE_ENABLE\n vec3 rotTmp = a_texCoord2;\n float mulFactor = 1.0;\n if (rotTmp.x > 10.0 * 0.5) {\n rotTmp.x -= 10.0;\n mulFactor = -1.0;\n }\n vec4 rot = vec4(rotTmp, 0.0);\n rot.w = mulFactor * sqrt(abs(1.0 - rot.x * rot.x - rot.y * rot.y - rot.z * rot.z));\n #endif\n #if !ROTATION_OVER_TIME_MODULE_ENABLE\n #if CC_RENDER_MODE != 4\n #if CC_RENDER_MODE == 0\n vec3 rotEuler = a_texCoord2;\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., a_texCoord2.z);\n #endif\n vec4 rot = quaternionFromEuler(rotEuler);\n #endif\n #if CC_RENDER_MODE == 4\n vec4 rot = quaternionFromEuler(a_texCoord2);\n #endif\n #endif\n #if CC_RENDER_MODE != 4\n vec2 cornerOffset = vec2((a_texCoord.xy - 0.5));\n #if CC_RENDER_MODE == 0 || CC_RENDER_MODE == 3\n computeVertPos(pos, cornerOffset, rot, compScale, cc_matViewInv);\n #elif CC_RENDER_MODE == 1\n computeVertPos(pos, cornerOffset, rot, compScale, cc_cameraPos.xyz, velocity, frameTile_velLenScale.z, frameTile_velLenScale.w, a_texCoord.x);\n #elif 2\n computeVertPos(pos, cornerOffset, rot, compScale);\n #endif\n color = a_color;\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_color * a_color1;\n #endif\n #if !CC_INSTANCE_PARTICLE\n uv = computeUV(a_texCoord.z, a_texCoord.xy, frameTile_velLenScale.xy) * mainTiling_Offset.xy + mainTiling_Offset.zw;\n #endif\n #if CC_INSTANCE_PARTICLE\n uv = computeUV(a_texCoord4.w, a_texCoord.xy, frameTile_velLenScale.xy) * mainTiling_Offset.xy + mainTiling_Offset.zw;\n #endif\n pos = cc_matViewProj * pos;\n return pos;\n}\nvoid main() { gl_Position = lpvs_main(); }",
  2006. "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(); }"
  2007. },
  2008. "glsl1": {
  2009. "vert": "\nprecision highp 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}\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}\nattribute vec3 a_texCoord1;\nattribute vec3 a_texCoord2;\nattribute vec4 a_color;\nattribute vec3 a_texCoord;\n#if !CC_INSTANCE_PARTICLE\n attribute vec3 a_position;\n#endif\n#if CC_INSTANCE_PARTICLE\n attribute vec4 a_texCoord4;\n#endif\n#if CC_RENDER_MODE == 1\n attribute vec3 a_color1;\n#endif\n#if CC_RENDER_MODE == 4\n attribute vec3 a_texCoord3;\n attribute vec3 a_normal;\n attribute vec4 a_color1;\n#endif\nvec4 lpvs_main () {\n vec3 compScale = scale.xyz * a_texCoord1;\n #if !CC_INSTANCE_PARTICLE\n vec4 pos = vec4(a_position.xyz, 1);\n #endif\n #if CC_INSTANCE_PARTICLE\n vec4 pos = vec4(a_texCoord4.xyz, 1);\n #endif\n #if CC_RENDER_MODE == 1\n vec4 velocity = vec4(a_color1.xyz, 0);\n #endif\n #if !CC_USE_WORLD_SPACE\n pos = cc_matWorld * pos;\n #if CC_RENDER_MODE == 1\n velocity = cc_matWorld * velocity;\n #endif\n #endif\n #if ROTATION_OVER_TIME_MODULE_ENABLE\n vec3 rotTmp = a_texCoord2;\n float mulFactor = 1.0;\n if (rotTmp.x > 10.0 * 0.5) {\n rotTmp.x -= 10.0;\n mulFactor = -1.0;\n }\n vec4 rot = vec4(rotTmp, 0.0);\n rot.w = mulFactor * sqrt(abs(1.0 - rot.x * rot.x - rot.y * rot.y - rot.z * rot.z));\n #endif\n #if !ROTATION_OVER_TIME_MODULE_ENABLE\n #if CC_RENDER_MODE != 4\n #if CC_RENDER_MODE == 0\n vec3 rotEuler = a_texCoord2;\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., a_texCoord2.z);\n #endif\n vec4 rot = quaternionFromEuler(rotEuler);\n #endif\n #if CC_RENDER_MODE == 4\n vec4 rot = quaternionFromEuler(a_texCoord2);\n #endif\n #endif\n #if CC_RENDER_MODE != 4\n vec2 cornerOffset = vec2((a_texCoord.xy - 0.5));\n #if CC_RENDER_MODE == 0 || CC_RENDER_MODE == 3\n computeVertPos(pos, cornerOffset, rot, compScale, cc_matViewInv);\n #elif CC_RENDER_MODE == 1\n computeVertPos(pos, cornerOffset, rot, compScale, cc_cameraPos.xyz, velocity, frameTile_velLenScale.z, frameTile_velLenScale.w, a_texCoord.x);\n #elif 2\n computeVertPos(pos, cornerOffset, rot, compScale);\n #endif\n color = a_color;\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_color * a_color1;\n #endif\n #if !CC_INSTANCE_PARTICLE\n uv = computeUV(a_texCoord.z, a_texCoord.xy, frameTile_velLenScale.xy) * mainTiling_Offset.xy + mainTiling_Offset.zw;\n #endif\n #if CC_INSTANCE_PARTICLE\n uv = computeUV(a_texCoord4.w, a_texCoord.xy, frameTile_velLenScale.xy) * mainTiling_Offset.xy + mainTiling_Offset.zw;\n #endif\n pos = cc_matViewProj * pos;\n return pos;\n}\nvoid main() { gl_Position = lpvs_main(); }",
  2010. "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(); }"
  2011. },
  2012. "builtins": {
  2013. "globals": {
  2014. "blocks": [
  2015. {
  2016. "name": "CCGlobal",
  2017. "defines": []
  2018. },
  2019. {
  2020. "name": "CCCamera",
  2021. "defines": []
  2022. }
  2023. ],
  2024. "samplerTextures": [],
  2025. "buffers": [],
  2026. "images": []
  2027. },
  2028. "locals": {
  2029. "blocks": [
  2030. {
  2031. "name": "CCLocal",
  2032. "defines": []
  2033. }
  2034. ],
  2035. "samplerTextures": [],
  2036. "buffers": [],
  2037. "images": []
  2038. },
  2039. "statistics": {
  2040. "CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS": 60,
  2041. "CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS": 42
  2042. }
  2043. },
  2044. "defines": [
  2045. {
  2046. "name": "CC_RENDER_MODE",
  2047. "type": "number",
  2048. "defines": [],
  2049. "range": [
  2050. 0,
  2051. 4
  2052. ]
  2053. },
  2054. {
  2055. "name": "CC_INSTANCE_PARTICLE",
  2056. "type": "boolean",
  2057. "defines": []
  2058. },
  2059. {
  2060. "name": "CC_USE_WORLD_SPACE",
  2061. "type": "boolean",
  2062. "defines": []
  2063. },
  2064. {
  2065. "name": "ROTATION_OVER_TIME_MODULE_ENABLE",
  2066. "type": "boolean",
  2067. "defines": []
  2068. }
  2069. ],
  2070. "name": "particles/builtin-particle|builtin/internal/particle-vs-legacy:lpvs_main|no-tint-fs:addSmooth"
  2071. },
  2072. {
  2073. "blocks": [
  2074. {
  2075. "name": "Constants",
  2076. "members": [
  2077. {
  2078. "name": "mainTiling_Offset",
  2079. "type": 16,
  2080. "count": 1
  2081. },
  2082. {
  2083. "name": "frameTile_velLenScale",
  2084. "type": 16,
  2085. "count": 1
  2086. },
  2087. {
  2088. "name": "scale",
  2089. "type": 16,
  2090. "count": 1
  2091. },
  2092. {
  2093. "name": "nodeRotation",
  2094. "type": 16,
  2095. "count": 1
  2096. }
  2097. ],
  2098. "defines": [],
  2099. "stageFlags": 1,
  2100. "binding": 0
  2101. }
  2102. ],
  2103. "samplerTextures": [
  2104. {
  2105. "name": "mainTexture",
  2106. "type": 28,
  2107. "count": 1,
  2108. "defines": [],
  2109. "stageFlags": 16,
  2110. "binding": 1
  2111. }
  2112. ],
  2113. "samplers": [],
  2114. "textures": [],
  2115. "buffers": [],
  2116. "images": [],
  2117. "subpassInputs": [],
  2118. "attributes": [
  2119. {
  2120. "name": "a_texCoord1",
  2121. "defines": [],
  2122. "format": 32,
  2123. "location": 0
  2124. },
  2125. {
  2126. "name": "a_texCoord2",
  2127. "defines": [],
  2128. "format": 32,
  2129. "location": 1
  2130. },
  2131. {
  2132. "name": "a_color",
  2133. "defines": [],
  2134. "format": 44,
  2135. "location": 2
  2136. },
  2137. {
  2138. "name": "a_texCoord",
  2139. "defines": [],
  2140. "format": 32,
  2141. "location": 3
  2142. },
  2143. {
  2144. "name": "a_position",
  2145. "defines": [
  2146. "!CC_INSTANCE_PARTICLE"
  2147. ],
  2148. "format": 32,
  2149. "location": 4
  2150. },
  2151. {
  2152. "name": "a_texCoord4",
  2153. "defines": [
  2154. "CC_INSTANCE_PARTICLE"
  2155. ],
  2156. "format": 44,
  2157. "location": 5
  2158. },
  2159. {
  2160. "name": "a_color1",
  2161. "defines": [
  2162. "CC_RENDER_MODE"
  2163. ],
  2164. "format": 32,
  2165. "location": 9
  2166. },
  2167. {
  2168. "name": "a_texCoord3",
  2169. "defines": [
  2170. "CC_RENDER_MODE"
  2171. ],
  2172. "format": 32,
  2173. "location": 7
  2174. },
  2175. {
  2176. "name": "a_normal",
  2177. "defines": [
  2178. "CC_RENDER_MODE"
  2179. ],
  2180. "format": 32,
  2181. "location": 8
  2182. }
  2183. ],
  2184. "varyings": [
  2185. {
  2186. "name": "uv",
  2187. "type": 14,
  2188. "count": 1,
  2189. "defines": [],
  2190. "stageFlags": 17,
  2191. "location": 0
  2192. },
  2193. {
  2194. "name": "color",
  2195. "type": 16,
  2196. "count": 1,
  2197. "defines": [],
  2198. "stageFlags": 17,
  2199. "location": 1
  2200. }
  2201. ],
  2202. "fragColors": [
  2203. {
  2204. "name": "cc_FragColor",
  2205. "typename": "vec4",
  2206. "type": 16,
  2207. "count": 1,
  2208. "defines": [],
  2209. "stageFlags": 16,
  2210. "location": 0
  2211. }
  2212. ],
  2213. "descriptors": [
  2214. {
  2215. "rate": 0,
  2216. "blocks": [
  2217. {
  2218. "tags": {
  2219. "builtin": "local"
  2220. },
  2221. "name": "CCLocal",
  2222. "members": [
  2223. {
  2224. "name": "cc_matWorld",
  2225. "typename": "mat4",
  2226. "type": 25,
  2227. "count": 1,
  2228. "precision": "highp "
  2229. },
  2230. {
  2231. "name": "cc_matWorldIT",
  2232. "typename": "mat4",
  2233. "type": 25,
  2234. "count": 1,
  2235. "precision": "highp "
  2236. },
  2237. {
  2238. "name": "cc_lightingMapUVParam",
  2239. "typename": "vec4",
  2240. "type": 16,
  2241. "count": 1,
  2242. "precision": "highp "
  2243. },
  2244. {
  2245. "name": "cc_localShadowBias",
  2246. "typename": "vec4",
  2247. "type": 16,
  2248. "count": 1,
  2249. "precision": "highp "
  2250. },
  2251. {
  2252. "name": "cc_reflectionProbeData1",
  2253. "typename": "vec4",
  2254. "type": 16,
  2255. "count": 1,
  2256. "precision": "highp "
  2257. },
  2258. {
  2259. "name": "cc_reflectionProbeData2",
  2260. "typename": "vec4",
  2261. "type": 16,
  2262. "count": 1,
  2263. "precision": "highp "
  2264. },
  2265. {
  2266. "name": "cc_reflectionProbeBlendData1",
  2267. "typename": "vec4",
  2268. "type": 16,
  2269. "count": 1,
  2270. "precision": "highp "
  2271. },
  2272. {
  2273. "name": "cc_reflectionProbeBlendData2",
  2274. "typename": "vec4",
  2275. "type": 16,
  2276. "count": 1,
  2277. "precision": "highp "
  2278. }
  2279. ],
  2280. "defines": [],
  2281. "stageFlags": 1
  2282. }
  2283. ],
  2284. "samplerTextures": [],
  2285. "samplers": [],
  2286. "textures": [],
  2287. "buffers": [],
  2288. "images": [],
  2289. "subpassInputs": []
  2290. },
  2291. {
  2292. "rate": 1,
  2293. "blocks": [
  2294. {
  2295. "name": "Constants",
  2296. "members": [
  2297. {
  2298. "name": "mainTiling_Offset",
  2299. "type": 16,
  2300. "count": 1
  2301. },
  2302. {
  2303. "name": "frameTile_velLenScale",
  2304. "type": 16,
  2305. "count": 1
  2306. },
  2307. {
  2308. "name": "scale",
  2309. "type": 16,
  2310. "count": 1
  2311. },
  2312. {
  2313. "name": "nodeRotation",
  2314. "type": 16,
  2315. "count": 1
  2316. }
  2317. ],
  2318. "defines": [],
  2319. "stageFlags": 1,
  2320. "binding": 0
  2321. }
  2322. ],
  2323. "samplerTextures": [
  2324. {
  2325. "name": "mainTexture",
  2326. "type": 28,
  2327. "count": 1,
  2328. "defines": [],
  2329. "stageFlags": 16,
  2330. "binding": 1
  2331. }
  2332. ],
  2333. "samplers": [],
  2334. "textures": [],
  2335. "buffers": [],
  2336. "images": [],
  2337. "subpassInputs": []
  2338. },
  2339. {
  2340. "rate": 2,
  2341. "blocks": [],
  2342. "samplerTextures": [],
  2343. "samplers": [],
  2344. "textures": [],
  2345. "buffers": [],
  2346. "images": [],
  2347. "subpassInputs": []
  2348. },
  2349. {
  2350. "rate": 3,
  2351. "blocks": [
  2352. {
  2353. "tags": {
  2354. "builtin": "global"
  2355. },
  2356. "name": "CCGlobal",
  2357. "members": [
  2358. {
  2359. "name": "cc_time",
  2360. "typename": "vec4",
  2361. "type": 16,
  2362. "count": 1,
  2363. "precision": "highp "
  2364. },
  2365. {
  2366. "name": "cc_screenSize",
  2367. "typename": "vec4",
  2368. "type": 16,
  2369. "count": 1,
  2370. "precision": "mediump "
  2371. },
  2372. {
  2373. "name": "cc_nativeSize",
  2374. "typename": "vec4",
  2375. "type": 16,
  2376. "count": 1,
  2377. "precision": "mediump "
  2378. },
  2379. {
  2380. "name": "cc_probeInfo",
  2381. "typename": "vec4",
  2382. "type": 16,
  2383. "count": 1,
  2384. "precision": "mediump "
  2385. },
  2386. {
  2387. "name": "cc_debug_view_mode",
  2388. "typename": "vec4",
  2389. "type": 16,
  2390. "count": 1,
  2391. "precision": "mediump "
  2392. }
  2393. ],
  2394. "defines": [],
  2395. "stageFlags": 17
  2396. },
  2397. {
  2398. "tags": {
  2399. "builtin": "global"
  2400. },
  2401. "name": "CCCamera",
  2402. "members": [
  2403. {
  2404. "name": "cc_matView",
  2405. "typename": "mat4",
  2406. "type": 25,
  2407. "count": 1,
  2408. "precision": "highp "
  2409. },
  2410. {
  2411. "name": "cc_matViewInv",
  2412. "typename": "mat4",
  2413. "type": 25,
  2414. "count": 1,
  2415. "precision": "highp "
  2416. },
  2417. {
  2418. "name": "cc_matProj",
  2419. "typename": "mat4",
  2420. "type": 25,
  2421. "count": 1,
  2422. "precision": "highp "
  2423. },
  2424. {
  2425. "name": "cc_matProjInv",
  2426. "typename": "mat4",
  2427. "type": 25,
  2428. "count": 1,
  2429. "precision": "highp "
  2430. },
  2431. {
  2432. "name": "cc_matViewProj",
  2433. "typename": "mat4",
  2434. "type": 25,
  2435. "count": 1,
  2436. "precision": "highp "
  2437. },
  2438. {
  2439. "name": "cc_matViewProjInv",
  2440. "typename": "mat4",
  2441. "type": 25,
  2442. "count": 1,
  2443. "precision": "highp "
  2444. },
  2445. {
  2446. "name": "cc_cameraPos",
  2447. "typename": "vec4",
  2448. "type": 16,
  2449. "count": 1,
  2450. "precision": "highp "
  2451. },
  2452. {
  2453. "name": "cc_surfaceTransform",
  2454. "typename": "vec4",
  2455. "type": 16,
  2456. "count": 1,
  2457. "precision": "mediump "
  2458. },
  2459. {
  2460. "name": "cc_screenScale",
  2461. "typename": "vec4",
  2462. "type": 16,
  2463. "count": 1,
  2464. "precision": "mediump "
  2465. },
  2466. {
  2467. "name": "cc_exposure",
  2468. "typename": "vec4",
  2469. "type": 16,
  2470. "count": 1,
  2471. "precision": "mediump "
  2472. },
  2473. {
  2474. "name": "cc_mainLitDir",
  2475. "typename": "vec4",
  2476. "type": 16,
  2477. "count": 1,
  2478. "precision": "mediump "
  2479. },
  2480. {
  2481. "name": "cc_mainLitColor",
  2482. "typename": "vec4",
  2483. "type": 16,
  2484. "count": 1,
  2485. "precision": "mediump "
  2486. },
  2487. {
  2488. "name": "cc_ambientSky",
  2489. "typename": "vec4",
  2490. "type": 16,
  2491. "count": 1,
  2492. "precision": "mediump "
  2493. },
  2494. {
  2495. "name": "cc_ambientGround",
  2496. "typename": "vec4",
  2497. "type": 16,
  2498. "count": 1,
  2499. "precision": "mediump "
  2500. },
  2501. {
  2502. "name": "cc_fogColor",
  2503. "typename": "vec4",
  2504. "type": 16,
  2505. "count": 1,
  2506. "precision": "mediump "
  2507. },
  2508. {
  2509. "name": "cc_fogBase",
  2510. "typename": "vec4",
  2511. "type": 16,
  2512. "count": 1,
  2513. "precision": "mediump "
  2514. },
  2515. {
  2516. "name": "cc_fogAdd",
  2517. "typename": "vec4",
  2518. "type": 16,
  2519. "count": 1,
  2520. "precision": "mediump "
  2521. },
  2522. {
  2523. "name": "cc_nearFar",
  2524. "typename": "vec4",
  2525. "type": 16,
  2526. "count": 1,
  2527. "precision": "mediump "
  2528. },
  2529. {
  2530. "name": "cc_viewPort",
  2531. "typename": "vec4",
  2532. "type": 16,
  2533. "count": 1,
  2534. "precision": "mediump "
  2535. }
  2536. ],
  2537. "defines": [],
  2538. "stageFlags": 17
  2539. }
  2540. ],
  2541. "samplerTextures": [],
  2542. "samplers": [],
  2543. "textures": [],
  2544. "buffers": [],
  2545. "images": [],
  2546. "subpassInputs": []
  2547. }
  2548. ],
  2549. "hash": 2411109044,
  2550. "glsl4": {
  2551. "vert": "\nprecision highp 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}\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(location = 0) in vec3 a_texCoord1;\nlayout(location = 1) in vec3 a_texCoord2;\nlayout(location = 2) in vec4 a_color;\nlayout(location = 3) in vec3 a_texCoord;\n#if !CC_INSTANCE_PARTICLE\n layout(location = 4) in vec3 a_position;\n#endif\n#if CC_INSTANCE_PARTICLE\n layout(location = 5) in vec4 a_texCoord4;\n#endif\n#if CC_RENDER_MODE == 1\n layout(location = 9) in vec3 a_color1;\n#endif\n#if CC_RENDER_MODE == 4\n layout(location = 7) in vec3 a_texCoord3;\n layout(location = 8) in vec3 a_normal;\n layout(location = 9) in vec4 a_color1;\n#endif\nvec4 lpvs_main () {\n vec3 compScale = scale.xyz * a_texCoord1;\n #if !CC_INSTANCE_PARTICLE\n vec4 pos = vec4(a_position.xyz, 1);\n #endif\n #if CC_INSTANCE_PARTICLE\n vec4 pos = vec4(a_texCoord4.xyz, 1);\n #endif\n #if CC_RENDER_MODE == 1\n vec4 velocity = vec4(a_color1.xyz, 0);\n #endif\n #if !CC_USE_WORLD_SPACE\n pos = cc_matWorld * pos;\n #if CC_RENDER_MODE == 1\n velocity = cc_matWorld * velocity;\n #endif\n #endif\n #if ROTATION_OVER_TIME_MODULE_ENABLE\n vec3 rotTmp = a_texCoord2;\n float mulFactor = 1.0;\n if (rotTmp.x > 10.0 * 0.5) {\n rotTmp.x -= 10.0;\n mulFactor = -1.0;\n }\n vec4 rot = vec4(rotTmp, 0.0);\n rot.w = mulFactor * sqrt(abs(1.0 - rot.x * rot.x - rot.y * rot.y - rot.z * rot.z));\n #endif\n #if !ROTATION_OVER_TIME_MODULE_ENABLE\n #if CC_RENDER_MODE != 4\n #if CC_RENDER_MODE == 0\n vec3 rotEuler = a_texCoord2;\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., a_texCoord2.z);\n #endif\n vec4 rot = quaternionFromEuler(rotEuler);\n #endif\n #if CC_RENDER_MODE == 4\n vec4 rot = quaternionFromEuler(a_texCoord2);\n #endif\n #endif\n #if CC_RENDER_MODE != 4\n vec2 cornerOffset = vec2((a_texCoord.xy - 0.5));\n #if CC_RENDER_MODE == 0 || CC_RENDER_MODE == 3\n computeVertPos(pos, cornerOffset, rot, compScale, cc_matViewInv);\n #elif CC_RENDER_MODE == 1\n computeVertPos(pos, cornerOffset, rot, compScale, cc_cameraPos.xyz, velocity, frameTile_velLenScale.z, frameTile_velLenScale.w, a_texCoord.x);\n #elif 2\n computeVertPos(pos, cornerOffset, rot, compScale);\n #endif\n color = a_color;\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_color * a_color1;\n #endif\n #if !CC_INSTANCE_PARTICLE\n uv = computeUV(a_texCoord.z, a_texCoord.xy, frameTile_velLenScale.xy) * mainTiling_Offset.xy + mainTiling_Offset.zw;\n #endif\n #if CC_INSTANCE_PARTICLE\n uv = computeUV(a_texCoord4.w, a_texCoord.xy, frameTile_velLenScale.xy) * mainTiling_Offset.xy + mainTiling_Offset.zw;\n #endif\n pos = cc_matViewProj * pos;\n return pos;\n}\nvoid main() { gl_Position = lpvs_main(); }",
  2552. "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 = 1) 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(); }"
  2553. },
  2554. "glsl3": {
  2555. "vert": "\nprecision highp 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}\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}\nin vec3 a_texCoord1;\nin vec3 a_texCoord2;\nin vec4 a_color;\nin vec3 a_texCoord;\n#if !CC_INSTANCE_PARTICLE\n in vec3 a_position;\n#endif\n#if CC_INSTANCE_PARTICLE\n in vec4 a_texCoord4;\n#endif\n#if CC_RENDER_MODE == 1\n in vec3 a_color1;\n#endif\n#if CC_RENDER_MODE == 4\n in vec3 a_texCoord3;\n in vec3 a_normal;\n in vec4 a_color1;\n#endif\nvec4 lpvs_main () {\n vec3 compScale = scale.xyz * a_texCoord1;\n #if !CC_INSTANCE_PARTICLE\n vec4 pos = vec4(a_position.xyz, 1);\n #endif\n #if CC_INSTANCE_PARTICLE\n vec4 pos = vec4(a_texCoord4.xyz, 1);\n #endif\n #if CC_RENDER_MODE == 1\n vec4 velocity = vec4(a_color1.xyz, 0);\n #endif\n #if !CC_USE_WORLD_SPACE\n pos = cc_matWorld * pos;\n #if CC_RENDER_MODE == 1\n velocity = cc_matWorld * velocity;\n #endif\n #endif\n #if ROTATION_OVER_TIME_MODULE_ENABLE\n vec3 rotTmp = a_texCoord2;\n float mulFactor = 1.0;\n if (rotTmp.x > 10.0 * 0.5) {\n rotTmp.x -= 10.0;\n mulFactor = -1.0;\n }\n vec4 rot = vec4(rotTmp, 0.0);\n rot.w = mulFactor * sqrt(abs(1.0 - rot.x * rot.x - rot.y * rot.y - rot.z * rot.z));\n #endif\n #if !ROTATION_OVER_TIME_MODULE_ENABLE\n #if CC_RENDER_MODE != 4\n #if CC_RENDER_MODE == 0\n vec3 rotEuler = a_texCoord2;\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., a_texCoord2.z);\n #endif\n vec4 rot = quaternionFromEuler(rotEuler);\n #endif\n #if CC_RENDER_MODE == 4\n vec4 rot = quaternionFromEuler(a_texCoord2);\n #endif\n #endif\n #if CC_RENDER_MODE != 4\n vec2 cornerOffset = vec2((a_texCoord.xy - 0.5));\n #if CC_RENDER_MODE == 0 || CC_RENDER_MODE == 3\n computeVertPos(pos, cornerOffset, rot, compScale, cc_matViewInv);\n #elif CC_RENDER_MODE == 1\n computeVertPos(pos, cornerOffset, rot, compScale, cc_cameraPos.xyz, velocity, frameTile_velLenScale.z, frameTile_velLenScale.w, a_texCoord.x);\n #elif 2\n computeVertPos(pos, cornerOffset, rot, compScale);\n #endif\n color = a_color;\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_color * a_color1;\n #endif\n #if !CC_INSTANCE_PARTICLE\n uv = computeUV(a_texCoord.z, a_texCoord.xy, frameTile_velLenScale.xy) * mainTiling_Offset.xy + mainTiling_Offset.zw;\n #endif\n #if CC_INSTANCE_PARTICLE\n uv = computeUV(a_texCoord4.w, a_texCoord.xy, frameTile_velLenScale.xy) * mainTiling_Offset.xy + mainTiling_Offset.zw;\n #endif\n pos = cc_matViewProj * pos;\n return pos;\n}\nvoid main() { gl_Position = lpvs_main(); }",
  2556. "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(); }"
  2557. },
  2558. "glsl1": {
  2559. "vert": "\nprecision highp 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}\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}\nattribute vec3 a_texCoord1;\nattribute vec3 a_texCoord2;\nattribute vec4 a_color;\nattribute vec3 a_texCoord;\n#if !CC_INSTANCE_PARTICLE\n attribute vec3 a_position;\n#endif\n#if CC_INSTANCE_PARTICLE\n attribute vec4 a_texCoord4;\n#endif\n#if CC_RENDER_MODE == 1\n attribute vec3 a_color1;\n#endif\n#if CC_RENDER_MODE == 4\n attribute vec3 a_texCoord3;\n attribute vec3 a_normal;\n attribute vec4 a_color1;\n#endif\nvec4 lpvs_main () {\n vec3 compScale = scale.xyz * a_texCoord1;\n #if !CC_INSTANCE_PARTICLE\n vec4 pos = vec4(a_position.xyz, 1);\n #endif\n #if CC_INSTANCE_PARTICLE\n vec4 pos = vec4(a_texCoord4.xyz, 1);\n #endif\n #if CC_RENDER_MODE == 1\n vec4 velocity = vec4(a_color1.xyz, 0);\n #endif\n #if !CC_USE_WORLD_SPACE\n pos = cc_matWorld * pos;\n #if CC_RENDER_MODE == 1\n velocity = cc_matWorld * velocity;\n #endif\n #endif\n #if ROTATION_OVER_TIME_MODULE_ENABLE\n vec3 rotTmp = a_texCoord2;\n float mulFactor = 1.0;\n if (rotTmp.x > 10.0 * 0.5) {\n rotTmp.x -= 10.0;\n mulFactor = -1.0;\n }\n vec4 rot = vec4(rotTmp, 0.0);\n rot.w = mulFactor * sqrt(abs(1.0 - rot.x * rot.x - rot.y * rot.y - rot.z * rot.z));\n #endif\n #if !ROTATION_OVER_TIME_MODULE_ENABLE\n #if CC_RENDER_MODE != 4\n #if CC_RENDER_MODE == 0\n vec3 rotEuler = a_texCoord2;\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., a_texCoord2.z);\n #endif\n vec4 rot = quaternionFromEuler(rotEuler);\n #endif\n #if CC_RENDER_MODE == 4\n vec4 rot = quaternionFromEuler(a_texCoord2);\n #endif\n #endif\n #if CC_RENDER_MODE != 4\n vec2 cornerOffset = vec2((a_texCoord.xy - 0.5));\n #if CC_RENDER_MODE == 0 || CC_RENDER_MODE == 3\n computeVertPos(pos, cornerOffset, rot, compScale, cc_matViewInv);\n #elif CC_RENDER_MODE == 1\n computeVertPos(pos, cornerOffset, rot, compScale, cc_cameraPos.xyz, velocity, frameTile_velLenScale.z, frameTile_velLenScale.w, a_texCoord.x);\n #elif 2\n computeVertPos(pos, cornerOffset, rot, compScale);\n #endif\n color = a_color;\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_color * a_color1;\n #endif\n #if !CC_INSTANCE_PARTICLE\n uv = computeUV(a_texCoord.z, a_texCoord.xy, frameTile_velLenScale.xy) * mainTiling_Offset.xy + mainTiling_Offset.zw;\n #endif\n #if CC_INSTANCE_PARTICLE\n uv = computeUV(a_texCoord4.w, a_texCoord.xy, frameTile_velLenScale.xy) * mainTiling_Offset.xy + mainTiling_Offset.zw;\n #endif\n pos = cc_matViewProj * pos;\n return pos;\n}\nvoid main() { gl_Position = lpvs_main(); }",
  2560. "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(); }"
  2561. },
  2562. "builtins": {
  2563. "globals": {
  2564. "blocks": [
  2565. {
  2566. "name": "CCGlobal",
  2567. "defines": []
  2568. },
  2569. {
  2570. "name": "CCCamera",
  2571. "defines": []
  2572. }
  2573. ],
  2574. "samplerTextures": [],
  2575. "buffers": [],
  2576. "images": []
  2577. },
  2578. "locals": {
  2579. "blocks": [
  2580. {
  2581. "name": "CCLocal",
  2582. "defines": []
  2583. }
  2584. ],
  2585. "samplerTextures": [],
  2586. "buffers": [],
  2587. "images": []
  2588. },
  2589. "statistics": {
  2590. "CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS": 60,
  2591. "CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS": 42
  2592. }
  2593. },
  2594. "defines": [
  2595. {
  2596. "name": "CC_RENDER_MODE",
  2597. "type": "number",
  2598. "defines": [],
  2599. "range": [
  2600. 0,
  2601. 4
  2602. ]
  2603. },
  2604. {
  2605. "name": "CC_INSTANCE_PARTICLE",
  2606. "type": "boolean",
  2607. "defines": []
  2608. },
  2609. {
  2610. "name": "CC_USE_WORLD_SPACE",
  2611. "type": "boolean",
  2612. "defines": []
  2613. },
  2614. {
  2615. "name": "ROTATION_OVER_TIME_MODULE_ENABLE",
  2616. "type": "boolean",
  2617. "defines": []
  2618. }
  2619. ],
  2620. "name": "particles/builtin-particle|builtin/internal/particle-vs-legacy:lpvs_main|no-tint-fs:premultiplied"
  2621. }
  2622. ],
  2623. "combinations": [],
  2624. "hideInEditor": false
  2625. }