release.json 189 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370
  1. [
  2. 1,
  3. 0,
  4. 0,
  5. [
  6. [
  7. "cc.EffectAsset",
  8. [
  9. "_name",
  10. "shaders",
  11. "techniques"
  12. ],
  13. 0
  14. ]
  15. ],
  16. [
  17. [
  18. 0,
  19. 0,
  20. 1,
  21. 2,
  22. 4
  23. ]
  24. ],
  25. [
  26. [
  27. 0,
  28. "builtin-unlit",
  29. [
  30. {
  31. "hash": 340555192,
  32. "name": "builtin-unlit|unlit-vs:vert|unlit-fs:frag",
  33. "blocks": [
  34. {
  35. "name": "TexCoords",
  36. "stageFlags": 1,
  37. "binding": 0,
  38. "members": [
  39. {
  40. "name": "tilingOffset",
  41. "type": 16,
  42. "count": 1
  43. }
  44. ],
  45. "defines": [
  46. "USE_TEXTURE"
  47. ]
  48. },
  49. {
  50. "name": "Constant",
  51. "stageFlags": 16,
  52. "binding": 1,
  53. "members": [
  54. {
  55. "name": "mainColor",
  56. "type": 16,
  57. "count": 1
  58. },
  59. {
  60. "name": "colorScaleAndCutoff",
  61. "type": 16,
  62. "count": 1
  63. }
  64. ],
  65. "defines": []
  66. }
  67. ],
  68. "samplerTextures": [
  69. {
  70. "name": "mainTexture",
  71. "type": 28,
  72. "count": 1,
  73. "stageFlags": 16,
  74. "binding": 2,
  75. "defines": [
  76. "USE_TEXTURE"
  77. ]
  78. }
  79. ],
  80. "samplers": [],
  81. "textures": [],
  82. "buffers": [],
  83. "images": [],
  84. "subpassInputs": [],
  85. "attributes": [
  86. {
  87. "name": "a_position",
  88. "format": 32,
  89. "location": 0,
  90. "defines": []
  91. },
  92. {
  93. "name": "a_normal",
  94. "format": 32,
  95. "location": 1,
  96. "defines": []
  97. },
  98. {
  99. "name": "a_texCoord",
  100. "format": 21,
  101. "location": 2,
  102. "defines": []
  103. },
  104. {
  105. "name": "a_tangent",
  106. "format": 44,
  107. "location": 3,
  108. "defines": []
  109. },
  110. {
  111. "name": "a_joints",
  112. "location": 4,
  113. "defines": [
  114. "CC_USE_SKINNING"
  115. ]
  116. },
  117. {
  118. "name": "a_weights",
  119. "format": 44,
  120. "location": 5,
  121. "defines": [
  122. "CC_USE_SKINNING"
  123. ]
  124. },
  125. {
  126. "name": "a_jointAnimInfo",
  127. "format": 44,
  128. "isInstanced": true,
  129. "location": 6,
  130. "defines": [
  131. "USE_INSTANCING",
  132. "CC_USE_BAKED_ANIMATION"
  133. ]
  134. },
  135. {
  136. "name": "a_matWorld0",
  137. "format": 44,
  138. "isInstanced": true,
  139. "location": 7,
  140. "defines": [
  141. "USE_INSTANCING"
  142. ]
  143. },
  144. {
  145. "name": "a_matWorld1",
  146. "format": 44,
  147. "isInstanced": true,
  148. "location": 8,
  149. "defines": [
  150. "USE_INSTANCING"
  151. ]
  152. },
  153. {
  154. "name": "a_matWorld2",
  155. "format": 44,
  156. "isInstanced": true,
  157. "location": 9,
  158. "defines": [
  159. "USE_INSTANCING"
  160. ]
  161. },
  162. {
  163. "name": "a_lightingMapUVParam",
  164. "format": 44,
  165. "isInstanced": true,
  166. "location": 10,
  167. "defines": [
  168. "USE_INSTANCING",
  169. "CC_USE_LIGHTMAP"
  170. ]
  171. },
  172. {
  173. "name": "a_localShadowBiasAndProbeId",
  174. "format": 44,
  175. "isInstanced": true,
  176. "location": 11,
  177. "defines": [
  178. "USE_INSTANCING"
  179. ]
  180. },
  181. {
  182. "name": "a_reflectionProbeData",
  183. "format": 44,
  184. "isInstanced": true,
  185. "location": 12,
  186. "defines": [
  187. "USE_INSTANCING",
  188. "CC_USE_REFLECTION_PROBE"
  189. ]
  190. },
  191. {
  192. "name": "a_sh_linear_const_r",
  193. "format": 44,
  194. "isInstanced": true,
  195. "location": 13,
  196. "defines": [
  197. "USE_INSTANCING",
  198. "CC_USE_LIGHT_PROBE"
  199. ]
  200. },
  201. {
  202. "name": "a_sh_linear_const_g",
  203. "format": 44,
  204. "isInstanced": true,
  205. "location": 14,
  206. "defines": [
  207. "USE_INSTANCING",
  208. "CC_USE_LIGHT_PROBE"
  209. ]
  210. },
  211. {
  212. "name": "a_sh_linear_const_b",
  213. "format": 44,
  214. "isInstanced": true,
  215. "location": 15,
  216. "defines": [
  217. "USE_INSTANCING",
  218. "CC_USE_LIGHT_PROBE"
  219. ]
  220. },
  221. {
  222. "name": "a_vertexId",
  223. "format": 11,
  224. "location": 16,
  225. "defines": [
  226. "CC_USE_MORPH"
  227. ]
  228. },
  229. {
  230. "name": "a_color",
  231. "format": 44,
  232. "location": 17,
  233. "defines": [
  234. "USE_VERTEX_COLOR"
  235. ]
  236. }
  237. ],
  238. "fragColors": [
  239. {
  240. "name": "cc_FragColor",
  241. "typename": "vec4",
  242. "type": 16,
  243. "count": 1,
  244. "stageFlags": 16,
  245. "location": 0,
  246. "defines": []
  247. }
  248. ],
  249. "descriptors": [
  250. {
  251. "rate": 0,
  252. "blocks": [
  253. {
  254. "name": "CCMorph",
  255. "stageFlags": 1,
  256. "tags": {
  257. "builtin": "local"
  258. },
  259. "members": [
  260. {
  261. "name": "cc_displacementWeights",
  262. "typename": "vec4",
  263. "type": 16,
  264. "count": 15,
  265. "isArray": true
  266. },
  267. {
  268. "name": "cc_displacementTextureInfo",
  269. "typename": "vec4",
  270. "type": 16,
  271. "count": 1
  272. }
  273. ],
  274. "defines": [
  275. "CC_USE_MORPH"
  276. ]
  277. },
  278. {
  279. "name": "CCSkinningTexture",
  280. "stageFlags": 1,
  281. "tags": {
  282. "builtin": "local"
  283. },
  284. "members": [
  285. {
  286. "name": "cc_jointTextureInfo",
  287. "typename": "vec4",
  288. "type": 16,
  289. "count": 1,
  290. "precision": "highp "
  291. }
  292. ],
  293. "defines": [
  294. "CC_USE_SKINNING",
  295. "CC_USE_BAKED_ANIMATION"
  296. ]
  297. },
  298. {
  299. "name": "CCSkinningAnimation",
  300. "stageFlags": 1,
  301. "tags": {
  302. "builtin": "local"
  303. },
  304. "members": [
  305. {
  306. "name": "cc_jointAnimInfo",
  307. "typename": "vec4",
  308. "type": 16,
  309. "count": 1,
  310. "precision": "highp "
  311. }
  312. ],
  313. "defines": [
  314. "CC_USE_SKINNING",
  315. "CC_USE_BAKED_ANIMATION"
  316. ]
  317. },
  318. {
  319. "name": "CCSkinning",
  320. "stageFlags": 1,
  321. "tags": {
  322. "builtin": "local"
  323. },
  324. "members": [
  325. {
  326. "name": "cc_joints",
  327. "typename": "vec4",
  328. "type": 16,
  329. "count": 0,
  330. "precision": "highp ",
  331. "isArray": true
  332. }
  333. ],
  334. "defines": [
  335. "CC_USE_SKINNING",
  336. "!CC_USE_BAKED_ANIMATION",
  337. "!CC_USE_REAL_TIME_JOINT_TEXTURE"
  338. ]
  339. },
  340. {
  341. "name": "CCLocal",
  342. "stageFlags": 1,
  343. "tags": {
  344. "builtin": "local"
  345. },
  346. "members": [
  347. {
  348. "name": "cc_matWorld",
  349. "typename": "mat4",
  350. "type": 25,
  351. "count": 1,
  352. "precision": "highp "
  353. },
  354. {
  355. "name": "cc_matWorldIT",
  356. "typename": "mat4",
  357. "type": 25,
  358. "count": 1,
  359. "precision": "highp "
  360. },
  361. {
  362. "name": "cc_lightingMapUVParam",
  363. "typename": "vec4",
  364. "type": 16,
  365. "count": 1,
  366. "precision": "highp "
  367. },
  368. {
  369. "name": "cc_localShadowBias",
  370. "typename": "vec4",
  371. "type": 16,
  372. "count": 1,
  373. "precision": "highp "
  374. },
  375. {
  376. "name": "cc_reflectionProbeData1",
  377. "typename": "vec4",
  378. "type": 16,
  379. "count": 1,
  380. "precision": "highp "
  381. },
  382. {
  383. "name": "cc_reflectionProbeData2",
  384. "typename": "vec4",
  385. "type": 16,
  386. "count": 1,
  387. "precision": "highp "
  388. },
  389. {
  390. "name": "cc_reflectionProbeBlendData1",
  391. "typename": "vec4",
  392. "type": 16,
  393. "count": 1,
  394. "precision": "highp "
  395. },
  396. {
  397. "name": "cc_reflectionProbeBlendData2",
  398. "typename": "vec4",
  399. "type": 16,
  400. "count": 1,
  401. "precision": "highp "
  402. }
  403. ],
  404. "defines": [
  405. "!USE_INSTANCING"
  406. ]
  407. }
  408. ],
  409. "samplerTextures": [
  410. {
  411. "name": "cc_PositionDisplacements",
  412. "typename": "sampler2D",
  413. "type": 28,
  414. "count": 1,
  415. "stageFlags": 1,
  416. "tags": {
  417. "builtin": "local"
  418. },
  419. "defines": [
  420. "CC_USE_MORPH",
  421. "CC_MORPH_TARGET_HAS_POSITION"
  422. ]
  423. },
  424. {
  425. "name": "cc_NormalDisplacements",
  426. "typename": "sampler2D",
  427. "type": 28,
  428. "count": 1,
  429. "stageFlags": 1,
  430. "tags": {
  431. "builtin": "local"
  432. },
  433. "defines": [
  434. "CC_USE_MORPH",
  435. "CC_MORPH_TARGET_HAS_NORMAL"
  436. ]
  437. },
  438. {
  439. "name": "cc_TangentDisplacements",
  440. "typename": "sampler2D",
  441. "type": 28,
  442. "count": 1,
  443. "stageFlags": 1,
  444. "tags": {
  445. "builtin": "local"
  446. },
  447. "defines": [
  448. "CC_USE_MORPH",
  449. "CC_MORPH_TARGET_HAS_TANGENT"
  450. ]
  451. },
  452. {
  453. "name": "cc_jointTexture",
  454. "typename": "sampler2D",
  455. "type": 28,
  456. "count": 1,
  457. "precision": "highp ",
  458. "stageFlags": 1,
  459. "tags": {
  460. "builtin": "local"
  461. },
  462. "defines": [
  463. "CC_USE_SKINNING",
  464. "CC_USE_BAKED_ANIMATION"
  465. ]
  466. },
  467. {
  468. "name": "cc_realtimeJoint",
  469. "typename": "sampler2D",
  470. "type": 28,
  471. "count": 1,
  472. "precision": "highp ",
  473. "stageFlags": 1,
  474. "tags": {
  475. "builtin": "local"
  476. },
  477. "defines": [
  478. "CC_USE_SKINNING",
  479. "!CC_USE_BAKED_ANIMATION",
  480. "CC_USE_REAL_TIME_JOINT_TEXTURE"
  481. ]
  482. }
  483. ],
  484. "samplers": [],
  485. "textures": [],
  486. "buffers": [],
  487. "images": [],
  488. "subpassInputs": []
  489. },
  490. {
  491. "rate": 1,
  492. "blocks": [
  493. {
  494. "name": "TexCoords",
  495. "stageFlags": 1,
  496. "binding": 0,
  497. "members": [
  498. {
  499. "name": "tilingOffset",
  500. "type": 16,
  501. "count": 1
  502. }
  503. ],
  504. "defines": [
  505. "USE_TEXTURE"
  506. ]
  507. },
  508. {
  509. "name": "Constant",
  510. "stageFlags": 16,
  511. "binding": 1,
  512. "members": [
  513. {
  514. "name": "mainColor",
  515. "type": 16,
  516. "count": 1
  517. },
  518. {
  519. "name": "colorScaleAndCutoff",
  520. "type": 16,
  521. "count": 1
  522. }
  523. ],
  524. "defines": []
  525. }
  526. ],
  527. "samplerTextures": [
  528. {
  529. "name": "mainTexture",
  530. "type": 28,
  531. "count": 1,
  532. "stageFlags": 16,
  533. "binding": 2,
  534. "defines": [
  535. "USE_TEXTURE"
  536. ]
  537. }
  538. ],
  539. "samplers": [],
  540. "textures": [],
  541. "buffers": [],
  542. "images": [],
  543. "subpassInputs": []
  544. },
  545. {
  546. "rate": 2,
  547. "blocks": [],
  548. "samplerTextures": [],
  549. "samplers": [],
  550. "textures": [],
  551. "buffers": [],
  552. "images": [],
  553. "subpassInputs": []
  554. },
  555. {
  556. "rate": 3,
  557. "blocks": [
  558. {
  559. "name": "CCGlobal",
  560. "stageFlags": 17,
  561. "tags": {
  562. "builtin": "global"
  563. },
  564. "members": [
  565. {
  566. "name": "cc_time",
  567. "typename": "vec4",
  568. "type": 16,
  569. "count": 1,
  570. "precision": "highp "
  571. },
  572. {
  573. "name": "cc_screenSize",
  574. "typename": "vec4",
  575. "type": 16,
  576. "count": 1,
  577. "precision": "mediump "
  578. },
  579. {
  580. "name": "cc_nativeSize",
  581. "typename": "vec4",
  582. "type": 16,
  583. "count": 1,
  584. "precision": "mediump "
  585. },
  586. {
  587. "name": "cc_probeInfo",
  588. "typename": "vec4",
  589. "type": 16,
  590. "count": 1,
  591. "precision": "mediump "
  592. },
  593. {
  594. "name": "cc_debug_view_mode",
  595. "typename": "vec4",
  596. "type": 16,
  597. "count": 1,
  598. "precision": "mediump "
  599. }
  600. ],
  601. "defines": []
  602. },
  603. {
  604. "name": "CCCamera",
  605. "stageFlags": 17,
  606. "tags": {
  607. "builtin": "global"
  608. },
  609. "members": [
  610. {
  611. "name": "cc_matView",
  612. "typename": "mat4",
  613. "type": 25,
  614. "count": 1,
  615. "precision": "highp "
  616. },
  617. {
  618. "name": "cc_matViewInv",
  619. "typename": "mat4",
  620. "type": 25,
  621. "count": 1,
  622. "precision": "highp "
  623. },
  624. {
  625. "name": "cc_matProj",
  626. "typename": "mat4",
  627. "type": 25,
  628. "count": 1,
  629. "precision": "highp "
  630. },
  631. {
  632. "name": "cc_matProjInv",
  633. "typename": "mat4",
  634. "type": 25,
  635. "count": 1,
  636. "precision": "highp "
  637. },
  638. {
  639. "name": "cc_matViewProj",
  640. "typename": "mat4",
  641. "type": 25,
  642. "count": 1,
  643. "precision": "highp "
  644. },
  645. {
  646. "name": "cc_matViewProjInv",
  647. "typename": "mat4",
  648. "type": 25,
  649. "count": 1,
  650. "precision": "highp "
  651. },
  652. {
  653. "name": "cc_cameraPos",
  654. "typename": "vec4",
  655. "type": 16,
  656. "count": 1,
  657. "precision": "highp "
  658. },
  659. {
  660. "name": "cc_surfaceTransform",
  661. "typename": "vec4",
  662. "type": 16,
  663. "count": 1,
  664. "precision": "mediump "
  665. },
  666. {
  667. "name": "cc_screenScale",
  668. "typename": "vec4",
  669. "type": 16,
  670. "count": 1,
  671. "precision": "mediump "
  672. },
  673. {
  674. "name": "cc_exposure",
  675. "typename": "vec4",
  676. "type": 16,
  677. "count": 1,
  678. "precision": "mediump "
  679. },
  680. {
  681. "name": "cc_mainLitDir",
  682. "typename": "vec4",
  683. "type": 16,
  684. "count": 1,
  685. "precision": "mediump "
  686. },
  687. {
  688. "name": "cc_mainLitColor",
  689. "typename": "vec4",
  690. "type": 16,
  691. "count": 1,
  692. "precision": "mediump "
  693. },
  694. {
  695. "name": "cc_ambientSky",
  696. "typename": "vec4",
  697. "type": 16,
  698. "count": 1,
  699. "precision": "mediump "
  700. },
  701. {
  702. "name": "cc_ambientGround",
  703. "typename": "vec4",
  704. "type": 16,
  705. "count": 1,
  706. "precision": "mediump "
  707. },
  708. {
  709. "name": "cc_fogColor",
  710. "typename": "vec4",
  711. "type": 16,
  712. "count": 1,
  713. "precision": "mediump "
  714. },
  715. {
  716. "name": "cc_fogBase",
  717. "typename": "vec4",
  718. "type": 16,
  719. "count": 1,
  720. "precision": "mediump "
  721. },
  722. {
  723. "name": "cc_fogAdd",
  724. "typename": "vec4",
  725. "type": 16,
  726. "count": 1,
  727. "precision": "mediump "
  728. },
  729. {
  730. "name": "cc_nearFar",
  731. "typename": "vec4",
  732. "type": 16,
  733. "count": 1,
  734. "precision": "mediump "
  735. },
  736. {
  737. "name": "cc_viewPort",
  738. "typename": "vec4",
  739. "type": 16,
  740. "count": 1,
  741. "precision": "mediump "
  742. }
  743. ],
  744. "defines": []
  745. }
  746. ],
  747. "samplerTextures": [],
  748. "samplers": [],
  749. "textures": [],
  750. "buffers": [],
  751. "images": [],
  752. "subpassInputs": []
  753. }
  754. ],
  755. "glsl3": {
  756. "vert": "\nprecision highp float;\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\nstruct StandardVertInput {\n highp vec4 position;\n vec3 normal;\n vec4 tangent;\n};\nin vec3 a_position;\nin vec3 a_normal;\nin vec2 a_texCoord;\nin vec4 a_tangent;\n#if CC_USE_SKINNING\n in vec4 a_joints;\n in vec4 a_weights;\n#endif\n#if USE_INSTANCING\n #if CC_USE_BAKED_ANIMATION\n in highp vec4 a_jointAnimInfo;\n #endif\n in vec4 a_matWorld0;\n in vec4 a_matWorld1;\n in vec4 a_matWorld2;\n #if CC_USE_LIGHTMAP\n in vec4 a_lightingMapUVParam;\n #endif\n #if CC_USE_REFLECTION_PROBE || CC_RECEIVE_SHADOW\n #if CC_RECEIVE_SHADOW\n #endif\n in vec4 a_localShadowBiasAndProbeId;\n #endif\n #if CC_USE_REFLECTION_PROBE\n in vec4 a_reflectionProbeData;\n #endif\n #if CC_USE_LIGHT_PROBE\n in vec4 a_sh_linear_const_r;\n in vec4 a_sh_linear_const_g;\n in vec4 a_sh_linear_const_b;\n #endif\n#endif\n#if CC_USE_MORPH\n in float a_vertexId;\n int getVertexId() {\n return int(a_vertexId);\n }\n#endif\nhighp float decode32 (highp vec4 rgba) {\n rgba = rgba * 255.0;\n highp float Sign = 1.0 - (step(128.0, (rgba[3]) + 0.5)) * 2.0;\n highp float Exponent = 2.0 * (mod(float(int((rgba[3]) + 0.5)), 128.0)) + (step(128.0, (rgba[2]) + 0.5)) - 127.0;\n highp float Mantissa = (mod(float(int((rgba[2]) + 0.5)), 128.0)) * 65536.0 + rgba[1] * 256.0 + rgba[0] + 8388608.0;\n return Sign * exp2(Exponent - 23.0) * Mantissa;\n}\n#if CC_USE_MORPH\n layout(std140) uniform CCMorph {\n vec4 cc_displacementWeights[15];\n vec4 cc_displacementTextureInfo;\n };\n #if CC_MORPH_TARGET_HAS_POSITION\n uniform sampler2D cc_PositionDisplacements;\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n uniform sampler2D cc_NormalDisplacements;\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n uniform sampler2D cc_TangentDisplacements;\n #endif\n vec2 getPixelLocation(vec2 textureResolution, int pixelIndex) {\n float pixelIndexF = float(pixelIndex);\n float x = mod(pixelIndexF, textureResolution.x);\n float y = floor(pixelIndexF / textureResolution.x);\n return vec2(x, y);\n }\n vec2 getPixelCoordFromLocation(vec2 location, vec2 textureResolution) {\n return (vec2(location.x, location.y) + .5) / textureResolution;\n }\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n vec4 fetchVec3ArrayFromTexture(sampler2D tex, int pixelIndex) {\n ivec2 texSize = textureSize(tex, 0);\n return texelFetch(tex, ivec2(pixelIndex % texSize.x, pixelIndex / texSize.x), 0);\n }\n #else\n vec4 fetchVec3ArrayFromTexture(sampler2D tex, int elementIndex) {\n int pixelIndex = elementIndex * 4;\n vec2 location = getPixelLocation(cc_displacementTextureInfo.xy, pixelIndex);\n vec2 x = getPixelCoordFromLocation(location + vec2(0.0, 0.0), cc_displacementTextureInfo.xy);\n vec2 y = getPixelCoordFromLocation(location + vec2(1.0, 0.0), cc_displacementTextureInfo.xy);\n vec2 z = getPixelCoordFromLocation(location + vec2(2.0, 0.0), cc_displacementTextureInfo.xy);\n return vec4(\n decode32(texture(tex, x)),\n decode32(texture(tex, y)),\n decode32(texture(tex, z)),\n 1.0\n );\n }\n #endif\n float getDisplacementWeight(int index) {\n int quot = index / 4;\n int remainder = index - quot * 4;\n if (remainder == 0) {\n return cc_displacementWeights[quot].x;\n } else if (remainder == 1) {\n return cc_displacementWeights[quot].y;\n } else if (remainder == 2) {\n return cc_displacementWeights[quot].z;\n } else {\n return cc_displacementWeights[quot].w;\n }\n }\n vec3 getVec3DisplacementFromTexture(sampler2D tex, int vertexIndex) {\n #if CC_MORPH_PRECOMPUTED\n return fetchVec3ArrayFromTexture(tex, vertexIndex).rgb;\n #else\n vec3 result = vec3(0, 0, 0);\n int nVertices = int(cc_displacementTextureInfo.z);\n for (int iTarget = 0; iTarget < CC_MORPH_TARGET_COUNT; ++iTarget) {\n result += (fetchVec3ArrayFromTexture(tex, nVertices * iTarget + vertexIndex).rgb * getDisplacementWeight(iTarget));\n }\n return result;\n #endif\n }\n #if CC_MORPH_TARGET_HAS_POSITION\n vec3 getPositionDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_PositionDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n vec3 getNormalDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_NormalDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n vec3 getTangentDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_TangentDisplacements, vertexId);\n }\n #endif\n void applyMorph (inout vec4 position, inout vec3 normal, inout vec4 tangent) {\n int vertexId = getVertexId();\n #if CC_MORPH_TARGET_HAS_POSITION\n position.xyz = position.xyz + getPositionDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n normal.xyz = normal.xyz + getNormalDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n tangent.xyz = tangent.xyz + getTangentDisplacement(vertexId);\n #endif\n }\n void applyMorph (inout vec4 position) {\n #if CC_MORPH_TARGET_HAS_POSITION\n position.xyz = position.xyz + getPositionDisplacement(getVertexId());\n #endif\n }\n#endif\n#if CC_USE_SKINNING\n #if CC_USE_BAKED_ANIMATION\n layout(std140) uniform CCSkinningTexture {\n highp vec4 cc_jointTextureInfo;\n };\n layout(std140) uniform CCSkinningAnimation {\n highp vec4 cc_jointAnimInfo;\n };\n uniform highp sampler2D cc_jointTexture;\n void CCGetJointTextureCoords(float pixelsPerJoint, float jointIdx, out highp float x, out highp float y, out highp float invSize)\n {\n #if USE_INSTANCING\n highp float temp = pixelsPerJoint * (a_jointAnimInfo.x * a_jointAnimInfo.y + jointIdx) + a_jointAnimInfo.z;\n #else\n highp float temp = pixelsPerJoint * (cc_jointAnimInfo.x * cc_jointTextureInfo.y + jointIdx) + cc_jointTextureInfo.z;\n #endif\n invSize = cc_jointTextureInfo.w;\n highp float tempY = floor(temp * invSize);\n x = floor(temp - tempY * cc_jointTextureInfo.x);\n y = (tempY + 0.5) * invSize;\n }\n #else\n #if CC_USE_REAL_TIME_JOINT_TEXTURE\n uniform highp sampler2D cc_realtimeJoint;\n #else\n layout(std140) uniform CCSkinning {\n highp vec4 cc_joints[CC_JOINT_UNIFORM_CAPACITY * 3];\n };\n #endif\n #endif\n #if CC_USE_BAKED_ANIMATION\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n mat4 getJointMatrix (float i) {\n highp float x, y, invSize;\n CCGetJointTextureCoords(3.0, i, x, y, invSize);\n vec4 v1 = texture(cc_jointTexture, vec2((x + 0.5) * invSize, y));\n vec4 v2 = texture(cc_jointTexture, vec2((x + 1.5) * invSize, y));\n vec4 v3 = texture(cc_jointTexture, vec2((x + 2.5) * invSize, y));\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #else\n mat4 getJointMatrix (float i) {\n highp float x, y, invSize;\n CCGetJointTextureCoords(12.0, i, x, y, invSize);\n vec4 v1 = vec4(\n decode32(texture(cc_jointTexture, vec2((x + 0.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 1.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 2.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 3.5) * invSize, y)))\n );\n vec4 v2 = vec4(\n decode32(texture(cc_jointTexture, vec2((x + 4.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 5.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 6.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 7.5) * invSize, y)))\n );\n vec4 v3 = vec4(\n decode32(texture(cc_jointTexture, vec2((x + 8.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 9.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 10.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 11.5) * invSize, y)))\n );\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #else\n #if CC_USE_REAL_TIME_JOINT_TEXTURE\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n mat4 getJointMatrix (float i) {\n float x = i;\n vec4 v1 = texture(cc_realtimeJoint, vec2( x / 256.0, 0.5 / 3.0));\n vec4 v2 = texture(cc_realtimeJoint, vec2( x / 256.0, 1.5 / 3.0));\n vec4 v3 = texture(cc_realtimeJoint, vec2( x / 256.0, 2.5 / 3.0));\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #else\n mat4 getJointMatrix (float i) {\n float x = 4.0 * i;\n vec4 v1 = vec4(\n decode32(texture(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 0.5 / 3.0)))\n );\n vec4 v2 = vec4(\n decode32(texture(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 1.5 / 3.0)))\n );\n vec4 v3 = vec4(\n decode32(texture(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 2.5 / 3.0)))\n );\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #else\n mat4 getJointMatrix (float i) {\n int idx = int(i);\n vec4 v1 = cc_joints[idx * 3];\n vec4 v2 = cc_joints[idx * 3 + 1];\n vec4 v3 = cc_joints[idx * 3 + 2];\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #endif\n mat4 skinMatrix () {\n vec4 joints = vec4(a_joints);\n return getJointMatrix(joints.x) * a_weights.x\n + getJointMatrix(joints.y) * a_weights.y\n + getJointMatrix(joints.z) * a_weights.z\n + getJointMatrix(joints.w) * a_weights.w;\n }\n void CCSkin (inout vec4 position) {\n mat4 m = skinMatrix();\n position = m * position;\n }\n void CCSkin (inout vec4 position, inout vec3 normal, inout vec4 tangent) {\n mat4 m = skinMatrix();\n position = m * position;\n normal = (m * vec4(normal, 0.0)).xyz;\n tangent.xyz = (m * vec4(tangent.xyz, 0.0)).xyz;\n }\n#endif\nvoid CCVertInput(inout vec4 In)\n{\n In = vec4(a_position, 1.0);\n #if CC_USE_MORPH\n applyMorph(In);\n #endif\n #if CC_USE_SKINNING\n CCSkin(In);\n #endif\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};\n#if !USE_INSTANCING\n layout(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 };\n#endif\nvoid CCGetWorldMatrix(out mat4 matWorld)\n{\n #if USE_INSTANCING\n matWorld = mat4(\n vec4(a_matWorld0.xyz, 0.0),\n vec4(a_matWorld1.xyz, 0.0),\n vec4(a_matWorld2.xyz, 0.0),\n vec4(a_matWorld0.w, a_matWorld1.w, a_matWorld2.w, 1.0)\n );\n #else\n matWorld = cc_matWorld;\n #endif\n}\n#if CC_USE_FOG != 4\n float LinearFog(vec4 pos, vec3 cameraPos, float fogStart, float fogEnd) {\n vec4 wPos = pos;\n float cam_dis = distance(cameraPos, wPos.xyz);\n return clamp((fogEnd - cam_dis) / (fogEnd - fogStart), 0., 1.);\n }\n float ExpFog(vec4 pos, vec3 cameraPos, float fogStart, float fogDensity, float fogAtten) {\n vec4 wPos = pos;\n float cam_dis = max(distance(cameraPos, wPos.xyz) - fogStart, 0.0) / fogAtten * 4.;\n float f = exp(-cam_dis * fogDensity);\n return f;\n }\n float ExpSquaredFog(vec4 pos, vec3 cameraPos, float fogStart, float fogDensity, float fogAtten) {\n vec4 wPos = pos;\n float cam_dis = max(distance(cameraPos, wPos.xyz) - fogStart, 0.0) / fogAtten * 4.;\n float f = exp(-cam_dis * cam_dis * fogDensity * fogDensity);\n return f;\n }\n float LayeredFog(vec4 pos, vec3 cameraPos, float fogTop, float fogRange, float fogAtten) {\n vec4 wPos = pos;\n vec3 camWorldProj = cameraPos.xyz;\n camWorldProj.y = 0.;\n vec3 worldPosProj = wPos.xyz;\n worldPosProj.y = 0.;\n float fDeltaD = distance(worldPosProj, camWorldProj) / fogAtten * 2.0;\n float fDeltaY, fDensityIntegral;\n if (cameraPos.y > fogTop) {\n if (wPos.y < fogTop) {\n fDeltaY = (fogTop - wPos.y) / fogRange * 2.0;\n fDensityIntegral = fDeltaY * fDeltaY * 0.5;\n }\n else {\n fDeltaY = 0.;\n fDensityIntegral = 0.;\n }\n }\n else {\n if (wPos.y < fogTop) {\n float fDeltaA = (fogTop - cameraPos.y) / fogRange * 2.;\n float fDeltaB = (fogTop - wPos.y) / fogRange * 2.;\n fDeltaY = abs(fDeltaA - fDeltaB);\n fDensityIntegral = abs((fDeltaA * fDeltaA * 0.5) - (fDeltaB * fDeltaB * 0.5));\n }\n else {\n fDeltaY = abs(fogTop - cameraPos.y) / fogRange * 2.;\n fDensityIntegral = abs(fDeltaY * fDeltaY * 0.5);\n }\n }\n float fDensity;\n if (fDeltaY != 0.) {\n fDensity = (sqrt(1.0 + ((fDeltaD / fDeltaY) * (fDeltaD / fDeltaY)))) * fDensityIntegral;\n }\n else {\n fDensity = 0.;\n }\n float f = exp(-fDensity);\n return f;\n }\n#endif\nvoid CC_TRANSFER_FOG_BASE(vec4 pos, out float factor)\n{\n#if CC_USE_FOG == 0\n\tfactor = LinearFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.y);\n#elif CC_USE_FOG == 1\n\tfactor = ExpFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.z, cc_fogAdd.z);\n#elif CC_USE_FOG == 2\n\tfactor = ExpSquaredFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.z, cc_fogAdd.z);\n#elif CC_USE_FOG == 3\n\tfactor = LayeredFog(pos, cc_cameraPos.xyz, cc_fogAdd.x, cc_fogAdd.y, cc_fogAdd.z);\n#else\n\tfactor = 1.0;\n#endif\n}\n#if !CC_USE_ACCURATE_FOG\nout mediump float v_fog_factor;\n#endif\nvoid CC_TRANSFER_FOG(vec4 pos) {\n#if !CC_USE_ACCURATE_FOG\n CC_TRANSFER_FOG_BASE(pos, v_fog_factor);\n#endif\n}\n#if USE_VERTEX_COLOR\n in lowp vec4 a_color;\n out lowp vec4 v_color;\n#endif\n#if USE_TEXTURE\n out vec2 v_uv;\n layout(std140) uniform TexCoords {\n vec4 tilingOffset;\n };\n#endif\nvec4 vert () {\n vec4 position;\n CCVertInput(position);\n mat4 matWorld;\n CCGetWorldMatrix(matWorld);\n #if USE_TEXTURE\n v_uv = a_texCoord * tilingOffset.xy + tilingOffset.zw;\n #if SAMPLE_FROM_RT\n v_uv = cc_cameraPos.w > 1.0 ? vec2(v_uv.x, 1.0 - v_uv.y) : v_uv;\n #endif\n #endif\n #if USE_VERTEX_COLOR\n v_color = a_color;\n #endif\n CC_TRANSFER_FOG(matWorld * position);\n return cc_matProj * (cc_matView * matWorld) * position;\n}\nvoid main() { gl_Position = vert(); }",
  757. "frag": "\nprecision highp float;\nvec3 ACESToneMap (vec3 color) {\n color = min(color, vec3(8.0));\n const float A = 2.51;\n const float B = 0.03;\n const float C = 2.43;\n const float D = 0.59;\n const float E = 0.14;\n return (color * (A * color + B)) / (color * (C * color + D) + E);\n}\nvec3 SRGBToLinear (vec3 gamma) {\n#ifdef CC_USE_SURFACE_SHADER\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC && CC_SURFACES_ENABLE_DEBUG_VIEW\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_GAMMA_CORRECTION) {\n return gamma;\n }\n #endif\n#endif\n return gamma * gamma;\n}\nvec3 LinearToSRGB(vec3 linear) {\n#ifdef CC_USE_SURFACE_SHADER\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC && CC_SURFACES_ENABLE_DEBUG_VIEW\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_GAMMA_CORRECTION) {\n return linear;\n }\n #endif\n#endif\n return sqrt(linear);\n}\nvec4 packRGBE (vec3 rgb) {\n highp float maxComp = max(max(rgb.r, rgb.g), rgb.b);\n highp float e = 128.0;\n if (maxComp > 0.0001) {\n e = log(maxComp) / log(1.1);\n e = ceil(e);\n e = clamp(e + 128.0, 0.0, 255.0);\n }\n highp float sc = 1.0 / pow(1.1, e - 128.0);\n vec3 encode = clamp(rgb * sc, vec3(0.0), vec3(1.0)) * 255.0;\n vec3 encode_rounded = floor(encode) + step(encode - floor(encode), vec3(0.5));\n return vec4(encode_rounded, e) / 255.0;\n}\nvec4 CCFragOutput (vec4 color) {\n #if CC_USE_RGBE_OUTPUT\n color = packRGBE(color.rgb);\n #elif !CC_USE_FLOAT_OUTPUT\n #if CC_USE_HDR && CC_TONE_MAPPING_TYPE == HDR_TONE_MAPPING_ACES\n color.rgb = ACESToneMap(color.rgb);\n #endif\n color.rgb = LinearToSRGB(color.rgb);\n #endif\n return color;\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};\n#if CC_USE_FOG != 4\n float LinearFog(vec4 pos, vec3 cameraPos, float fogStart, float fogEnd) {\n vec4 wPos = pos;\n float cam_dis = distance(cameraPos, wPos.xyz);\n return clamp((fogEnd - cam_dis) / (fogEnd - fogStart), 0., 1.);\n }\n float ExpFog(vec4 pos, vec3 cameraPos, float fogStart, float fogDensity, float fogAtten) {\n vec4 wPos = pos;\n float cam_dis = max(distance(cameraPos, wPos.xyz) - fogStart, 0.0) / fogAtten * 4.;\n float f = exp(-cam_dis * fogDensity);\n return f;\n }\n float ExpSquaredFog(vec4 pos, vec3 cameraPos, float fogStart, float fogDensity, float fogAtten) {\n vec4 wPos = pos;\n float cam_dis = max(distance(cameraPos, wPos.xyz) - fogStart, 0.0) / fogAtten * 4.;\n float f = exp(-cam_dis * cam_dis * fogDensity * fogDensity);\n return f;\n }\n float LayeredFog(vec4 pos, vec3 cameraPos, float fogTop, float fogRange, float fogAtten) {\n vec4 wPos = pos;\n vec3 camWorldProj = cameraPos.xyz;\n camWorldProj.y = 0.;\n vec3 worldPosProj = wPos.xyz;\n worldPosProj.y = 0.;\n float fDeltaD = distance(worldPosProj, camWorldProj) / fogAtten * 2.0;\n float fDeltaY, fDensityIntegral;\n if (cameraPos.y > fogTop) {\n if (wPos.y < fogTop) {\n fDeltaY = (fogTop - wPos.y) / fogRange * 2.0;\n fDensityIntegral = fDeltaY * fDeltaY * 0.5;\n }\n else {\n fDeltaY = 0.;\n fDensityIntegral = 0.;\n }\n }\n else {\n if (wPos.y < fogTop) {\n float fDeltaA = (fogTop - cameraPos.y) / fogRange * 2.;\n float fDeltaB = (fogTop - wPos.y) / fogRange * 2.;\n fDeltaY = abs(fDeltaA - fDeltaB);\n fDensityIntegral = abs((fDeltaA * fDeltaA * 0.5) - (fDeltaB * fDeltaB * 0.5));\n }\n else {\n fDeltaY = abs(fogTop - cameraPos.y) / fogRange * 2.;\n fDensityIntegral = abs(fDeltaY * fDeltaY * 0.5);\n }\n }\n float fDensity;\n if (fDeltaY != 0.) {\n fDensity = (sqrt(1.0 + ((fDeltaD / fDeltaY) * (fDeltaD / fDeltaY)))) * fDensityIntegral;\n }\n else {\n fDensity = 0.;\n }\n float f = exp(-fDensity);\n return f;\n }\n#endif\nvoid CC_TRANSFER_FOG_BASE(vec4 pos, out float factor)\n{\n#if CC_USE_FOG == 0\n\tfactor = LinearFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.y);\n#elif CC_USE_FOG == 1\n\tfactor = ExpFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.z, cc_fogAdd.z);\n#elif CC_USE_FOG == 2\n\tfactor = ExpSquaredFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.z, cc_fogAdd.z);\n#elif CC_USE_FOG == 3\n\tfactor = LayeredFog(pos, cc_cameraPos.xyz, cc_fogAdd.x, cc_fogAdd.y, cc_fogAdd.z);\n#else\n\tfactor = 1.0;\n#endif\n}\nvoid CC_APPLY_FOG_BASE(inout vec4 color, float factor) {\n\tcolor = vec4(mix(cc_fogColor.rgb, color.rgb, factor), color.a);\n}\n#if !CC_USE_ACCURATE_FOG\nin mediump float v_fog_factor;\n#endif\nvoid CC_APPLY_FOG(inout vec4 color) {\n#if !CC_USE_ACCURATE_FOG\n CC_APPLY_FOG_BASE(color, v_fog_factor);\n#endif\n}\nvoid CC_APPLY_FOG(inout vec4 color, vec3 worldPos) {\n#if CC_USE_ACCURATE_FOG\n float factor;\n CC_TRANSFER_FOG_BASE(vec4(worldPos, 1.0), factor);\n#else\n float factor = v_fog_factor;\n#endif\n CC_APPLY_FOG_BASE(color, factor);\n}\n#if USE_ALPHA_TEST\n#endif\n#if USE_TEXTURE\n in vec2 v_uv;\n uniform sampler2D mainTexture;\n#endif\nlayout(std140) uniform Constant {\n vec4 mainColor;\n vec4 colorScaleAndCutoff;\n};\n#if USE_VERTEX_COLOR\n in lowp vec4 v_color;\n#endif\nvec4 frag () {\n vec4 o = mainColor;\n o.rgb *= colorScaleAndCutoff.xyz;\n #if USE_VERTEX_COLOR\n o.rgb *= SRGBToLinear(v_color.rgb);\n o.a *= v_color.a;\n #endif\n #if USE_TEXTURE\n vec4 texColor = texture(mainTexture, v_uv);\n texColor.rgb = SRGBToLinear(texColor.rgb);\n o *= texColor;\n #endif\n #if USE_ALPHA_TEST\n if (o.ALPHA_TEST_CHANNEL < colorScaleAndCutoff.w) discard;\n #endif\n CC_APPLY_FOG(o);\n return CCFragOutput(o);\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = frag(); }"
  758. },
  759. "glsl1": {
  760. "vert": "\nprecision highp float;\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\nstruct StandardVertInput {\n highp vec4 position;\n vec3 normal;\n vec4 tangent;\n};\nattribute vec3 a_position;\nattribute vec3 a_normal;\nattribute vec2 a_texCoord;\nattribute vec4 a_tangent;\n#if CC_USE_SKINNING\n attribute vec4 a_joints;\n attribute vec4 a_weights;\n#endif\n#if USE_INSTANCING\n #if CC_USE_BAKED_ANIMATION\n attribute highp vec4 a_jointAnimInfo;\n #endif\n attribute vec4 a_matWorld0;\n attribute vec4 a_matWorld1;\n attribute vec4 a_matWorld2;\n #if CC_USE_LIGHTMAP\n attribute vec4 a_lightingMapUVParam;\n #endif\n #if CC_USE_REFLECTION_PROBE || CC_RECEIVE_SHADOW\n #if CC_RECEIVE_SHADOW\n #endif\n attribute vec4 a_localShadowBiasAndProbeId;\n #endif\n #if CC_USE_REFLECTION_PROBE\n attribute vec4 a_reflectionProbeData;\n #endif\n #if CC_USE_LIGHT_PROBE\n attribute vec4 a_sh_linear_const_r;\n attribute vec4 a_sh_linear_const_g;\n attribute vec4 a_sh_linear_const_b;\n #endif\n#endif\n#if CC_USE_MORPH\n attribute float a_vertexId;\n int getVertexId() {\n return int(a_vertexId);\n }\n#endif\nhighp float decode32 (highp vec4 rgba) {\n rgba = rgba * 255.0;\n highp float Sign = 1.0 - (step(128.0, (rgba[3]) + 0.5)) * 2.0;\n highp float Exponent = 2.0 * (mod(float(int((rgba[3]) + 0.5)), 128.0)) + (step(128.0, (rgba[2]) + 0.5)) - 127.0;\n highp float Mantissa = (mod(float(int((rgba[2]) + 0.5)), 128.0)) * 65536.0 + rgba[1] * 256.0 + rgba[0] + 8388608.0;\n return Sign * exp2(Exponent - 23.0) * Mantissa;\n}\n#if CC_USE_MORPH\n uniform vec4 cc_displacementWeights[15];\n uniform vec4 cc_displacementTextureInfo;\n #if CC_MORPH_TARGET_HAS_POSITION\n uniform sampler2D cc_PositionDisplacements;\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n uniform sampler2D cc_NormalDisplacements;\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n uniform sampler2D cc_TangentDisplacements;\n #endif\n vec2 getPixelLocation(vec2 textureResolution, int pixelIndex) {\n float pixelIndexF = float(pixelIndex);\n float x = mod(pixelIndexF, textureResolution.x);\n float y = floor(pixelIndexF / textureResolution.x);\n return vec2(x, y);\n }\n vec2 getPixelCoordFromLocation(vec2 location, vec2 textureResolution) {\n return (vec2(location.x, location.y) + .5) / textureResolution;\n }\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n vec4 fetchVec3ArrayFromTexture(sampler2D tex, int elementIndex) {\n int pixelIndex = elementIndex;\n vec2 location = getPixelLocation(cc_displacementTextureInfo.xy, pixelIndex);\n vec2 uv = getPixelCoordFromLocation(location, cc_displacementTextureInfo.xy);\n return texture2D(tex, uv);\n }\n #else\n vec4 fetchVec3ArrayFromTexture(sampler2D tex, int elementIndex) {\n int pixelIndex = elementIndex * 4;\n vec2 location = getPixelLocation(cc_displacementTextureInfo.xy, pixelIndex);\n vec2 x = getPixelCoordFromLocation(location + vec2(0.0, 0.0), cc_displacementTextureInfo.xy);\n vec2 y = getPixelCoordFromLocation(location + vec2(1.0, 0.0), cc_displacementTextureInfo.xy);\n vec2 z = getPixelCoordFromLocation(location + vec2(2.0, 0.0), cc_displacementTextureInfo.xy);\n return vec4(\n decode32(texture2D(tex, x)),\n decode32(texture2D(tex, y)),\n decode32(texture2D(tex, z)),\n 1.0\n );\n }\n #endif\n float getDisplacementWeight(int index) {\n int quot = index / 4;\n int remainder = index - quot * 4;\n if (remainder == 0) {\n return cc_displacementWeights[quot].x;\n } else if (remainder == 1) {\n return cc_displacementWeights[quot].y;\n } else if (remainder == 2) {\n return cc_displacementWeights[quot].z;\n } else {\n return cc_displacementWeights[quot].w;\n }\n }\n vec3 getVec3DisplacementFromTexture(sampler2D tex, int vertexIndex) {\n #if CC_MORPH_PRECOMPUTED\n return fetchVec3ArrayFromTexture(tex, vertexIndex).rgb;\n #else\n vec3 result = vec3(0, 0, 0);\n int nVertices = int(cc_displacementTextureInfo.z);\n for (int iTarget = 0; iTarget < CC_MORPH_TARGET_COUNT; ++iTarget) {\n result += (fetchVec3ArrayFromTexture(tex, nVertices * iTarget + vertexIndex).rgb * getDisplacementWeight(iTarget));\n }\n return result;\n #endif\n }\n #if CC_MORPH_TARGET_HAS_POSITION\n vec3 getPositionDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_PositionDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n vec3 getNormalDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_NormalDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n vec3 getTangentDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_TangentDisplacements, vertexId);\n }\n #endif\n void applyMorph (inout vec4 position, inout vec3 normal, inout vec4 tangent) {\n int vertexId = getVertexId();\n #if CC_MORPH_TARGET_HAS_POSITION\n position.xyz = position.xyz + getPositionDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n normal.xyz = normal.xyz + getNormalDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n tangent.xyz = tangent.xyz + getTangentDisplacement(vertexId);\n #endif\n }\n void applyMorph (inout vec4 position) {\n #if CC_MORPH_TARGET_HAS_POSITION\n position.xyz = position.xyz + getPositionDisplacement(getVertexId());\n #endif\n }\n#endif\n#if CC_USE_SKINNING\n #if CC_USE_BAKED_ANIMATION\n uniform highp vec4 cc_jointTextureInfo;\n uniform highp vec4 cc_jointAnimInfo;\n uniform highp sampler2D cc_jointTexture;\n void CCGetJointTextureCoords(float pixelsPerJoint, float jointIdx, out highp float x, out highp float y, out highp float invSize)\n {\n #if USE_INSTANCING\n highp float temp = pixelsPerJoint * (a_jointAnimInfo.x * a_jointAnimInfo.y + jointIdx) + a_jointAnimInfo.z;\n #else\n highp float temp = pixelsPerJoint * (cc_jointAnimInfo.x * cc_jointTextureInfo.y + jointIdx) + cc_jointTextureInfo.z;\n #endif\n invSize = cc_jointTextureInfo.w;\n highp float tempY = floor(temp * invSize);\n x = floor(temp - tempY * cc_jointTextureInfo.x);\n y = (tempY + 0.5) * invSize;\n }\n #else\n #if CC_USE_REAL_TIME_JOINT_TEXTURE\n uniform highp sampler2D cc_realtimeJoint;\n #else\n uniform highp vec4 cc_joints[CC_JOINT_UNIFORM_CAPACITY * 3];\n #endif\n #endif\n #if CC_USE_BAKED_ANIMATION\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n mat4 getJointMatrix (float i) {\n highp float x, y, invSize;\n CCGetJointTextureCoords(3.0, i, x, y, invSize);\n vec4 v1 = texture2D(cc_jointTexture, vec2((x + 0.5) * invSize, y));\n vec4 v2 = texture2D(cc_jointTexture, vec2((x + 1.5) * invSize, y));\n vec4 v3 = texture2D(cc_jointTexture, vec2((x + 2.5) * invSize, y));\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #else\n mat4 getJointMatrix (float i) {\n highp float x, y, invSize;\n CCGetJointTextureCoords(12.0, i, x, y, invSize);\n vec4 v1 = vec4(\n decode32(texture2D(cc_jointTexture, vec2((x + 0.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 1.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 2.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 3.5) * invSize, y)))\n );\n vec4 v2 = vec4(\n decode32(texture2D(cc_jointTexture, vec2((x + 4.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 5.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 6.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 7.5) * invSize, y)))\n );\n vec4 v3 = vec4(\n decode32(texture2D(cc_jointTexture, vec2((x + 8.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 9.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 10.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 11.5) * invSize, y)))\n );\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #else\n #if CC_USE_REAL_TIME_JOINT_TEXTURE\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n mat4 getJointMatrix (float i) {\n float x = i;\n vec4 v1 = texture2D(cc_realtimeJoint, vec2( x / 256.0, 0.5 / 3.0));\n vec4 v2 = texture2D(cc_realtimeJoint, vec2( x / 256.0, 1.5 / 3.0));\n vec4 v3 = texture2D(cc_realtimeJoint, vec2( x / 256.0, 2.5 / 3.0));\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #else\n mat4 getJointMatrix (float i) {\n float x = 4.0 * i;\n vec4 v1 = vec4(\n decode32(texture2D(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 0.5 / 3.0)))\n );\n vec4 v2 = vec4(\n decode32(texture2D(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 1.5 / 3.0)))\n );\n vec4 v3 = vec4(\n decode32(texture2D(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 2.5 / 3.0)))\n );\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #else\n mat4 getJointMatrix (float i) {\n int idx = int(i);\n vec4 v1 = cc_joints[idx * 3];\n vec4 v2 = cc_joints[idx * 3 + 1];\n vec4 v3 = cc_joints[idx * 3 + 2];\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #endif\n mat4 skinMatrix () {\n vec4 joints = vec4(a_joints);\n return getJointMatrix(joints.x) * a_weights.x\n + getJointMatrix(joints.y) * a_weights.y\n + getJointMatrix(joints.z) * a_weights.z\n + getJointMatrix(joints.w) * a_weights.w;\n }\n void CCSkin (inout vec4 position) {\n mat4 m = skinMatrix();\n position = m * position;\n }\n void CCSkin (inout vec4 position, inout vec3 normal, inout vec4 tangent) {\n mat4 m = skinMatrix();\n position = m * position;\n normal = (m * vec4(normal, 0.0)).xyz;\n tangent.xyz = (m * vec4(tangent.xyz, 0.0)).xyz;\n }\n#endif\nvoid CCVertInput(inout vec4 In)\n{\n In = vec4(a_position, 1.0);\n #if CC_USE_MORPH\n applyMorph(In);\n #endif\n #if CC_USE_SKINNING\n CCSkin(In);\n #endif\n}\nuniform highp mat4 cc_matView;\n uniform highp mat4 cc_matProj;\n uniform highp vec4 cc_cameraPos;\n uniform mediump vec4 cc_fogBase;\n uniform mediump vec4 cc_fogAdd;\n#if !USE_INSTANCING\n uniform highp mat4 cc_matWorld;\n#endif\nvoid CCGetWorldMatrix(out mat4 matWorld)\n{\n #if USE_INSTANCING\n matWorld = mat4(\n vec4(a_matWorld0.xyz, 0.0),\n vec4(a_matWorld1.xyz, 0.0),\n vec4(a_matWorld2.xyz, 0.0),\n vec4(a_matWorld0.w, a_matWorld1.w, a_matWorld2.w, 1.0)\n );\n #else\n matWorld = cc_matWorld;\n #endif\n}\n#if CC_USE_FOG != 4\n float LinearFog(vec4 pos, vec3 cameraPos, float fogStart, float fogEnd) {\n vec4 wPos = pos;\n float cam_dis = distance(cameraPos, wPos.xyz);\n return clamp((fogEnd - cam_dis) / (fogEnd - fogStart), 0., 1.);\n }\n float ExpFog(vec4 pos, vec3 cameraPos, float fogStart, float fogDensity, float fogAtten) {\n vec4 wPos = pos;\n float cam_dis = max(distance(cameraPos, wPos.xyz) - fogStart, 0.0) / fogAtten * 4.;\n float f = exp(-cam_dis * fogDensity);\n return f;\n }\n float ExpSquaredFog(vec4 pos, vec3 cameraPos, float fogStart, float fogDensity, float fogAtten) {\n vec4 wPos = pos;\n float cam_dis = max(distance(cameraPos, wPos.xyz) - fogStart, 0.0) / fogAtten * 4.;\n float f = exp(-cam_dis * cam_dis * fogDensity * fogDensity);\n return f;\n }\n float LayeredFog(vec4 pos, vec3 cameraPos, float fogTop, float fogRange, float fogAtten) {\n vec4 wPos = pos;\n vec3 camWorldProj = cameraPos.xyz;\n camWorldProj.y = 0.;\n vec3 worldPosProj = wPos.xyz;\n worldPosProj.y = 0.;\n float fDeltaD = distance(worldPosProj, camWorldProj) / fogAtten * 2.0;\n float fDeltaY, fDensityIntegral;\n if (cameraPos.y > fogTop) {\n if (wPos.y < fogTop) {\n fDeltaY = (fogTop - wPos.y) / fogRange * 2.0;\n fDensityIntegral = fDeltaY * fDeltaY * 0.5;\n }\n else {\n fDeltaY = 0.;\n fDensityIntegral = 0.;\n }\n }\n else {\n if (wPos.y < fogTop) {\n float fDeltaA = (fogTop - cameraPos.y) / fogRange * 2.;\n float fDeltaB = (fogTop - wPos.y) / fogRange * 2.;\n fDeltaY = abs(fDeltaA - fDeltaB);\n fDensityIntegral = abs((fDeltaA * fDeltaA * 0.5) - (fDeltaB * fDeltaB * 0.5));\n }\n else {\n fDeltaY = abs(fogTop - cameraPos.y) / fogRange * 2.;\n fDensityIntegral = abs(fDeltaY * fDeltaY * 0.5);\n }\n }\n float fDensity;\n if (fDeltaY != 0.) {\n fDensity = (sqrt(1.0 + ((fDeltaD / fDeltaY) * (fDeltaD / fDeltaY)))) * fDensityIntegral;\n }\n else {\n fDensity = 0.;\n }\n float f = exp(-fDensity);\n return f;\n }\n#endif\nvoid CC_TRANSFER_FOG_BASE(vec4 pos, out float factor)\n{\n#if CC_USE_FOG == 0\n\tfactor = LinearFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.y);\n#elif CC_USE_FOG == 1\n\tfactor = ExpFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.z, cc_fogAdd.z);\n#elif CC_USE_FOG == 2\n\tfactor = ExpSquaredFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.z, cc_fogAdd.z);\n#elif CC_USE_FOG == 3\n\tfactor = LayeredFog(pos, cc_cameraPos.xyz, cc_fogAdd.x, cc_fogAdd.y, cc_fogAdd.z);\n#else\n\tfactor = 1.0;\n#endif\n}\n#if !CC_USE_ACCURATE_FOG\nvarying mediump float v_fog_factor;\n#endif\nvoid CC_TRANSFER_FOG(vec4 pos) {\n#if !CC_USE_ACCURATE_FOG\n CC_TRANSFER_FOG_BASE(pos, v_fog_factor);\n#endif\n}\n#if USE_VERTEX_COLOR\n attribute lowp vec4 a_color;\n varying lowp vec4 v_color;\n#endif\n#if USE_TEXTURE\n varying vec2 v_uv;\n uniform vec4 tilingOffset;\n#endif\nvec4 vert () {\n vec4 position;\n CCVertInput(position);\n mat4 matWorld;\n CCGetWorldMatrix(matWorld);\n #if USE_TEXTURE\n v_uv = a_texCoord * tilingOffset.xy + tilingOffset.zw;\n #if SAMPLE_FROM_RT\n v_uv = cc_cameraPos.w > 1.0 ? vec2(v_uv.x, 1.0 - v_uv.y) : v_uv;\n #endif\n #endif\n #if USE_VERTEX_COLOR\n v_color = a_color;\n #endif\n CC_TRANSFER_FOG(matWorld * position);\n return cc_matProj * (cc_matView * matWorld) * position;\n}\nvoid main() { gl_Position = vert(); }",
  761. "frag": "\nprecision highp float;\nvec3 ACESToneMap (vec3 color) {\n color = min(color, vec3(8.0));\n const float A = 2.51;\n const float B = 0.03;\n const float C = 2.43;\n const float D = 0.59;\n const float E = 0.14;\n return (color * (A * color + B)) / (color * (C * color + D) + E);\n}\nvec3 SRGBToLinear (vec3 gamma) {\n#ifdef CC_USE_SURFACE_SHADER\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC && CC_SURFACES_ENABLE_DEBUG_VIEW\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_GAMMA_CORRECTION) {\n return gamma;\n }\n #endif\n#endif\n return gamma * gamma;\n}\nvec3 LinearToSRGB(vec3 linear) {\n#ifdef CC_USE_SURFACE_SHADER\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC && CC_SURFACES_ENABLE_DEBUG_VIEW\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_GAMMA_CORRECTION) {\n return linear;\n }\n #endif\n#endif\n return sqrt(linear);\n}\nvec4 packRGBE (vec3 rgb) {\n highp float maxComp = max(max(rgb.r, rgb.g), rgb.b);\n highp float e = 128.0;\n if (maxComp > 0.0001) {\n e = log(maxComp) / log(1.1);\n e = ceil(e);\n e = clamp(e + 128.0, 0.0, 255.0);\n }\n highp float sc = 1.0 / pow(1.1, e - 128.0);\n vec3 encode = clamp(rgb * sc, vec3(0.0), vec3(1.0)) * 255.0;\n vec3 encode_rounded = floor(encode) + step(encode - floor(encode), vec3(0.5));\n return vec4(encode_rounded, e) / 255.0;\n}\nvec4 CCFragOutput (vec4 color) {\n #if CC_USE_RGBE_OUTPUT\n color = packRGBE(color.rgb);\n #elif !CC_USE_FLOAT_OUTPUT\n #if CC_USE_HDR && CC_TONE_MAPPING_TYPE == HDR_TONE_MAPPING_ACES\n color.rgb = ACESToneMap(color.rgb);\n #endif\n color.rgb = LinearToSRGB(color.rgb);\n #endif\n return color;\n}\nuniform highp vec4 cc_cameraPos;\n uniform mediump vec4 cc_fogColor;\n uniform mediump vec4 cc_fogBase;\n uniform mediump vec4 cc_fogAdd;\n#if CC_USE_FOG != 4\n float LinearFog(vec4 pos, vec3 cameraPos, float fogStart, float fogEnd) {\n vec4 wPos = pos;\n float cam_dis = distance(cameraPos, wPos.xyz);\n return clamp((fogEnd - cam_dis) / (fogEnd - fogStart), 0., 1.);\n }\n float ExpFog(vec4 pos, vec3 cameraPos, float fogStart, float fogDensity, float fogAtten) {\n vec4 wPos = pos;\n float cam_dis = max(distance(cameraPos, wPos.xyz) - fogStart, 0.0) / fogAtten * 4.;\n float f = exp(-cam_dis * fogDensity);\n return f;\n }\n float ExpSquaredFog(vec4 pos, vec3 cameraPos, float fogStart, float fogDensity, float fogAtten) {\n vec4 wPos = pos;\n float cam_dis = max(distance(cameraPos, wPos.xyz) - fogStart, 0.0) / fogAtten * 4.;\n float f = exp(-cam_dis * cam_dis * fogDensity * fogDensity);\n return f;\n }\n float LayeredFog(vec4 pos, vec3 cameraPos, float fogTop, float fogRange, float fogAtten) {\n vec4 wPos = pos;\n vec3 camWorldProj = cameraPos.xyz;\n camWorldProj.y = 0.;\n vec3 worldPosProj = wPos.xyz;\n worldPosProj.y = 0.;\n float fDeltaD = distance(worldPosProj, camWorldProj) / fogAtten * 2.0;\n float fDeltaY, fDensityIntegral;\n if (cameraPos.y > fogTop) {\n if (wPos.y < fogTop) {\n fDeltaY = (fogTop - wPos.y) / fogRange * 2.0;\n fDensityIntegral = fDeltaY * fDeltaY * 0.5;\n }\n else {\n fDeltaY = 0.;\n fDensityIntegral = 0.;\n }\n }\n else {\n if (wPos.y < fogTop) {\n float fDeltaA = (fogTop - cameraPos.y) / fogRange * 2.;\n float fDeltaB = (fogTop - wPos.y) / fogRange * 2.;\n fDeltaY = abs(fDeltaA - fDeltaB);\n fDensityIntegral = abs((fDeltaA * fDeltaA * 0.5) - (fDeltaB * fDeltaB * 0.5));\n }\n else {\n fDeltaY = abs(fogTop - cameraPos.y) / fogRange * 2.;\n fDensityIntegral = abs(fDeltaY * fDeltaY * 0.5);\n }\n }\n float fDensity;\n if (fDeltaY != 0.) {\n fDensity = (sqrt(1.0 + ((fDeltaD / fDeltaY) * (fDeltaD / fDeltaY)))) * fDensityIntegral;\n }\n else {\n fDensity = 0.;\n }\n float f = exp(-fDensity);\n return f;\n }\n#endif\nvoid CC_TRANSFER_FOG_BASE(vec4 pos, out float factor)\n{\n#if CC_USE_FOG == 0\n\tfactor = LinearFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.y);\n#elif CC_USE_FOG == 1\n\tfactor = ExpFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.z, cc_fogAdd.z);\n#elif CC_USE_FOG == 2\n\tfactor = ExpSquaredFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.z, cc_fogAdd.z);\n#elif CC_USE_FOG == 3\n\tfactor = LayeredFog(pos, cc_cameraPos.xyz, cc_fogAdd.x, cc_fogAdd.y, cc_fogAdd.z);\n#else\n\tfactor = 1.0;\n#endif\n}\nvoid CC_APPLY_FOG_BASE(inout vec4 color, float factor) {\n\tcolor = vec4(mix(cc_fogColor.rgb, color.rgb, factor), color.a);\n}\n#if !CC_USE_ACCURATE_FOG\nvarying mediump float v_fog_factor;\n#endif\nvoid CC_APPLY_FOG(inout vec4 color) {\n#if !CC_USE_ACCURATE_FOG\n CC_APPLY_FOG_BASE(color, v_fog_factor);\n#endif\n}\nvoid CC_APPLY_FOG(inout vec4 color, vec3 worldPos) {\n#if CC_USE_ACCURATE_FOG\n float factor;\n CC_TRANSFER_FOG_BASE(vec4(worldPos, 1.0), factor);\n#else\n float factor = v_fog_factor;\n#endif\n CC_APPLY_FOG_BASE(color, factor);\n}\n#if USE_ALPHA_TEST\n#endif\n#if USE_TEXTURE\n varying vec2 v_uv;\n uniform sampler2D mainTexture;\n#endif\n uniform vec4 mainColor;\n uniform vec4 colorScaleAndCutoff;\n#if USE_VERTEX_COLOR\n varying lowp vec4 v_color;\n#endif\nvec4 frag () {\n vec4 o = mainColor;\n o.rgb *= colorScaleAndCutoff.xyz;\n #if USE_VERTEX_COLOR\n o.rgb *= SRGBToLinear(v_color.rgb);\n o.a *= v_color.a;\n #endif\n #if USE_TEXTURE\n vec4 texColor = texture2D(mainTexture, v_uv);\n texColor.rgb = SRGBToLinear(texColor.rgb);\n o *= texColor;\n #endif\n #if USE_ALPHA_TEST\n if (o.ALPHA_TEST_CHANNEL < colorScaleAndCutoff.w) discard;\n #endif\n CC_APPLY_FOG(o);\n return CCFragOutput(o);\n}\nvoid main() { gl_FragColor = frag(); }"
  762. },
  763. "builtins": {
  764. "globals": {
  765. "blocks": [
  766. {
  767. "name": "CCGlobal",
  768. "defines": []
  769. },
  770. {
  771. "name": "CCCamera",
  772. "defines": []
  773. }
  774. ],
  775. "samplerTextures": [],
  776. "buffers": [],
  777. "images": []
  778. },
  779. "locals": {
  780. "blocks": [
  781. {
  782. "name": "CCMorph",
  783. "defines": [
  784. "CC_USE_MORPH"
  785. ]
  786. },
  787. {
  788. "name": "CCSkinningTexture",
  789. "defines": [
  790. "CC_USE_SKINNING",
  791. "CC_USE_BAKED_ANIMATION"
  792. ]
  793. },
  794. {
  795. "name": "CCSkinningAnimation",
  796. "defines": [
  797. "CC_USE_SKINNING",
  798. "CC_USE_BAKED_ANIMATION"
  799. ]
  800. },
  801. {
  802. "name": "CCSkinning",
  803. "defines": [
  804. "CC_USE_SKINNING",
  805. "!CC_USE_BAKED_ANIMATION",
  806. "!CC_USE_REAL_TIME_JOINT_TEXTURE"
  807. ]
  808. },
  809. {
  810. "name": "CCLocal",
  811. "defines": [
  812. "!USE_INSTANCING"
  813. ]
  814. }
  815. ],
  816. "samplerTextures": [
  817. {
  818. "name": "cc_PositionDisplacements",
  819. "defines": [
  820. "CC_USE_MORPH",
  821. "CC_MORPH_TARGET_HAS_POSITION"
  822. ]
  823. },
  824. {
  825. "name": "cc_NormalDisplacements",
  826. "defines": [
  827. "CC_USE_MORPH",
  828. "CC_MORPH_TARGET_HAS_NORMAL"
  829. ]
  830. },
  831. {
  832. "name": "cc_TangentDisplacements",
  833. "defines": [
  834. "CC_USE_MORPH",
  835. "CC_MORPH_TARGET_HAS_TANGENT"
  836. ]
  837. },
  838. {
  839. "name": "cc_jointTexture",
  840. "defines": [
  841. "CC_USE_SKINNING",
  842. "CC_USE_BAKED_ANIMATION"
  843. ]
  844. },
  845. {
  846. "name": "cc_realtimeJoint",
  847. "defines": [
  848. "CC_USE_SKINNING",
  849. "!CC_USE_BAKED_ANIMATION",
  850. "CC_USE_REAL_TIME_JOINT_TEXTURE"
  851. ]
  852. }
  853. ],
  854. "buffers": [],
  855. "images": []
  856. },
  857. "statistics": {
  858. "CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS": 75,
  859. "CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS": 44
  860. }
  861. },
  862. "defines": [
  863. {
  864. "name": "USE_INSTANCING",
  865. "type": "boolean"
  866. },
  867. {
  868. "name": "CC_USE_SKINNING",
  869. "type": "boolean"
  870. },
  871. {
  872. "name": "CC_USE_BAKED_ANIMATION",
  873. "type": "boolean"
  874. },
  875. {
  876. "name": "CC_USE_LIGHTMAP",
  877. "type": "boolean"
  878. },
  879. {
  880. "name": "CC_USE_REFLECTION_PROBE",
  881. "type": "boolean"
  882. },
  883. {
  884. "name": "CC_RECEIVE_SHADOW",
  885. "type": "boolean"
  886. },
  887. {
  888. "name": "CC_USE_LIGHT_PROBE",
  889. "type": "boolean"
  890. },
  891. {
  892. "name": "CC_USE_MORPH",
  893. "type": "boolean"
  894. },
  895. {
  896. "name": "CC_MORPH_TARGET_COUNT",
  897. "type": "number",
  898. "range": [
  899. 2,
  900. 8
  901. ]
  902. },
  903. {
  904. "name": "CC_MORPH_TARGET_HAS_POSITION",
  905. "type": "boolean"
  906. },
  907. {
  908. "name": "CC_MORPH_TARGET_HAS_NORMAL",
  909. "type": "boolean"
  910. },
  911. {
  912. "name": "CC_MORPH_TARGET_HAS_TANGENT",
  913. "type": "boolean"
  914. },
  915. {
  916. "name": "CC_MORPH_PRECOMPUTED",
  917. "type": "boolean"
  918. },
  919. {
  920. "name": "CC_USE_REAL_TIME_JOINT_TEXTURE",
  921. "type": "boolean"
  922. },
  923. {
  924. "name": "CC_USE_FOG",
  925. "type": "number",
  926. "range": [
  927. 0,
  928. 4
  929. ]
  930. },
  931. {
  932. "name": "CC_USE_ACCURATE_FOG",
  933. "type": "boolean"
  934. },
  935. {
  936. "name": "USE_VERTEX_COLOR",
  937. "type": "boolean"
  938. },
  939. {
  940. "name": "USE_TEXTURE",
  941. "type": "boolean"
  942. },
  943. {
  944. "name": "SAMPLE_FROM_RT",
  945. "type": "boolean"
  946. },
  947. {
  948. "name": "CC_USE_DEBUG_VIEW",
  949. "type": "number",
  950. "range": [
  951. 0,
  952. 3
  953. ]
  954. },
  955. {
  956. "name": "CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC",
  957. "type": "boolean"
  958. },
  959. {
  960. "name": "CC_SURFACES_ENABLE_DEBUG_VIEW",
  961. "type": "boolean"
  962. },
  963. {
  964. "name": "CC_USE_RGBE_OUTPUT",
  965. "type": "boolean"
  966. },
  967. {
  968. "name": "CC_USE_FLOAT_OUTPUT",
  969. "type": "boolean"
  970. },
  971. {
  972. "name": "CC_USE_HDR",
  973. "type": "boolean"
  974. },
  975. {
  976. "name": "CC_TONE_MAPPING_TYPE",
  977. "type": "number",
  978. "range": [
  979. 0,
  980. 3
  981. ]
  982. },
  983. {
  984. "name": "HDR_TONE_MAPPING_ACES",
  985. "type": "boolean"
  986. },
  987. {
  988. "name": "USE_ALPHA_TEST",
  989. "type": "boolean"
  990. },
  991. {
  992. "name": "ALPHA_TEST_CHANNEL",
  993. "type": "string",
  994. "options": [
  995. "a",
  996. "r",
  997. "g",
  998. "b"
  999. ]
  1000. }
  1001. ]
  1002. },
  1003. {
  1004. "hash": 3680218420,
  1005. "name": "builtin-unlit|planar-shadow-vs:vert|planar-shadow-fs:frag",
  1006. "blocks": [],
  1007. "samplerTextures": [],
  1008. "samplers": [],
  1009. "textures": [],
  1010. "buffers": [],
  1011. "images": [],
  1012. "subpassInputs": [],
  1013. "attributes": [
  1014. {
  1015. "name": "a_position",
  1016. "format": 32,
  1017. "location": 0,
  1018. "defines": []
  1019. },
  1020. {
  1021. "name": "a_normal",
  1022. "format": 32,
  1023. "location": 1,
  1024. "defines": []
  1025. },
  1026. {
  1027. "name": "a_texCoord",
  1028. "format": 21,
  1029. "location": 2,
  1030. "defines": []
  1031. },
  1032. {
  1033. "name": "a_tangent",
  1034. "format": 44,
  1035. "location": 3,
  1036. "defines": []
  1037. },
  1038. {
  1039. "name": "a_joints",
  1040. "location": 4,
  1041. "defines": [
  1042. "CC_USE_SKINNING"
  1043. ]
  1044. },
  1045. {
  1046. "name": "a_weights",
  1047. "format": 44,
  1048. "location": 5,
  1049. "defines": [
  1050. "CC_USE_SKINNING"
  1051. ]
  1052. },
  1053. {
  1054. "name": "a_jointAnimInfo",
  1055. "format": 44,
  1056. "isInstanced": true,
  1057. "location": 6,
  1058. "defines": [
  1059. "USE_INSTANCING",
  1060. "CC_USE_BAKED_ANIMATION"
  1061. ]
  1062. },
  1063. {
  1064. "name": "a_matWorld0",
  1065. "format": 44,
  1066. "isInstanced": true,
  1067. "location": 7,
  1068. "defines": [
  1069. "USE_INSTANCING"
  1070. ]
  1071. },
  1072. {
  1073. "name": "a_matWorld1",
  1074. "format": 44,
  1075. "isInstanced": true,
  1076. "location": 8,
  1077. "defines": [
  1078. "USE_INSTANCING"
  1079. ]
  1080. },
  1081. {
  1082. "name": "a_matWorld2",
  1083. "format": 44,
  1084. "isInstanced": true,
  1085. "location": 9,
  1086. "defines": [
  1087. "USE_INSTANCING"
  1088. ]
  1089. },
  1090. {
  1091. "name": "a_lightingMapUVParam",
  1092. "format": 44,
  1093. "isInstanced": true,
  1094. "location": 10,
  1095. "defines": [
  1096. "USE_INSTANCING",
  1097. "CC_USE_LIGHTMAP"
  1098. ]
  1099. },
  1100. {
  1101. "name": "a_localShadowBiasAndProbeId",
  1102. "format": 44,
  1103. "isInstanced": true,
  1104. "location": 11,
  1105. "defines": [
  1106. "USE_INSTANCING"
  1107. ]
  1108. },
  1109. {
  1110. "name": "a_reflectionProbeData",
  1111. "format": 44,
  1112. "isInstanced": true,
  1113. "location": 12,
  1114. "defines": [
  1115. "USE_INSTANCING",
  1116. "CC_USE_REFLECTION_PROBE"
  1117. ]
  1118. },
  1119. {
  1120. "name": "a_sh_linear_const_r",
  1121. "format": 44,
  1122. "isInstanced": true,
  1123. "location": 13,
  1124. "defines": [
  1125. "USE_INSTANCING",
  1126. "CC_USE_LIGHT_PROBE"
  1127. ]
  1128. },
  1129. {
  1130. "name": "a_sh_linear_const_g",
  1131. "format": 44,
  1132. "isInstanced": true,
  1133. "location": 14,
  1134. "defines": [
  1135. "USE_INSTANCING",
  1136. "CC_USE_LIGHT_PROBE"
  1137. ]
  1138. },
  1139. {
  1140. "name": "a_sh_linear_const_b",
  1141. "format": 44,
  1142. "isInstanced": true,
  1143. "location": 15,
  1144. "defines": [
  1145. "USE_INSTANCING",
  1146. "CC_USE_LIGHT_PROBE"
  1147. ]
  1148. },
  1149. {
  1150. "name": "a_vertexId",
  1151. "format": 11,
  1152. "location": 16,
  1153. "defines": [
  1154. "CC_USE_MORPH"
  1155. ]
  1156. }
  1157. ],
  1158. "fragColors": [
  1159. {
  1160. "name": "cc_FragColor",
  1161. "typename": "vec4",
  1162. "type": 16,
  1163. "count": 1,
  1164. "stageFlags": 16,
  1165. "location": 0,
  1166. "defines": []
  1167. }
  1168. ],
  1169. "descriptors": [
  1170. {
  1171. "rate": 0,
  1172. "blocks": [
  1173. {
  1174. "name": "CCMorph",
  1175. "stageFlags": 1,
  1176. "tags": {
  1177. "builtin": "local"
  1178. },
  1179. "members": [
  1180. {
  1181. "name": "cc_displacementWeights",
  1182. "typename": "vec4",
  1183. "type": 16,
  1184. "count": 15,
  1185. "isArray": true
  1186. },
  1187. {
  1188. "name": "cc_displacementTextureInfo",
  1189. "typename": "vec4",
  1190. "type": 16,
  1191. "count": 1
  1192. }
  1193. ],
  1194. "defines": [
  1195. "CC_USE_MORPH"
  1196. ]
  1197. },
  1198. {
  1199. "name": "CCSkinningTexture",
  1200. "stageFlags": 1,
  1201. "tags": {
  1202. "builtin": "local"
  1203. },
  1204. "members": [
  1205. {
  1206. "name": "cc_jointTextureInfo",
  1207. "typename": "vec4",
  1208. "type": 16,
  1209. "count": 1,
  1210. "precision": "highp "
  1211. }
  1212. ],
  1213. "defines": [
  1214. "CC_USE_SKINNING",
  1215. "CC_USE_BAKED_ANIMATION"
  1216. ]
  1217. },
  1218. {
  1219. "name": "CCSkinningAnimation",
  1220. "stageFlags": 1,
  1221. "tags": {
  1222. "builtin": "local"
  1223. },
  1224. "members": [
  1225. {
  1226. "name": "cc_jointAnimInfo",
  1227. "typename": "vec4",
  1228. "type": 16,
  1229. "count": 1,
  1230. "precision": "highp "
  1231. }
  1232. ],
  1233. "defines": [
  1234. "CC_USE_SKINNING",
  1235. "CC_USE_BAKED_ANIMATION"
  1236. ]
  1237. },
  1238. {
  1239. "name": "CCSkinning",
  1240. "stageFlags": 1,
  1241. "tags": {
  1242. "builtin": "local"
  1243. },
  1244. "members": [
  1245. {
  1246. "name": "cc_joints",
  1247. "typename": "vec4",
  1248. "type": 16,
  1249. "count": 0,
  1250. "precision": "highp ",
  1251. "isArray": true
  1252. }
  1253. ],
  1254. "defines": [
  1255. "CC_USE_SKINNING",
  1256. "!CC_USE_BAKED_ANIMATION",
  1257. "!CC_USE_REAL_TIME_JOINT_TEXTURE"
  1258. ]
  1259. },
  1260. {
  1261. "name": "CCLocal",
  1262. "stageFlags": 1,
  1263. "tags": {
  1264. "builtin": "local"
  1265. },
  1266. "members": [
  1267. {
  1268. "name": "cc_matWorld",
  1269. "typename": "mat4",
  1270. "type": 25,
  1271. "count": 1,
  1272. "precision": "highp "
  1273. },
  1274. {
  1275. "name": "cc_matWorldIT",
  1276. "typename": "mat4",
  1277. "type": 25,
  1278. "count": 1,
  1279. "precision": "highp "
  1280. },
  1281. {
  1282. "name": "cc_lightingMapUVParam",
  1283. "typename": "vec4",
  1284. "type": 16,
  1285. "count": 1,
  1286. "precision": "highp "
  1287. },
  1288. {
  1289. "name": "cc_localShadowBias",
  1290. "typename": "vec4",
  1291. "type": 16,
  1292. "count": 1,
  1293. "precision": "highp "
  1294. },
  1295. {
  1296. "name": "cc_reflectionProbeData1",
  1297. "typename": "vec4",
  1298. "type": 16,
  1299. "count": 1,
  1300. "precision": "highp "
  1301. },
  1302. {
  1303. "name": "cc_reflectionProbeData2",
  1304. "typename": "vec4",
  1305. "type": 16,
  1306. "count": 1,
  1307. "precision": "highp "
  1308. },
  1309. {
  1310. "name": "cc_reflectionProbeBlendData1",
  1311. "typename": "vec4",
  1312. "type": 16,
  1313. "count": 1,
  1314. "precision": "highp "
  1315. },
  1316. {
  1317. "name": "cc_reflectionProbeBlendData2",
  1318. "typename": "vec4",
  1319. "type": 16,
  1320. "count": 1,
  1321. "precision": "highp "
  1322. }
  1323. ],
  1324. "defines": [
  1325. "!USE_INSTANCING"
  1326. ]
  1327. }
  1328. ],
  1329. "samplerTextures": [
  1330. {
  1331. "name": "cc_PositionDisplacements",
  1332. "typename": "sampler2D",
  1333. "type": 28,
  1334. "count": 1,
  1335. "stageFlags": 1,
  1336. "tags": {
  1337. "builtin": "local"
  1338. },
  1339. "defines": [
  1340. "CC_USE_MORPH",
  1341. "CC_MORPH_TARGET_HAS_POSITION"
  1342. ]
  1343. },
  1344. {
  1345. "name": "cc_NormalDisplacements",
  1346. "typename": "sampler2D",
  1347. "type": 28,
  1348. "count": 1,
  1349. "stageFlags": 1,
  1350. "tags": {
  1351. "builtin": "local"
  1352. },
  1353. "defines": [
  1354. "CC_USE_MORPH",
  1355. "CC_MORPH_TARGET_HAS_NORMAL"
  1356. ]
  1357. },
  1358. {
  1359. "name": "cc_TangentDisplacements",
  1360. "typename": "sampler2D",
  1361. "type": 28,
  1362. "count": 1,
  1363. "stageFlags": 1,
  1364. "tags": {
  1365. "builtin": "local"
  1366. },
  1367. "defines": [
  1368. "CC_USE_MORPH",
  1369. "CC_MORPH_TARGET_HAS_TANGENT"
  1370. ]
  1371. },
  1372. {
  1373. "name": "cc_jointTexture",
  1374. "typename": "sampler2D",
  1375. "type": 28,
  1376. "count": 1,
  1377. "precision": "highp ",
  1378. "stageFlags": 1,
  1379. "tags": {
  1380. "builtin": "local"
  1381. },
  1382. "defines": [
  1383. "CC_USE_SKINNING",
  1384. "CC_USE_BAKED_ANIMATION"
  1385. ]
  1386. },
  1387. {
  1388. "name": "cc_realtimeJoint",
  1389. "typename": "sampler2D",
  1390. "type": 28,
  1391. "count": 1,
  1392. "precision": "highp ",
  1393. "stageFlags": 1,
  1394. "tags": {
  1395. "builtin": "local"
  1396. },
  1397. "defines": [
  1398. "CC_USE_SKINNING",
  1399. "!CC_USE_BAKED_ANIMATION",
  1400. "CC_USE_REAL_TIME_JOINT_TEXTURE"
  1401. ]
  1402. }
  1403. ],
  1404. "samplers": [],
  1405. "textures": [],
  1406. "buffers": [],
  1407. "images": [],
  1408. "subpassInputs": []
  1409. },
  1410. {
  1411. "rate": 1,
  1412. "blocks": [],
  1413. "samplerTextures": [],
  1414. "samplers": [],
  1415. "textures": [],
  1416. "buffers": [],
  1417. "images": [],
  1418. "subpassInputs": []
  1419. },
  1420. {
  1421. "rate": 2,
  1422. "blocks": [],
  1423. "samplerTextures": [],
  1424. "samplers": [],
  1425. "textures": [],
  1426. "buffers": [],
  1427. "images": [],
  1428. "subpassInputs": []
  1429. },
  1430. {
  1431. "rate": 3,
  1432. "blocks": [
  1433. {
  1434. "name": "CCGlobal",
  1435. "stageFlags": 17,
  1436. "tags": {
  1437. "builtin": "global"
  1438. },
  1439. "members": [
  1440. {
  1441. "name": "cc_time",
  1442. "typename": "vec4",
  1443. "type": 16,
  1444. "count": 1,
  1445. "precision": "highp "
  1446. },
  1447. {
  1448. "name": "cc_screenSize",
  1449. "typename": "vec4",
  1450. "type": 16,
  1451. "count": 1,
  1452. "precision": "mediump "
  1453. },
  1454. {
  1455. "name": "cc_nativeSize",
  1456. "typename": "vec4",
  1457. "type": 16,
  1458. "count": 1,
  1459. "precision": "mediump "
  1460. },
  1461. {
  1462. "name": "cc_probeInfo",
  1463. "typename": "vec4",
  1464. "type": 16,
  1465. "count": 1,
  1466. "precision": "mediump "
  1467. },
  1468. {
  1469. "name": "cc_debug_view_mode",
  1470. "typename": "vec4",
  1471. "type": 16,
  1472. "count": 1,
  1473. "precision": "mediump "
  1474. }
  1475. ],
  1476. "defines": []
  1477. },
  1478. {
  1479. "name": "CCCamera",
  1480. "stageFlags": 17,
  1481. "tags": {
  1482. "builtin": "global"
  1483. },
  1484. "members": [
  1485. {
  1486. "name": "cc_matView",
  1487. "typename": "mat4",
  1488. "type": 25,
  1489. "count": 1,
  1490. "precision": "highp "
  1491. },
  1492. {
  1493. "name": "cc_matViewInv",
  1494. "typename": "mat4",
  1495. "type": 25,
  1496. "count": 1,
  1497. "precision": "highp "
  1498. },
  1499. {
  1500. "name": "cc_matProj",
  1501. "typename": "mat4",
  1502. "type": 25,
  1503. "count": 1,
  1504. "precision": "highp "
  1505. },
  1506. {
  1507. "name": "cc_matProjInv",
  1508. "typename": "mat4",
  1509. "type": 25,
  1510. "count": 1,
  1511. "precision": "highp "
  1512. },
  1513. {
  1514. "name": "cc_matViewProj",
  1515. "typename": "mat4",
  1516. "type": 25,
  1517. "count": 1,
  1518. "precision": "highp "
  1519. },
  1520. {
  1521. "name": "cc_matViewProjInv",
  1522. "typename": "mat4",
  1523. "type": 25,
  1524. "count": 1,
  1525. "precision": "highp "
  1526. },
  1527. {
  1528. "name": "cc_cameraPos",
  1529. "typename": "vec4",
  1530. "type": 16,
  1531. "count": 1,
  1532. "precision": "highp "
  1533. },
  1534. {
  1535. "name": "cc_surfaceTransform",
  1536. "typename": "vec4",
  1537. "type": 16,
  1538. "count": 1,
  1539. "precision": "mediump "
  1540. },
  1541. {
  1542. "name": "cc_screenScale",
  1543. "typename": "vec4",
  1544. "type": 16,
  1545. "count": 1,
  1546. "precision": "mediump "
  1547. },
  1548. {
  1549. "name": "cc_exposure",
  1550. "typename": "vec4",
  1551. "type": 16,
  1552. "count": 1,
  1553. "precision": "mediump "
  1554. },
  1555. {
  1556. "name": "cc_mainLitDir",
  1557. "typename": "vec4",
  1558. "type": 16,
  1559. "count": 1,
  1560. "precision": "mediump "
  1561. },
  1562. {
  1563. "name": "cc_mainLitColor",
  1564. "typename": "vec4",
  1565. "type": 16,
  1566. "count": 1,
  1567. "precision": "mediump "
  1568. },
  1569. {
  1570. "name": "cc_ambientSky",
  1571. "typename": "vec4",
  1572. "type": 16,
  1573. "count": 1,
  1574. "precision": "mediump "
  1575. },
  1576. {
  1577. "name": "cc_ambientGround",
  1578. "typename": "vec4",
  1579. "type": 16,
  1580. "count": 1,
  1581. "precision": "mediump "
  1582. },
  1583. {
  1584. "name": "cc_fogColor",
  1585. "typename": "vec4",
  1586. "type": 16,
  1587. "count": 1,
  1588. "precision": "mediump "
  1589. },
  1590. {
  1591. "name": "cc_fogBase",
  1592. "typename": "vec4",
  1593. "type": 16,
  1594. "count": 1,
  1595. "precision": "mediump "
  1596. },
  1597. {
  1598. "name": "cc_fogAdd",
  1599. "typename": "vec4",
  1600. "type": 16,
  1601. "count": 1,
  1602. "precision": "mediump "
  1603. },
  1604. {
  1605. "name": "cc_nearFar",
  1606. "typename": "vec4",
  1607. "type": 16,
  1608. "count": 1,
  1609. "precision": "mediump "
  1610. },
  1611. {
  1612. "name": "cc_viewPort",
  1613. "typename": "vec4",
  1614. "type": 16,
  1615. "count": 1,
  1616. "precision": "mediump "
  1617. }
  1618. ],
  1619. "defines": []
  1620. },
  1621. {
  1622. "name": "CCShadow",
  1623. "stageFlags": 17,
  1624. "tags": {
  1625. "builtin": "global"
  1626. },
  1627. "members": [
  1628. {
  1629. "name": "cc_matLightView",
  1630. "typename": "mat4",
  1631. "type": 25,
  1632. "count": 1,
  1633. "precision": "highp "
  1634. },
  1635. {
  1636. "name": "cc_matLightViewProj",
  1637. "typename": "mat4",
  1638. "type": 25,
  1639. "count": 1,
  1640. "precision": "highp "
  1641. },
  1642. {
  1643. "name": "cc_shadowInvProjDepthInfo",
  1644. "typename": "vec4",
  1645. "type": 16,
  1646. "count": 1,
  1647. "precision": "highp "
  1648. },
  1649. {
  1650. "name": "cc_shadowProjDepthInfo",
  1651. "typename": "vec4",
  1652. "type": 16,
  1653. "count": 1,
  1654. "precision": "highp "
  1655. },
  1656. {
  1657. "name": "cc_shadowProjInfo",
  1658. "typename": "vec4",
  1659. "type": 16,
  1660. "count": 1,
  1661. "precision": "highp "
  1662. },
  1663. {
  1664. "name": "cc_shadowNFLSInfo",
  1665. "typename": "vec4",
  1666. "type": 16,
  1667. "count": 1,
  1668. "precision": "mediump "
  1669. },
  1670. {
  1671. "name": "cc_shadowWHPBInfo",
  1672. "typename": "vec4",
  1673. "type": 16,
  1674. "count": 1,
  1675. "precision": "mediump "
  1676. },
  1677. {
  1678. "name": "cc_shadowLPNNInfo",
  1679. "typename": "vec4",
  1680. "type": 16,
  1681. "count": 1,
  1682. "precision": "mediump "
  1683. },
  1684. {
  1685. "name": "cc_shadowColor",
  1686. "typename": "vec4",
  1687. "type": 16,
  1688. "count": 1,
  1689. "precision": "lowp "
  1690. },
  1691. {
  1692. "name": "cc_planarNDInfo",
  1693. "typename": "vec4",
  1694. "type": 16,
  1695. "count": 1,
  1696. "precision": "mediump "
  1697. }
  1698. ],
  1699. "defines": []
  1700. }
  1701. ],
  1702. "samplerTextures": [],
  1703. "samplers": [],
  1704. "textures": [],
  1705. "buffers": [],
  1706. "images": [],
  1707. "subpassInputs": []
  1708. }
  1709. ],
  1710. "glsl3": {
  1711. "vert": "\nprecision highp float;\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\nfloat saturate(float value) { return clamp(value, 0.0, 1.0); }\nvec2 saturate(vec2 value) { return clamp(value, vec2(0.0), vec2(1.0)); }\nvec3 saturate(vec3 value) { return clamp(value, vec3(0.0), vec3(1.0)); }\nvec4 saturate(vec4 value) { return clamp(value, vec4(0.0), vec4(1.0)); }\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\nstruct StandardVertInput {\n highp vec4 position;\n vec3 normal;\n vec4 tangent;\n};\nin vec3 a_position;\nin vec3 a_normal;\nin vec2 a_texCoord;\nin vec4 a_tangent;\n#if CC_USE_SKINNING\n in vec4 a_joints;\n in vec4 a_weights;\n#endif\n#if USE_INSTANCING\n #if CC_USE_BAKED_ANIMATION\n in highp vec4 a_jointAnimInfo;\n #endif\n in vec4 a_matWorld0;\n in vec4 a_matWorld1;\n in vec4 a_matWorld2;\n #if CC_USE_LIGHTMAP\n in vec4 a_lightingMapUVParam;\n #endif\n #if CC_USE_REFLECTION_PROBE || CC_RECEIVE_SHADOW\n #if CC_RECEIVE_SHADOW\n #endif\n in vec4 a_localShadowBiasAndProbeId;\n #endif\n #if CC_USE_REFLECTION_PROBE\n in vec4 a_reflectionProbeData;\n #endif\n #if CC_USE_LIGHT_PROBE\n in vec4 a_sh_linear_const_r;\n in vec4 a_sh_linear_const_g;\n in vec4 a_sh_linear_const_b;\n #endif\n#endif\n#if CC_USE_MORPH\n in float a_vertexId;\n int getVertexId() {\n return int(a_vertexId);\n }\n#endif\nhighp float decode32 (highp vec4 rgba) {\n rgba = rgba * 255.0;\n highp float Sign = 1.0 - (step(128.0, (rgba[3]) + 0.5)) * 2.0;\n highp float Exponent = 2.0 * (mod(float(int((rgba[3]) + 0.5)), 128.0)) + (step(128.0, (rgba[2]) + 0.5)) - 127.0;\n highp float Mantissa = (mod(float(int((rgba[2]) + 0.5)), 128.0)) * 65536.0 + rgba[1] * 256.0 + rgba[0] + 8388608.0;\n return Sign * exp2(Exponent - 23.0) * Mantissa;\n}\n#if CC_USE_MORPH\n layout(std140) uniform CCMorph {\n vec4 cc_displacementWeights[15];\n vec4 cc_displacementTextureInfo;\n };\n #if CC_MORPH_TARGET_HAS_POSITION\n uniform sampler2D cc_PositionDisplacements;\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n uniform sampler2D cc_NormalDisplacements;\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n uniform sampler2D cc_TangentDisplacements;\n #endif\n vec2 getPixelLocation(vec2 textureResolution, int pixelIndex) {\n float pixelIndexF = float(pixelIndex);\n float x = mod(pixelIndexF, textureResolution.x);\n float y = floor(pixelIndexF / textureResolution.x);\n return vec2(x, y);\n }\n vec2 getPixelCoordFromLocation(vec2 location, vec2 textureResolution) {\n return (vec2(location.x, location.y) + .5) / textureResolution;\n }\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n vec4 fetchVec3ArrayFromTexture(sampler2D tex, int pixelIndex) {\n ivec2 texSize = textureSize(tex, 0);\n return texelFetch(tex, ivec2(pixelIndex % texSize.x, pixelIndex / texSize.x), 0);\n }\n #else\n vec4 fetchVec3ArrayFromTexture(sampler2D tex, int elementIndex) {\n int pixelIndex = elementIndex * 4;\n vec2 location = getPixelLocation(cc_displacementTextureInfo.xy, pixelIndex);\n vec2 x = getPixelCoordFromLocation(location + vec2(0.0, 0.0), cc_displacementTextureInfo.xy);\n vec2 y = getPixelCoordFromLocation(location + vec2(1.0, 0.0), cc_displacementTextureInfo.xy);\n vec2 z = getPixelCoordFromLocation(location + vec2(2.0, 0.0), cc_displacementTextureInfo.xy);\n return vec4(\n decode32(texture(tex, x)),\n decode32(texture(tex, y)),\n decode32(texture(tex, z)),\n 1.0\n );\n }\n #endif\n float getDisplacementWeight(int index) {\n int quot = index / 4;\n int remainder = index - quot * 4;\n if (remainder == 0) {\n return cc_displacementWeights[quot].x;\n } else if (remainder == 1) {\n return cc_displacementWeights[quot].y;\n } else if (remainder == 2) {\n return cc_displacementWeights[quot].z;\n } else {\n return cc_displacementWeights[quot].w;\n }\n }\n vec3 getVec3DisplacementFromTexture(sampler2D tex, int vertexIndex) {\n #if CC_MORPH_PRECOMPUTED\n return fetchVec3ArrayFromTexture(tex, vertexIndex).rgb;\n #else\n vec3 result = vec3(0, 0, 0);\n int nVertices = int(cc_displacementTextureInfo.z);\n for (int iTarget = 0; iTarget < CC_MORPH_TARGET_COUNT; ++iTarget) {\n result += (fetchVec3ArrayFromTexture(tex, nVertices * iTarget + vertexIndex).rgb * getDisplacementWeight(iTarget));\n }\n return result;\n #endif\n }\n #if CC_MORPH_TARGET_HAS_POSITION\n vec3 getPositionDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_PositionDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n vec3 getNormalDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_NormalDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n vec3 getTangentDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_TangentDisplacements, vertexId);\n }\n #endif\n void applyMorph (inout vec4 position, inout vec3 normal, inout vec4 tangent) {\n int vertexId = getVertexId();\n #if CC_MORPH_TARGET_HAS_POSITION\n position.xyz = position.xyz + getPositionDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n normal.xyz = normal.xyz + getNormalDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n tangent.xyz = tangent.xyz + getTangentDisplacement(vertexId);\n #endif\n }\n void applyMorph (inout vec4 position) {\n #if CC_MORPH_TARGET_HAS_POSITION\n position.xyz = position.xyz + getPositionDisplacement(getVertexId());\n #endif\n }\n#endif\n#if CC_USE_SKINNING\n #if CC_USE_BAKED_ANIMATION\n layout(std140) uniform CCSkinningTexture {\n highp vec4 cc_jointTextureInfo;\n };\n layout(std140) uniform CCSkinningAnimation {\n highp vec4 cc_jointAnimInfo;\n };\n uniform highp sampler2D cc_jointTexture;\n void CCGetJointTextureCoords(float pixelsPerJoint, float jointIdx, out highp float x, out highp float y, out highp float invSize)\n {\n #if USE_INSTANCING\n highp float temp = pixelsPerJoint * (a_jointAnimInfo.x * a_jointAnimInfo.y + jointIdx) + a_jointAnimInfo.z;\n #else\n highp float temp = pixelsPerJoint * (cc_jointAnimInfo.x * cc_jointTextureInfo.y + jointIdx) + cc_jointTextureInfo.z;\n #endif\n invSize = cc_jointTextureInfo.w;\n highp float tempY = floor(temp * invSize);\n x = floor(temp - tempY * cc_jointTextureInfo.x);\n y = (tempY + 0.5) * invSize;\n }\n #else\n #if CC_USE_REAL_TIME_JOINT_TEXTURE\n uniform highp sampler2D cc_realtimeJoint;\n #else\n layout(std140) uniform CCSkinning {\n highp vec4 cc_joints[CC_JOINT_UNIFORM_CAPACITY * 3];\n };\n #endif\n #endif\n #if CC_USE_BAKED_ANIMATION\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n mat4 getJointMatrix (float i) {\n highp float x, y, invSize;\n CCGetJointTextureCoords(3.0, i, x, y, invSize);\n vec4 v1 = texture(cc_jointTexture, vec2((x + 0.5) * invSize, y));\n vec4 v2 = texture(cc_jointTexture, vec2((x + 1.5) * invSize, y));\n vec4 v3 = texture(cc_jointTexture, vec2((x + 2.5) * invSize, y));\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #else\n mat4 getJointMatrix (float i) {\n highp float x, y, invSize;\n CCGetJointTextureCoords(12.0, i, x, y, invSize);\n vec4 v1 = vec4(\n decode32(texture(cc_jointTexture, vec2((x + 0.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 1.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 2.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 3.5) * invSize, y)))\n );\n vec4 v2 = vec4(\n decode32(texture(cc_jointTexture, vec2((x + 4.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 5.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 6.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 7.5) * invSize, y)))\n );\n vec4 v3 = vec4(\n decode32(texture(cc_jointTexture, vec2((x + 8.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 9.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 10.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 11.5) * invSize, y)))\n );\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #else\n #if CC_USE_REAL_TIME_JOINT_TEXTURE\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n mat4 getJointMatrix (float i) {\n float x = i;\n vec4 v1 = texture(cc_realtimeJoint, vec2( x / 256.0, 0.5 / 3.0));\n vec4 v2 = texture(cc_realtimeJoint, vec2( x / 256.0, 1.5 / 3.0));\n vec4 v3 = texture(cc_realtimeJoint, vec2( x / 256.0, 2.5 / 3.0));\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #else\n mat4 getJointMatrix (float i) {\n float x = 4.0 * i;\n vec4 v1 = vec4(\n decode32(texture(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 0.5 / 3.0)))\n );\n vec4 v2 = vec4(\n decode32(texture(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 1.5 / 3.0)))\n );\n vec4 v3 = vec4(\n decode32(texture(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 2.5 / 3.0)))\n );\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #else\n mat4 getJointMatrix (float i) {\n int idx = int(i);\n vec4 v1 = cc_joints[idx * 3];\n vec4 v2 = cc_joints[idx * 3 + 1];\n vec4 v3 = cc_joints[idx * 3 + 2];\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #endif\n mat4 skinMatrix () {\n vec4 joints = vec4(a_joints);\n return getJointMatrix(joints.x) * a_weights.x\n + getJointMatrix(joints.y) * a_weights.y\n + getJointMatrix(joints.z) * a_weights.z\n + getJointMatrix(joints.w) * a_weights.w;\n }\n void CCSkin (inout vec4 position) {\n mat4 m = skinMatrix();\n position = m * position;\n }\n void CCSkin (inout vec4 position, inout vec3 normal, inout vec4 tangent) {\n mat4 m = skinMatrix();\n position = m * position;\n normal = (m * vec4(normal, 0.0)).xyz;\n tangent.xyz = (m * vec4(tangent.xyz, 0.0)).xyz;\n }\n#endif\nvoid CCVertInput(inout vec4 In)\n{\n In = vec4(a_position, 1.0);\n #if CC_USE_MORPH\n applyMorph(In);\n #endif\n #if CC_USE_SKINNING\n CCSkin(In);\n #endif\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};\n#if !USE_INSTANCING\n layout(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 };\n#endif\nvoid CCGetWorldMatrixFull(out mat4 matWorld, out mat4 matWorldIT)\n{\n #if USE_INSTANCING\n matWorld = mat4(\n vec4(a_matWorld0.xyz, 0.0),\n vec4(a_matWorld1.xyz, 0.0),\n vec4(a_matWorld2.xyz, 0.0),\n vec4(a_matWorld0.w, a_matWorld1.w, a_matWorld2.w, 1.0)\n );\n vec3 scale = 1.0 / vec3(length(a_matWorld0.xyz), length(a_matWorld1.xyz), length(a_matWorld2.xyz));\n vec3 scale2 = scale * scale;\n matWorldIT = mat4(\n vec4(a_matWorld0.xyz * scale2.x, 0.0),\n vec4(a_matWorld1.xyz * scale2.y, 0.0),\n vec4(a_matWorld2.xyz * scale2.z, 0.0),\n vec4(0.0, 0.0, 0.0, 1.0)\n );\n #else\n matWorld = cc_matWorld;\n matWorldIT = cc_matWorldIT;\n #endif\n}\nlayout(std140) uniform CCShadow {\n highp mat4 cc_matLightView;\n highp mat4 cc_matLightViewProj;\n highp vec4 cc_shadowInvProjDepthInfo;\n highp vec4 cc_shadowProjDepthInfo;\n highp vec4 cc_shadowProjInfo;\n mediump vec4 cc_shadowNFLSInfo;\n mediump vec4 cc_shadowWHPBInfo;\n mediump vec4 cc_shadowLPNNInfo;\n lowp vec4 cc_shadowColor;\n mediump vec4 cc_planarNDInfo;\n};\nvec4 CalculatePlanarShadowPos(vec3 meshWorldPos, vec3 cameraPos, vec3 lightDir, vec4 plane) {\n vec3 P = meshWorldPos;\n vec3 L = lightDir;\n vec3 N = plane.xyz;\n float d = plane.w + EPSILON_LOWP;\n float dist = (-d - dot(P, N)) / (dot(L, N) + EPSILON_LOWP);\n vec3 shadowPos = P + L * dist;\n return vec4(shadowPos, dist);\n}\nvec4 CalculatePlanarShadowClipPos(vec4 shadowPos, vec3 cameraPos, mat4 matView, mat4 matProj, vec4 nearFar, float bias) {\n vec4 camPos = matView * vec4(shadowPos.xyz, 1.0);\n float lerpCoef = saturate((nearFar.z < 0.0 ? -camPos.z : camPos.z) / (nearFar.y - nearFar.x));\n camPos.z += mix(nearFar.x * 0.01, nearFar.y * EPSILON_LOWP * bias, lerpCoef);\n return matProj * camPos;\n}\nout float v_dist;\nvec4 vert () {\n vec4 position;\n CCVertInput(position);\n mat4 matWorld, matWorldIT;\n CCGetWorldMatrixFull(matWorld, matWorldIT);\n vec3 worldPos = (matWorld * position).xyz;\n vec4 shadowPos = CalculatePlanarShadowPos(worldPos, cc_cameraPos.xyz, cc_mainLitDir.xyz, cc_planarNDInfo);\n position = CalculatePlanarShadowClipPos(shadowPos, cc_cameraPos.xyz, cc_matView, cc_matProj, cc_nearFar, cc_shadowWHPBInfo.w);\n v_dist = shadowPos.w;\n return position;\n}\nvoid main() { gl_Position = vert(); }",
  1712. "frag": "\nprecision highp float;\nlayout(std140) uniform CCShadow {\n highp mat4 cc_matLightView;\n highp mat4 cc_matLightViewProj;\n highp vec4 cc_shadowInvProjDepthInfo;\n highp vec4 cc_shadowProjDepthInfo;\n highp vec4 cc_shadowProjInfo;\n mediump vec4 cc_shadowNFLSInfo;\n mediump vec4 cc_shadowWHPBInfo;\n mediump vec4 cc_shadowLPNNInfo;\n lowp vec4 cc_shadowColor;\n mediump vec4 cc_planarNDInfo;\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};\nvec4 CCFragOutput (vec4 color) {\n return color;\n}\nin float v_dist;\nvec4 frag () {\n if(v_dist < 0.0)\n discard;\n return CCFragOutput(cc_shadowColor);\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = frag(); }"
  1713. },
  1714. "glsl1": {
  1715. "vert": "\nprecision highp float;\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\nfloat saturate(float value) { return clamp(value, 0.0, 1.0); }\nvec2 saturate(vec2 value) { return clamp(value, vec2(0.0), vec2(1.0)); }\nvec3 saturate(vec3 value) { return clamp(value, vec3(0.0), vec3(1.0)); }\nvec4 saturate(vec4 value) { return clamp(value, vec4(0.0), vec4(1.0)); }\n#define LIGHT_MAP_TYPE_DISABLED 0\n#define LIGHT_MAP_TYPE_ALL_IN_ONE 1\n#define LIGHT_MAP_TYPE_INDIRECT_OCCLUSION 2\n#define REFLECTION_PROBE_TYPE_NONE 0\n#define REFLECTION_PROBE_TYPE_CUBE 1\n#define REFLECTION_PROBE_TYPE_PLANAR 2\n#define REFLECTION_PROBE_TYPE_BLEND 3\n#define REFLECTION_PROBE_TYPE_BLEND_AND_SKYBOX 4\n#define LIGHT_TYPE_DIRECTIONAL 0.0\n#define LIGHT_TYPE_SPHERE 1.0\n#define LIGHT_TYPE_SPOT 2.0\n#define LIGHT_TYPE_POINT 3.0\n#define LIGHT_TYPE_RANGED_DIRECTIONAL 4.0\n#define IS_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_DIRECTIONAL)) < EPSILON_LOWP)\n#define IS_SPHERE_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPHERE)) < EPSILON_LOWP)\n#define IS_SPOT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_SPOT)) < EPSILON_LOWP)\n#define IS_POINT_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_POINT)) < EPSILON_LOWP)\n#define IS_RANGED_DIRECTIONAL_LIGHT(light_type) (abs(float(light_type) - float(LIGHT_TYPE_RANGED_DIRECTIONAL)) < EPSILON_LOWP)\n#define TONE_MAPPING_ACES 0\n#define TONE_MAPPING_LINEAR 1\n#define SURFACES_MAX_TRANSMIT_DEPTH_VALUE 999999.0\n#ifndef CC_SURFACES_DEBUG_VIEW_SINGLE\n #define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#endif\n#ifndef CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n #define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#endif\nstruct StandardVertInput {\n highp vec4 position;\n vec3 normal;\n vec4 tangent;\n};\nattribute vec3 a_position;\nattribute vec3 a_normal;\nattribute vec2 a_texCoord;\nattribute vec4 a_tangent;\n#if CC_USE_SKINNING\n attribute vec4 a_joints;\n attribute vec4 a_weights;\n#endif\n#if USE_INSTANCING\n #if CC_USE_BAKED_ANIMATION\n attribute highp vec4 a_jointAnimInfo;\n #endif\n attribute vec4 a_matWorld0;\n attribute vec4 a_matWorld1;\n attribute vec4 a_matWorld2;\n #if CC_USE_LIGHTMAP\n attribute vec4 a_lightingMapUVParam;\n #endif\n #if CC_USE_REFLECTION_PROBE || CC_RECEIVE_SHADOW\n #if CC_RECEIVE_SHADOW\n #endif\n attribute vec4 a_localShadowBiasAndProbeId;\n #endif\n #if CC_USE_REFLECTION_PROBE\n attribute vec4 a_reflectionProbeData;\n #endif\n #if CC_USE_LIGHT_PROBE\n attribute vec4 a_sh_linear_const_r;\n attribute vec4 a_sh_linear_const_g;\n attribute vec4 a_sh_linear_const_b;\n #endif\n#endif\n#if CC_USE_MORPH\n attribute float a_vertexId;\n int getVertexId() {\n return int(a_vertexId);\n }\n#endif\nhighp float decode32 (highp vec4 rgba) {\n rgba = rgba * 255.0;\n highp float Sign = 1.0 - (step(128.0, (rgba[3]) + 0.5)) * 2.0;\n highp float Exponent = 2.0 * (mod(float(int((rgba[3]) + 0.5)), 128.0)) + (step(128.0, (rgba[2]) + 0.5)) - 127.0;\n highp float Mantissa = (mod(float(int((rgba[2]) + 0.5)), 128.0)) * 65536.0 + rgba[1] * 256.0 + rgba[0] + 8388608.0;\n return Sign * exp2(Exponent - 23.0) * Mantissa;\n}\n#if CC_USE_MORPH\n uniform vec4 cc_displacementWeights[15];\n uniform vec4 cc_displacementTextureInfo;\n #if CC_MORPH_TARGET_HAS_POSITION\n uniform sampler2D cc_PositionDisplacements;\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n uniform sampler2D cc_NormalDisplacements;\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n uniform sampler2D cc_TangentDisplacements;\n #endif\n vec2 getPixelLocation(vec2 textureResolution, int pixelIndex) {\n float pixelIndexF = float(pixelIndex);\n float x = mod(pixelIndexF, textureResolution.x);\n float y = floor(pixelIndexF / textureResolution.x);\n return vec2(x, y);\n }\n vec2 getPixelCoordFromLocation(vec2 location, vec2 textureResolution) {\n return (vec2(location.x, location.y) + .5) / textureResolution;\n }\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n vec4 fetchVec3ArrayFromTexture(sampler2D tex, int elementIndex) {\n int pixelIndex = elementIndex;\n vec2 location = getPixelLocation(cc_displacementTextureInfo.xy, pixelIndex);\n vec2 uv = getPixelCoordFromLocation(location, cc_displacementTextureInfo.xy);\n return texture2D(tex, uv);\n }\n #else\n vec4 fetchVec3ArrayFromTexture(sampler2D tex, int elementIndex) {\n int pixelIndex = elementIndex * 4;\n vec2 location = getPixelLocation(cc_displacementTextureInfo.xy, pixelIndex);\n vec2 x = getPixelCoordFromLocation(location + vec2(0.0, 0.0), cc_displacementTextureInfo.xy);\n vec2 y = getPixelCoordFromLocation(location + vec2(1.0, 0.0), cc_displacementTextureInfo.xy);\n vec2 z = getPixelCoordFromLocation(location + vec2(2.0, 0.0), cc_displacementTextureInfo.xy);\n return vec4(\n decode32(texture2D(tex, x)),\n decode32(texture2D(tex, y)),\n decode32(texture2D(tex, z)),\n 1.0\n );\n }\n #endif\n float getDisplacementWeight(int index) {\n int quot = index / 4;\n int remainder = index - quot * 4;\n if (remainder == 0) {\n return cc_displacementWeights[quot].x;\n } else if (remainder == 1) {\n return cc_displacementWeights[quot].y;\n } else if (remainder == 2) {\n return cc_displacementWeights[quot].z;\n } else {\n return cc_displacementWeights[quot].w;\n }\n }\n vec3 getVec3DisplacementFromTexture(sampler2D tex, int vertexIndex) {\n #if CC_MORPH_PRECOMPUTED\n return fetchVec3ArrayFromTexture(tex, vertexIndex).rgb;\n #else\n vec3 result = vec3(0, 0, 0);\n int nVertices = int(cc_displacementTextureInfo.z);\n for (int iTarget = 0; iTarget < CC_MORPH_TARGET_COUNT; ++iTarget) {\n result += (fetchVec3ArrayFromTexture(tex, nVertices * iTarget + vertexIndex).rgb * getDisplacementWeight(iTarget));\n }\n return result;\n #endif\n }\n #if CC_MORPH_TARGET_HAS_POSITION\n vec3 getPositionDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_PositionDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n vec3 getNormalDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_NormalDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n vec3 getTangentDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_TangentDisplacements, vertexId);\n }\n #endif\n void applyMorph (inout vec4 position, inout vec3 normal, inout vec4 tangent) {\n int vertexId = getVertexId();\n #if CC_MORPH_TARGET_HAS_POSITION\n position.xyz = position.xyz + getPositionDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n normal.xyz = normal.xyz + getNormalDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n tangent.xyz = tangent.xyz + getTangentDisplacement(vertexId);\n #endif\n }\n void applyMorph (inout vec4 position) {\n #if CC_MORPH_TARGET_HAS_POSITION\n position.xyz = position.xyz + getPositionDisplacement(getVertexId());\n #endif\n }\n#endif\n#if CC_USE_SKINNING\n #if CC_USE_BAKED_ANIMATION\n uniform highp vec4 cc_jointTextureInfo;\n uniform highp vec4 cc_jointAnimInfo;\n uniform highp sampler2D cc_jointTexture;\n void CCGetJointTextureCoords(float pixelsPerJoint, float jointIdx, out highp float x, out highp float y, out highp float invSize)\n {\n #if USE_INSTANCING\n highp float temp = pixelsPerJoint * (a_jointAnimInfo.x * a_jointAnimInfo.y + jointIdx) + a_jointAnimInfo.z;\n #else\n highp float temp = pixelsPerJoint * (cc_jointAnimInfo.x * cc_jointTextureInfo.y + jointIdx) + cc_jointTextureInfo.z;\n #endif\n invSize = cc_jointTextureInfo.w;\n highp float tempY = floor(temp * invSize);\n x = floor(temp - tempY * cc_jointTextureInfo.x);\n y = (tempY + 0.5) * invSize;\n }\n #else\n #if CC_USE_REAL_TIME_JOINT_TEXTURE\n uniform highp sampler2D cc_realtimeJoint;\n #else\n uniform highp vec4 cc_joints[CC_JOINT_UNIFORM_CAPACITY * 3];\n #endif\n #endif\n #if CC_USE_BAKED_ANIMATION\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n mat4 getJointMatrix (float i) {\n highp float x, y, invSize;\n CCGetJointTextureCoords(3.0, i, x, y, invSize);\n vec4 v1 = texture2D(cc_jointTexture, vec2((x + 0.5) * invSize, y));\n vec4 v2 = texture2D(cc_jointTexture, vec2((x + 1.5) * invSize, y));\n vec4 v3 = texture2D(cc_jointTexture, vec2((x + 2.5) * invSize, y));\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #else\n mat4 getJointMatrix (float i) {\n highp float x, y, invSize;\n CCGetJointTextureCoords(12.0, i, x, y, invSize);\n vec4 v1 = vec4(\n decode32(texture2D(cc_jointTexture, vec2((x + 0.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 1.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 2.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 3.5) * invSize, y)))\n );\n vec4 v2 = vec4(\n decode32(texture2D(cc_jointTexture, vec2((x + 4.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 5.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 6.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 7.5) * invSize, y)))\n );\n vec4 v3 = vec4(\n decode32(texture2D(cc_jointTexture, vec2((x + 8.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 9.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 10.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 11.5) * invSize, y)))\n );\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #else\n #if CC_USE_REAL_TIME_JOINT_TEXTURE\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n mat4 getJointMatrix (float i) {\n float x = i;\n vec4 v1 = texture2D(cc_realtimeJoint, vec2( x / 256.0, 0.5 / 3.0));\n vec4 v2 = texture2D(cc_realtimeJoint, vec2( x / 256.0, 1.5 / 3.0));\n vec4 v3 = texture2D(cc_realtimeJoint, vec2( x / 256.0, 2.5 / 3.0));\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #else\n mat4 getJointMatrix (float i) {\n float x = 4.0 * i;\n vec4 v1 = vec4(\n decode32(texture2D(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 0.5 / 3.0)))\n );\n vec4 v2 = vec4(\n decode32(texture2D(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 1.5 / 3.0)))\n );\n vec4 v3 = vec4(\n decode32(texture2D(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 2.5 / 3.0)))\n );\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #else\n mat4 getJointMatrix (float i) {\n int idx = int(i);\n vec4 v1 = cc_joints[idx * 3];\n vec4 v2 = cc_joints[idx * 3 + 1];\n vec4 v3 = cc_joints[idx * 3 + 2];\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #endif\n mat4 skinMatrix () {\n vec4 joints = vec4(a_joints);\n return getJointMatrix(joints.x) * a_weights.x\n + getJointMatrix(joints.y) * a_weights.y\n + getJointMatrix(joints.z) * a_weights.z\n + getJointMatrix(joints.w) * a_weights.w;\n }\n void CCSkin (inout vec4 position) {\n mat4 m = skinMatrix();\n position = m * position;\n }\n void CCSkin (inout vec4 position, inout vec3 normal, inout vec4 tangent) {\n mat4 m = skinMatrix();\n position = m * position;\n normal = (m * vec4(normal, 0.0)).xyz;\n tangent.xyz = (m * vec4(tangent.xyz, 0.0)).xyz;\n }\n#endif\nvoid CCVertInput(inout vec4 In)\n{\n In = vec4(a_position, 1.0);\n #if CC_USE_MORPH\n applyMorph(In);\n #endif\n #if CC_USE_SKINNING\n CCSkin(In);\n #endif\n}\nuniform highp mat4 cc_matView;\n uniform highp mat4 cc_matProj;\n uniform highp vec4 cc_cameraPos;\n uniform mediump vec4 cc_mainLitDir;\n uniform mediump vec4 cc_nearFar;\n#if !USE_INSTANCING\n uniform highp mat4 cc_matWorld;\n uniform highp mat4 cc_matWorldIT;\n#endif\nvoid CCGetWorldMatrixFull(out mat4 matWorld, out mat4 matWorldIT)\n{\n #if USE_INSTANCING\n matWorld = mat4(\n vec4(a_matWorld0.xyz, 0.0),\n vec4(a_matWorld1.xyz, 0.0),\n vec4(a_matWorld2.xyz, 0.0),\n vec4(a_matWorld0.w, a_matWorld1.w, a_matWorld2.w, 1.0)\n );\n vec3 scale = 1.0 / vec3(length(a_matWorld0.xyz), length(a_matWorld1.xyz), length(a_matWorld2.xyz));\n vec3 scale2 = scale * scale;\n matWorldIT = mat4(\n vec4(a_matWorld0.xyz * scale2.x, 0.0),\n vec4(a_matWorld1.xyz * scale2.y, 0.0),\n vec4(a_matWorld2.xyz * scale2.z, 0.0),\n vec4(0.0, 0.0, 0.0, 1.0)\n );\n #else\n matWorld = cc_matWorld;\n matWorldIT = cc_matWorldIT;\n #endif\n}\nuniform mediump vec4 cc_shadowWHPBInfo;\n uniform mediump vec4 cc_planarNDInfo;\nvec4 CalculatePlanarShadowPos(vec3 meshWorldPos, vec3 cameraPos, vec3 lightDir, vec4 plane) {\n vec3 P = meshWorldPos;\n vec3 L = lightDir;\n vec3 N = plane.xyz;\n float d = plane.w + EPSILON_LOWP;\n float dist = (-d - dot(P, N)) / (dot(L, N) + EPSILON_LOWP);\n vec3 shadowPos = P + L * dist;\n return vec4(shadowPos, dist);\n}\nvec4 CalculatePlanarShadowClipPos(vec4 shadowPos, vec3 cameraPos, mat4 matView, mat4 matProj, vec4 nearFar, float bias) {\n vec4 camPos = matView * vec4(shadowPos.xyz, 1.0);\n float lerpCoef = saturate((nearFar.z < 0.0 ? -camPos.z : camPos.z) / (nearFar.y - nearFar.x));\n camPos.z += mix(nearFar.x * 0.01, nearFar.y * EPSILON_LOWP * bias, lerpCoef);\n return matProj * camPos;\n}\nvarying float v_dist;\nvec4 vert () {\n vec4 position;\n CCVertInput(position);\n mat4 matWorld, matWorldIT;\n CCGetWorldMatrixFull(matWorld, matWorldIT);\n vec3 worldPos = (matWorld * position).xyz;\n vec4 shadowPos = CalculatePlanarShadowPos(worldPos, cc_cameraPos.xyz, cc_mainLitDir.xyz, cc_planarNDInfo);\n position = CalculatePlanarShadowClipPos(shadowPos, cc_cameraPos.xyz, cc_matView, cc_matProj, cc_nearFar, cc_shadowWHPBInfo.w);\n v_dist = shadowPos.w;\n return position;\n}\nvoid main() { gl_Position = vert(); }",
  1716. "frag": "\nprecision highp float;\nuniform lowp vec4 cc_shadowColor;\nvec4 CCFragOutput (vec4 color) {\n return color;\n}\nvarying float v_dist;\nvec4 frag () {\n if(v_dist < 0.0)\n discard;\n return CCFragOutput(cc_shadowColor);\n}\nvoid main() { gl_FragColor = frag(); }"
  1717. },
  1718. "builtins": {
  1719. "globals": {
  1720. "blocks": [
  1721. {
  1722. "name": "CCGlobal",
  1723. "defines": []
  1724. },
  1725. {
  1726. "name": "CCCamera",
  1727. "defines": []
  1728. },
  1729. {
  1730. "name": "CCShadow",
  1731. "defines": []
  1732. }
  1733. ],
  1734. "samplerTextures": [],
  1735. "buffers": [],
  1736. "images": []
  1737. },
  1738. "locals": {
  1739. "blocks": [
  1740. {
  1741. "name": "CCMorph",
  1742. "defines": [
  1743. "CC_USE_MORPH"
  1744. ]
  1745. },
  1746. {
  1747. "name": "CCSkinningTexture",
  1748. "defines": [
  1749. "CC_USE_SKINNING",
  1750. "CC_USE_BAKED_ANIMATION"
  1751. ]
  1752. },
  1753. {
  1754. "name": "CCSkinningAnimation",
  1755. "defines": [
  1756. "CC_USE_SKINNING",
  1757. "CC_USE_BAKED_ANIMATION"
  1758. ]
  1759. },
  1760. {
  1761. "name": "CCSkinning",
  1762. "defines": [
  1763. "CC_USE_SKINNING",
  1764. "!CC_USE_BAKED_ANIMATION",
  1765. "!CC_USE_REAL_TIME_JOINT_TEXTURE"
  1766. ]
  1767. },
  1768. {
  1769. "name": "CCLocal",
  1770. "defines": [
  1771. "!USE_INSTANCING"
  1772. ]
  1773. }
  1774. ],
  1775. "samplerTextures": [
  1776. {
  1777. "name": "cc_PositionDisplacements",
  1778. "defines": [
  1779. "CC_USE_MORPH",
  1780. "CC_MORPH_TARGET_HAS_POSITION"
  1781. ]
  1782. },
  1783. {
  1784. "name": "cc_NormalDisplacements",
  1785. "defines": [
  1786. "CC_USE_MORPH",
  1787. "CC_MORPH_TARGET_HAS_NORMAL"
  1788. ]
  1789. },
  1790. {
  1791. "name": "cc_TangentDisplacements",
  1792. "defines": [
  1793. "CC_USE_MORPH",
  1794. "CC_MORPH_TARGET_HAS_TANGENT"
  1795. ]
  1796. },
  1797. {
  1798. "name": "cc_jointTexture",
  1799. "defines": [
  1800. "CC_USE_SKINNING",
  1801. "CC_USE_BAKED_ANIMATION"
  1802. ]
  1803. },
  1804. {
  1805. "name": "cc_realtimeJoint",
  1806. "defines": [
  1807. "CC_USE_SKINNING",
  1808. "!CC_USE_BAKED_ANIMATION",
  1809. "CC_USE_REAL_TIME_JOINT_TEXTURE"
  1810. ]
  1811. }
  1812. ],
  1813. "buffers": [],
  1814. "images": []
  1815. },
  1816. "statistics": {
  1817. "CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS": 90,
  1818. "CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS": 58
  1819. }
  1820. },
  1821. "defines": [
  1822. {
  1823. "name": "USE_INSTANCING",
  1824. "type": "boolean"
  1825. },
  1826. {
  1827. "name": "CC_USE_SKINNING",
  1828. "type": "boolean"
  1829. },
  1830. {
  1831. "name": "CC_USE_BAKED_ANIMATION",
  1832. "type": "boolean"
  1833. },
  1834. {
  1835. "name": "CC_USE_LIGHTMAP",
  1836. "type": "boolean"
  1837. },
  1838. {
  1839. "name": "CC_USE_REFLECTION_PROBE",
  1840. "type": "boolean"
  1841. },
  1842. {
  1843. "name": "CC_RECEIVE_SHADOW",
  1844. "type": "boolean"
  1845. },
  1846. {
  1847. "name": "CC_USE_LIGHT_PROBE",
  1848. "type": "boolean"
  1849. },
  1850. {
  1851. "name": "CC_USE_MORPH",
  1852. "type": "boolean"
  1853. },
  1854. {
  1855. "name": "CC_MORPH_TARGET_COUNT",
  1856. "type": "number",
  1857. "range": [
  1858. 2,
  1859. 8
  1860. ]
  1861. },
  1862. {
  1863. "name": "CC_MORPH_TARGET_HAS_POSITION",
  1864. "type": "boolean"
  1865. },
  1866. {
  1867. "name": "CC_MORPH_TARGET_HAS_NORMAL",
  1868. "type": "boolean"
  1869. },
  1870. {
  1871. "name": "CC_MORPH_TARGET_HAS_TANGENT",
  1872. "type": "boolean"
  1873. },
  1874. {
  1875. "name": "CC_MORPH_PRECOMPUTED",
  1876. "type": "boolean"
  1877. },
  1878. {
  1879. "name": "CC_USE_REAL_TIME_JOINT_TEXTURE",
  1880. "type": "boolean"
  1881. }
  1882. ]
  1883. }
  1884. ],
  1885. [
  1886. {
  1887. "name": "opaque",
  1888. "passes": [
  1889. {
  1890. "program": "builtin-unlit|unlit-vs:vert|unlit-fs:frag",
  1891. "properties": {
  1892. "mainTexture": {
  1893. "value": "grey",
  1894. "type": 28
  1895. },
  1896. "tilingOffset": {
  1897. "type": 16,
  1898. "value": [
  1899. 1,
  1900. 1,
  1901. 0,
  1902. 0
  1903. ]
  1904. },
  1905. "mainColor": {
  1906. "linear": true,
  1907. "type": 16,
  1908. "value": [
  1909. 1,
  1910. 1,
  1911. 1,
  1912. 1
  1913. ]
  1914. },
  1915. "colorScale": {
  1916. "type": 15,
  1917. "value": [
  1918. 1,
  1919. 1,
  1920. 1
  1921. ],
  1922. "handleInfo": [
  1923. "colorScaleAndCutoff",
  1924. 0,
  1925. 15
  1926. ]
  1927. },
  1928. "alphaThreshold": {
  1929. "type": 13,
  1930. "value": [
  1931. 0.5
  1932. ],
  1933. "handleInfo": [
  1934. "colorScaleAndCutoff",
  1935. 3,
  1936. 13
  1937. ]
  1938. },
  1939. "color": {
  1940. "linear": true,
  1941. "type": 16,
  1942. "handleInfo": [
  1943. "mainColor",
  1944. 0,
  1945. 16
  1946. ]
  1947. },
  1948. "colorScaleAndCutoff": {
  1949. "type": 16,
  1950. "value": [
  1951. 1,
  1952. 1,
  1953. 1,
  1954. 0.5
  1955. ]
  1956. }
  1957. }
  1958. },
  1959. {
  1960. "phase": "planar-shadow",
  1961. "propertyIndex": 0,
  1962. "program": "builtin-unlit|planar-shadow-vs:vert|planar-shadow-fs:frag",
  1963. "blendState": {
  1964. "targets": [
  1965. {
  1966. "blend": true,
  1967. "blendSrc": 2,
  1968. "blendDst": 4,
  1969. "blendDstAlpha": 4
  1970. }
  1971. ]
  1972. },
  1973. "depthStencilState": {
  1974. "depthTest": true,
  1975. "depthWrite": false,
  1976. "stencilTestFront": true,
  1977. "stencilFuncFront": 5,
  1978. "stencilPassOpFront": 2,
  1979. "stencilRefBack": 128,
  1980. "stencilRefFront": 128,
  1981. "stencilReadMaskBack": 128,
  1982. "stencilReadMaskFront": 128,
  1983. "stencilWriteMaskBack": 128,
  1984. "stencilWriteMaskFront": 128
  1985. }
  1986. },
  1987. {
  1988. "phase": "deferred-forward",
  1989. "propertyIndex": 0,
  1990. "program": "builtin-unlit|unlit-vs:vert|unlit-fs:frag"
  1991. }
  1992. ]
  1993. },
  1994. {
  1995. "name": "transparent",
  1996. "passes": [
  1997. {
  1998. "program": "builtin-unlit|unlit-vs:vert|unlit-fs:frag",
  1999. "blendState": {
  2000. "targets": [
  2001. {
  2002. "blend": true,
  2003. "blendSrc": 2,
  2004. "blendDst": 4,
  2005. "blendDstAlpha": 4
  2006. }
  2007. ]
  2008. },
  2009. "depthStencilState": {
  2010. "depthTest": true,
  2011. "depthWrite": false
  2012. },
  2013. "properties": {
  2014. "mainTexture": {
  2015. "value": "grey",
  2016. "type": 28
  2017. },
  2018. "tilingOffset": {
  2019. "type": 16,
  2020. "value": [
  2021. 1,
  2022. 1,
  2023. 0,
  2024. 0
  2025. ]
  2026. },
  2027. "mainColor": {
  2028. "linear": true,
  2029. "type": 16,
  2030. "value": [
  2031. 1,
  2032. 1,
  2033. 1,
  2034. 1
  2035. ]
  2036. },
  2037. "colorScale": {
  2038. "type": 15,
  2039. "value": [
  2040. 1,
  2041. 1,
  2042. 1
  2043. ],
  2044. "handleInfo": [
  2045. "colorScaleAndCutoff",
  2046. 0,
  2047. 15
  2048. ]
  2049. },
  2050. "alphaThreshold": {
  2051. "type": 13,
  2052. "value": [
  2053. 0.5
  2054. ],
  2055. "handleInfo": [
  2056. "colorScaleAndCutoff",
  2057. 3,
  2058. 13
  2059. ]
  2060. },
  2061. "color": {
  2062. "linear": true,
  2063. "type": 16,
  2064. "handleInfo": [
  2065. "mainColor",
  2066. 0,
  2067. 16
  2068. ]
  2069. },
  2070. "colorScaleAndCutoff": {
  2071. "type": 16,
  2072. "value": [
  2073. 1,
  2074. 1,
  2075. 1,
  2076. 0.5
  2077. ]
  2078. }
  2079. }
  2080. },
  2081. {
  2082. "phase": "planar-shadow",
  2083. "propertyIndex": 0,
  2084. "program": "builtin-unlit|planar-shadow-vs:vert|planar-shadow-fs:frag",
  2085. "blendState": {
  2086. "targets": [
  2087. {
  2088. "blend": true,
  2089. "blendSrc": 2,
  2090. "blendDst": 4,
  2091. "blendDstAlpha": 4
  2092. }
  2093. ]
  2094. },
  2095. "depthStencilState": {
  2096. "depthTest": true,
  2097. "depthWrite": false,
  2098. "stencilTestFront": true,
  2099. "stencilFuncFront": 5,
  2100. "stencilPassOpFront": 2,
  2101. "stencilRefBack": 128,
  2102. "stencilRefFront": 128,
  2103. "stencilReadMaskBack": 128,
  2104. "stencilReadMaskFront": 128,
  2105. "stencilWriteMaskBack": 128,
  2106. "stencilWriteMaskFront": 128
  2107. }
  2108. },
  2109. {
  2110. "phase": "deferred-forward",
  2111. "propertyIndex": 0,
  2112. "program": "builtin-unlit|unlit-vs:vert|unlit-fs:frag",
  2113. "blendState": {
  2114. "targets": [
  2115. {
  2116. "blend": true,
  2117. "blendSrc": 2,
  2118. "blendDst": 4,
  2119. "blendDstAlpha": 4
  2120. }
  2121. ]
  2122. },
  2123. "depthStencilState": {
  2124. "depthTest": true,
  2125. "depthWrite": false
  2126. }
  2127. }
  2128. ]
  2129. },
  2130. {
  2131. "name": "add",
  2132. "passes": [
  2133. {
  2134. "program": "builtin-unlit|unlit-vs:vert|unlit-fs:frag",
  2135. "rasterizerState": {
  2136. "cullMode": 0
  2137. },
  2138. "blendState": {
  2139. "targets": [
  2140. {
  2141. "blend": true,
  2142. "blendSrc": 2,
  2143. "blendDst": 1,
  2144. "blendSrcAlpha": 2,
  2145. "blendDstAlpha": 1
  2146. }
  2147. ]
  2148. },
  2149. "depthStencilState": {
  2150. "depthTest": true,
  2151. "depthWrite": false
  2152. },
  2153. "properties": {
  2154. "mainTexture": {
  2155. "value": "grey",
  2156. "type": 28
  2157. },
  2158. "tilingOffset": {
  2159. "type": 16,
  2160. "value": [
  2161. 1,
  2162. 1,
  2163. 0,
  2164. 0
  2165. ]
  2166. },
  2167. "mainColor": {
  2168. "linear": true,
  2169. "type": 16,
  2170. "value": [
  2171. 1,
  2172. 1,
  2173. 1,
  2174. 1
  2175. ]
  2176. },
  2177. "colorScale": {
  2178. "type": 15,
  2179. "value": [
  2180. 1,
  2181. 1,
  2182. 1
  2183. ],
  2184. "handleInfo": [
  2185. "colorScaleAndCutoff",
  2186. 0,
  2187. 15
  2188. ]
  2189. },
  2190. "alphaThreshold": {
  2191. "type": 13,
  2192. "value": [
  2193. 0.5
  2194. ],
  2195. "handleInfo": [
  2196. "colorScaleAndCutoff",
  2197. 3,
  2198. 13
  2199. ]
  2200. },
  2201. "color": {
  2202. "linear": true,
  2203. "type": 16,
  2204. "handleInfo": [
  2205. "mainColor",
  2206. 0,
  2207. 16
  2208. ]
  2209. },
  2210. "colorScaleAndCutoff": {
  2211. "type": 16,
  2212. "value": [
  2213. 1,
  2214. 1,
  2215. 1,
  2216. 0.5
  2217. ]
  2218. }
  2219. }
  2220. },
  2221. {
  2222. "phase": "deferred-forward",
  2223. "propertyIndex": 0,
  2224. "program": "builtin-unlit|unlit-vs:vert|unlit-fs:frag",
  2225. "rasterizerState": {
  2226. "cullMode": 0
  2227. },
  2228. "blendState": {
  2229. "targets": [
  2230. {
  2231. "blend": true,
  2232. "blendSrc": 2,
  2233. "blendDst": 1,
  2234. "blendSrcAlpha": 2,
  2235. "blendDstAlpha": 1
  2236. }
  2237. ]
  2238. },
  2239. "depthStencilState": {
  2240. "depthTest": true,
  2241. "depthWrite": false
  2242. }
  2243. }
  2244. ]
  2245. },
  2246. {
  2247. "name": "alpha-blend",
  2248. "passes": [
  2249. {
  2250. "program": "builtin-unlit|unlit-vs:vert|unlit-fs:frag",
  2251. "rasterizerState": {
  2252. "cullMode": 0
  2253. },
  2254. "blendState": {
  2255. "targets": [
  2256. {
  2257. "blend": true,
  2258. "blendSrc": 2,
  2259. "blendDst": 4,
  2260. "blendSrcAlpha": 2,
  2261. "blendDstAlpha": 4
  2262. }
  2263. ]
  2264. },
  2265. "depthStencilState": {
  2266. "depthTest": true,
  2267. "depthWrite": false
  2268. },
  2269. "properties": {
  2270. "mainTexture": {
  2271. "value": "grey",
  2272. "type": 28
  2273. },
  2274. "tilingOffset": {
  2275. "type": 16,
  2276. "value": [
  2277. 1,
  2278. 1,
  2279. 0,
  2280. 0
  2281. ]
  2282. },
  2283. "mainColor": {
  2284. "linear": true,
  2285. "type": 16,
  2286. "value": [
  2287. 1,
  2288. 1,
  2289. 1,
  2290. 1
  2291. ]
  2292. },
  2293. "colorScale": {
  2294. "type": 15,
  2295. "value": [
  2296. 1,
  2297. 1,
  2298. 1
  2299. ],
  2300. "handleInfo": [
  2301. "colorScaleAndCutoff",
  2302. 0,
  2303. 15
  2304. ]
  2305. },
  2306. "alphaThreshold": {
  2307. "type": 13,
  2308. "value": [
  2309. 0.5
  2310. ],
  2311. "handleInfo": [
  2312. "colorScaleAndCutoff",
  2313. 3,
  2314. 13
  2315. ]
  2316. },
  2317. "color": {
  2318. "linear": true,
  2319. "type": 16,
  2320. "handleInfo": [
  2321. "mainColor",
  2322. 0,
  2323. 16
  2324. ]
  2325. },
  2326. "colorScaleAndCutoff": {
  2327. "type": 16,
  2328. "value": [
  2329. 1,
  2330. 1,
  2331. 1,
  2332. 0.5
  2333. ]
  2334. }
  2335. }
  2336. },
  2337. {
  2338. "phase": "deferred-forward",
  2339. "propertyIndex": 0,
  2340. "program": "builtin-unlit|unlit-vs:vert|unlit-fs:frag",
  2341. "rasterizerState": {
  2342. "cullMode": 0
  2343. },
  2344. "blendState": {
  2345. "targets": [
  2346. {
  2347. "blend": true,
  2348. "blendSrc": 2,
  2349. "blendDst": 4,
  2350. "blendSrcAlpha": 2,
  2351. "blendDstAlpha": 4
  2352. }
  2353. ]
  2354. },
  2355. "depthStencilState": {
  2356. "depthTest": true,
  2357. "depthWrite": false
  2358. }
  2359. }
  2360. ]
  2361. }
  2362. ]
  2363. ]
  2364. ],
  2365. 0,
  2366. 0,
  2367. [],
  2368. [],
  2369. []
  2370. ]