b546c596-5f73-40be-a426-cff8df144ac8.json 209 KB

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