5967a800-25ad-4c00-9872-5c4ba7840d17.json 89 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301
  1. {
  2. "__type__": "cc.EffectAsset",
  3. "_name": "internal/editor/light-probe-visualization",
  4. "_objFlags": 0,
  5. "__editorExtras__": {},
  6. "_native": "",
  7. "techniques": [
  8. {
  9. "passes": [
  10. {
  11. "rasterizerState": {
  12. "cullMode": 0
  13. },
  14. "blendState": {
  15. "targets": [
  16. {
  17. "blend": true,
  18. "blendSrc": 2,
  19. "blendDst": 4,
  20. "blendDstAlpha": 4
  21. }
  22. ]
  23. },
  24. "program": "internal/editor/light-probe-visualization|gizmo-vs:vert|gizmo-fs:front",
  25. "priority": 245,
  26. "depthStencilState": {
  27. "depthTest": false,
  28. "depthWrite": false
  29. }
  30. },
  31. {
  32. "rasterizerState": {
  33. "cullMode": 0
  34. },
  35. "blendState": {
  36. "targets": [
  37. {
  38. "blend": true,
  39. "blendSrc": 2,
  40. "blendDst": 4,
  41. "blendDstAlpha": 4
  42. }
  43. ]
  44. },
  45. "program": "internal/editor/light-probe-visualization|gizmo-vs:vert|gizmo-fs:back",
  46. "priority": 245,
  47. "depthStencilState": {
  48. "depthTest": false,
  49. "depthWrite": false
  50. }
  51. }
  52. ]
  53. }
  54. ],
  55. "shaders": [
  56. {
  57. "blocks": [
  58. {
  59. "name": "Constant",
  60. "members": [
  61. {
  62. "name": "mainColor",
  63. "type": 16,
  64. "count": 1
  65. },
  66. {
  67. "name": "cc_sh_linear_const_r",
  68. "type": 16,
  69. "count": 1
  70. },
  71. {
  72. "name": "cc_sh_linear_const_g",
  73. "type": 16,
  74. "count": 1
  75. },
  76. {
  77. "name": "cc_sh_linear_const_b",
  78. "type": 16,
  79. "count": 1
  80. },
  81. {
  82. "name": "cc_sh_quadratic_r",
  83. "type": 16,
  84. "count": 1
  85. },
  86. {
  87. "name": "cc_sh_quadratic_g",
  88. "type": 16,
  89. "count": 1
  90. },
  91. {
  92. "name": "cc_sh_quadratic_b",
  93. "type": 16,
  94. "count": 1
  95. },
  96. {
  97. "name": "cc_sh_quadratic_a",
  98. "type": 16,
  99. "count": 1
  100. }
  101. ],
  102. "defines": [],
  103. "stageFlags": 16,
  104. "binding": 0
  105. }
  106. ],
  107. "samplerTextures": [],
  108. "samplers": [],
  109. "textures": [],
  110. "buffers": [],
  111. "images": [],
  112. "subpassInputs": [],
  113. "attributes": [
  114. {
  115. "name": "a_position",
  116. "defines": [],
  117. "format": 32,
  118. "location": 0
  119. },
  120. {
  121. "name": "a_normal",
  122. "defines": [],
  123. "format": 32,
  124. "location": 1
  125. }
  126. ],
  127. "varyings": [
  128. {
  129. "name": "normal_w",
  130. "type": 15,
  131. "count": 1,
  132. "defines": [],
  133. "stageFlags": 17,
  134. "location": 0
  135. },
  136. {
  137. "name": "pos_w",
  138. "type": 15,
  139. "count": 1,
  140. "defines": [],
  141. "stageFlags": 17,
  142. "location": 1
  143. },
  144. {
  145. "name": "pos_l",
  146. "type": 15,
  147. "count": 1,
  148. "defines": [],
  149. "stageFlags": 17,
  150. "location": 2
  151. },
  152. {
  153. "name": "right",
  154. "type": 15,
  155. "count": 1,
  156. "defines": [],
  157. "stageFlags": 17,
  158. "location": 3
  159. },
  160. {
  161. "name": "up",
  162. "type": 15,
  163. "count": 1,
  164. "defines": [],
  165. "stageFlags": 17,
  166. "location": 4
  167. },
  168. {
  169. "name": "forward",
  170. "type": 15,
  171. "count": 1,
  172. "defines": [],
  173. "stageFlags": 17,
  174. "location": 5
  175. }
  176. ],
  177. "fragColors": [
  178. {
  179. "name": "cc_FragColor",
  180. "typename": "vec4",
  181. "type": 16,
  182. "count": 1,
  183. "defines": [],
  184. "stageFlags": 16,
  185. "location": 0
  186. }
  187. ],
  188. "descriptors": [
  189. {
  190. "rate": 0,
  191. "blocks": [
  192. {
  193. "tags": {
  194. "builtin": "local"
  195. },
  196. "name": "CCLocal",
  197. "members": [
  198. {
  199. "name": "cc_matWorld",
  200. "typename": "mat4",
  201. "type": 25,
  202. "count": 1,
  203. "precision": "highp "
  204. },
  205. {
  206. "name": "cc_matWorldIT",
  207. "typename": "mat4",
  208. "type": 25,
  209. "count": 1,
  210. "precision": "highp "
  211. },
  212. {
  213. "name": "cc_lightingMapUVParam",
  214. "typename": "vec4",
  215. "type": 16,
  216. "count": 1,
  217. "precision": "highp "
  218. },
  219. {
  220. "name": "cc_localShadowBias",
  221. "typename": "vec4",
  222. "type": 16,
  223. "count": 1,
  224. "precision": "highp "
  225. },
  226. {
  227. "name": "cc_reflectionProbeData1",
  228. "typename": "vec4",
  229. "type": 16,
  230. "count": 1,
  231. "precision": "highp "
  232. },
  233. {
  234. "name": "cc_reflectionProbeData2",
  235. "typename": "vec4",
  236. "type": 16,
  237. "count": 1,
  238. "precision": "highp "
  239. },
  240. {
  241. "name": "cc_reflectionProbeBlendData1",
  242. "typename": "vec4",
  243. "type": 16,
  244. "count": 1,
  245. "precision": "highp "
  246. },
  247. {
  248. "name": "cc_reflectionProbeBlendData2",
  249. "typename": "vec4",
  250. "type": 16,
  251. "count": 1,
  252. "precision": "highp "
  253. }
  254. ],
  255. "defines": [],
  256. "stageFlags": 1
  257. }
  258. ],
  259. "samplerTextures": [],
  260. "samplers": [],
  261. "textures": [],
  262. "buffers": [],
  263. "images": [],
  264. "subpassInputs": []
  265. },
  266. {
  267. "rate": 1,
  268. "blocks": [
  269. {
  270. "name": "Constant",
  271. "members": [
  272. {
  273. "name": "mainColor",
  274. "type": 16,
  275. "count": 1
  276. },
  277. {
  278. "name": "cc_sh_linear_const_r",
  279. "type": 16,
  280. "count": 1
  281. },
  282. {
  283. "name": "cc_sh_linear_const_g",
  284. "type": 16,
  285. "count": 1
  286. },
  287. {
  288. "name": "cc_sh_linear_const_b",
  289. "type": 16,
  290. "count": 1
  291. },
  292. {
  293. "name": "cc_sh_quadratic_r",
  294. "type": 16,
  295. "count": 1
  296. },
  297. {
  298. "name": "cc_sh_quadratic_g",
  299. "type": 16,
  300. "count": 1
  301. },
  302. {
  303. "name": "cc_sh_quadratic_b",
  304. "type": 16,
  305. "count": 1
  306. },
  307. {
  308. "name": "cc_sh_quadratic_a",
  309. "type": 16,
  310. "count": 1
  311. }
  312. ],
  313. "defines": [],
  314. "stageFlags": 16,
  315. "binding": 0
  316. }
  317. ],
  318. "samplerTextures": [],
  319. "samplers": [],
  320. "textures": [],
  321. "buffers": [],
  322. "images": [],
  323. "subpassInputs": []
  324. },
  325. {
  326. "rate": 2,
  327. "blocks": [],
  328. "samplerTextures": [],
  329. "samplers": [],
  330. "textures": [],
  331. "buffers": [],
  332. "images": [],
  333. "subpassInputs": []
  334. },
  335. {
  336. "rate": 3,
  337. "blocks": [
  338. {
  339. "tags": {
  340. "builtin": "global"
  341. },
  342. "name": "CCGlobal",
  343. "members": [
  344. {
  345. "name": "cc_time",
  346. "typename": "vec4",
  347. "type": 16,
  348. "count": 1,
  349. "precision": "highp "
  350. },
  351. {
  352. "name": "cc_screenSize",
  353. "typename": "vec4",
  354. "type": 16,
  355. "count": 1,
  356. "precision": "mediump "
  357. },
  358. {
  359. "name": "cc_nativeSize",
  360. "typename": "vec4",
  361. "type": 16,
  362. "count": 1,
  363. "precision": "mediump "
  364. },
  365. {
  366. "name": "cc_probeInfo",
  367. "typename": "vec4",
  368. "type": 16,
  369. "count": 1,
  370. "precision": "mediump "
  371. },
  372. {
  373. "name": "cc_debug_view_mode",
  374. "typename": "vec4",
  375. "type": 16,
  376. "count": 1,
  377. "precision": "mediump "
  378. }
  379. ],
  380. "defines": [],
  381. "stageFlags": 17
  382. },
  383. {
  384. "tags": {
  385. "builtin": "global"
  386. },
  387. "name": "CCCamera",
  388. "members": [
  389. {
  390. "name": "cc_matView",
  391. "typename": "mat4",
  392. "type": 25,
  393. "count": 1,
  394. "precision": "highp "
  395. },
  396. {
  397. "name": "cc_matViewInv",
  398. "typename": "mat4",
  399. "type": 25,
  400. "count": 1,
  401. "precision": "highp "
  402. },
  403. {
  404. "name": "cc_matProj",
  405. "typename": "mat4",
  406. "type": 25,
  407. "count": 1,
  408. "precision": "highp "
  409. },
  410. {
  411. "name": "cc_matProjInv",
  412. "typename": "mat4",
  413. "type": 25,
  414. "count": 1,
  415. "precision": "highp "
  416. },
  417. {
  418. "name": "cc_matViewProj",
  419. "typename": "mat4",
  420. "type": 25,
  421. "count": 1,
  422. "precision": "highp "
  423. },
  424. {
  425. "name": "cc_matViewProjInv",
  426. "typename": "mat4",
  427. "type": 25,
  428. "count": 1,
  429. "precision": "highp "
  430. },
  431. {
  432. "name": "cc_cameraPos",
  433. "typename": "vec4",
  434. "type": 16,
  435. "count": 1,
  436. "precision": "highp "
  437. },
  438. {
  439. "name": "cc_surfaceTransform",
  440. "typename": "vec4",
  441. "type": 16,
  442. "count": 1,
  443. "precision": "mediump "
  444. },
  445. {
  446. "name": "cc_screenScale",
  447. "typename": "vec4",
  448. "type": 16,
  449. "count": 1,
  450. "precision": "mediump "
  451. },
  452. {
  453. "name": "cc_exposure",
  454. "typename": "vec4",
  455. "type": 16,
  456. "count": 1,
  457. "precision": "mediump "
  458. },
  459. {
  460. "name": "cc_mainLitDir",
  461. "typename": "vec4",
  462. "type": 16,
  463. "count": 1,
  464. "precision": "mediump "
  465. },
  466. {
  467. "name": "cc_mainLitColor",
  468. "typename": "vec4",
  469. "type": 16,
  470. "count": 1,
  471. "precision": "mediump "
  472. },
  473. {
  474. "name": "cc_ambientSky",
  475. "typename": "vec4",
  476. "type": 16,
  477. "count": 1,
  478. "precision": "mediump "
  479. },
  480. {
  481. "name": "cc_ambientGround",
  482. "typename": "vec4",
  483. "type": 16,
  484. "count": 1,
  485. "precision": "mediump "
  486. },
  487. {
  488. "name": "cc_fogColor",
  489. "typename": "vec4",
  490. "type": 16,
  491. "count": 1,
  492. "precision": "mediump "
  493. },
  494. {
  495. "name": "cc_fogBase",
  496. "typename": "vec4",
  497. "type": 16,
  498. "count": 1,
  499. "precision": "mediump "
  500. },
  501. {
  502. "name": "cc_fogAdd",
  503. "typename": "vec4",
  504. "type": 16,
  505. "count": 1,
  506. "precision": "mediump "
  507. },
  508. {
  509. "name": "cc_nearFar",
  510. "typename": "vec4",
  511. "type": 16,
  512. "count": 1,
  513. "precision": "mediump "
  514. },
  515. {
  516. "name": "cc_viewPort",
  517. "typename": "vec4",
  518. "type": 16,
  519. "count": 1,
  520. "precision": "mediump "
  521. }
  522. ],
  523. "defines": [],
  524. "stageFlags": 17
  525. }
  526. ],
  527. "samplerTextures": [],
  528. "samplers": [],
  529. "textures": [],
  530. "buffers": [],
  531. "images": [],
  532. "subpassInputs": []
  533. }
  534. ],
  535. "hash": 4208657580,
  536. "glsl4": {
  537. "vert": "\nprecision mediump float;\nlayout(set = 2, binding = 0) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n};\nlayout(set = 0, binding = 0) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(set = 0, binding = 1) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nlayout(location = 0) in vec3 a_position;\nlayout(location = 1) in vec3 a_normal;\nlayout(location = 0) out vec3 normal_w;\nlayout(location = 1) out vec3 pos_w;\nlayout(location = 2) out vec3 pos_l;\nlayout(location = 3) out vec3 right;\nlayout(location = 4) out vec3 up;\nlayout(location = 5) out vec3 forward;\nvec4 vert () {\n vec4 pos = vec4(a_position, 1);\n vec4 normal = vec4(a_normal, 0);\n pos_l = a_position;\n pos_w = (cc_matWorld * pos).xyz;\n normal_w = (cc_matWorldIT * normal).xyz;\n right = vec3(cc_matView[0][0], cc_matView[1][0], cc_matView[2][0]);\n up = vec3(cc_matView[0][1], cc_matView[1][1], cc_matView[2][1]);\n forward = vec3(cc_matView[0][2], cc_matView[1][2], cc_matView[2][2]);\n return cc_matProj * (cc_matView * cc_matWorld) * pos;\n}\nvoid main() { gl_Position = vert(); }",
  538. "frag": "\nprecision mediump float;\nmat3 transposeMat3 (mat3 v) {\n mat3 tmp;\n tmp[0] = vec3(v[0].x, v[1].x, v[2].x);\n tmp[1] = vec3(v[0].y, v[1].y, v[2].y);\n tmp[2] = vec3(v[0].z, v[1].z, v[2].z);\n return tmp;\n}\nvoid ClipQuadToHorizon (inout vec3 L[5], out int n) {\n int config = 0;\n if (L[0].z > 0.0) config += 1;\n if (L[1].z > 0.0) config += 2;\n if (L[2].z > 0.0) config += 4;\n if (L[3].z > 0.0) config += 8;\n config = 15;\n n = 0;\n if (config == 0)\n {\n }\n else if (config == 1) {\n n = 3;\n L[1] = -L[1].z * L[0] + L[0].z * L[1];\n L[2] = -L[3].z * L[0] + L[0].z * L[3];\n }\n else if (config == 2) {\n n = 3;\n L[0] = -L[0].z * L[1] + L[1].z * L[0];\n L[2] = -L[2].z * L[1] + L[1].z * L[2];\n }\n else if (config == 3) {\n n = 4;\n L[2] = -L[2].z * L[1] + L[1].z * L[2];\n L[3] = -L[3].z * L[0] + L[0].z * L[3];\n }\n else if (config == 4) {\n n = 3;\n L[0] = -L[3].z * L[2] + L[2].z * L[3];\n L[1] = -L[1].z * L[2] + L[2].z * L[1];\n }\n else if (config == 5) {\n n = 0;\n }\n else if (config == 6) {\n n = 4;\n L[0] = -L[0].z * L[1] + L[1].z * L[0];\n L[3] = -L[3].z * L[2] + L[2].z * L[3];\n }\n else if (config == 7) {\n n = 5;\n L[4] = -L[3].z * L[0] + L[0].z * L[3];\n L[3] = -L[3].z * L[2] + L[2].z * L[3];\n }\n else if (config == 8) {\n n = 3;\n L[0] = -L[0].z * L[3] + L[3].z * L[0];\n L[1] = -L[2].z * L[3] + L[3].z * L[2];\n L[2] = L[3];\n }\n else if (config == 9) {\n n = 4;\n L[1] = -L[1].z * L[0] + L[0].z * L[1];\n L[2] = -L[2].z * L[3] + L[3].z * L[2];\n }\n else if (config == 10) {\n n = 0;\n }\n else if (config == 11) {\n n = 5;\n L[4] = L[3];\n L[3] = -L[2].z * L[3] + L[3].z * L[2];\n L[2] = -L[2].z * L[1] + L[1].z * L[2];\n }\n else if (config == 12) {\n n = 4;\n L[1] = -L[1].z * L[2] + L[2].z * L[1];\n L[0] = -L[0].z * L[3] + L[3].z * L[0];\n }\n else if (config == 13) {\n n = 5;\n L[4] = L[3];\n L[3] = L[2];\n L[2] = -L[1].z * L[2] + L[2].z * L[1];\n L[1] = -L[1].z * L[0] + L[0].z * L[1];\n }\n else if (config == 14) {\n n = 5;\n L[4] = -L[0].z * L[3] + L[3].z * L[0];\n L[0] = -L[0].z * L[1] + L[1].z * L[0];\n }\n else if (config == 15) {\n n = 4;\n }\n if (n == 3) L[3] = L[0];\n if (n == 4) L[4] = L[0];\n}\nfloat IntegrateEdge (vec3 v1, vec3 v2) {\n float cosTheta = dot(v1, v2);\n float theta = acos(cosTheta);\n return cross(v1, v2).z * ((theta > 0.001) ? theta/sin(theta) : 4.0);\n}\nvec3 LTC_Evaluate (vec3 N, vec3 V, vec3 P, mat3 Minv, vec3 points[4]) {\n vec3 T1, T2;\n T1 = normalize(V - N*dot(V, N));\n T2 = cross(N, T1);\n Minv = Minv * transposeMat3(mat3(T1, T2, N));\n vec3 L[5];\n L[0] = Minv * (points[0] - P);\n L[1] = Minv * (points[1] - P);\n L[2] = Minv * (points[2] - P);\n L[3] = Minv * (points[3] - P);\n int n;\n ClipQuadToHorizon(L, n);\n if (n == 0) return vec3(0, 0, 0);\n L[0] = normalize(L[0]);\n L[1] = normalize(L[1]);\n L[2] = normalize(L[2]);\n L[3] = normalize(L[3]);\n L[4] = normalize(L[4]);\n float sum = 0.0;\n sum += IntegrateEdge(L[0], L[1]);\n sum += IntegrateEdge(L[1], L[2]);\n sum += IntegrateEdge(L[2], L[3]);\n if (n >= 4) sum += IntegrateEdge(L[3], L[4]);\n if (n == 5) sum += IntegrateEdge(L[4], L[0]);\n sum = max(0.0, sum);\n vec3 Lo_i = vec3(sum, sum, sum);\n return Lo_i;\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};\nvec3 LinearToSRGB(vec3 linear) {\n#ifdef CC_USE_SURFACE_SHADER\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC && CC_SURFACES_ENABLE_DEBUG_VIEW\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_GAMMA_CORRECTION) {\n return linear;\n }\n #endif\n#endif\n return sqrt(linear);\n}\n#if CC_USE_LIGHT_PROBE\n vec3 ACESToneMap (vec3 color) {\n color = min(color, vec3(8.0));\n const float A = 2.51;\n const float B = 0.03;\n const float C = 2.43;\n const float D = 0.59;\n const float E = 0.14;\n return (color * (A * color + B)) / (color * (C * color + D) + E);\n }\n vec4 packRGBE (vec3 rgb) {\n highp float maxComp = max(max(rgb.r, rgb.g), rgb.b);\n highp float e = 128.0;\n if (maxComp > 0.0001) {\n e = log(maxComp) / log(1.1);\n e = ceil(e);\n e = clamp(e + 128.0, 0.0, 255.0);\n }\n highp float sc = 1.0 / pow(1.1, e - 128.0);\n vec3 encode = clamp(rgb * sc, vec3(0.0), vec3(1.0)) * 255.0;\n vec3 encode_rounded = floor(encode) + step(encode - floor(encode), vec3(0.5));\n return vec4(encode_rounded, e) / 255.0;\n }\n vec4 CCFragOutput (vec4 color) {\n #if CC_USE_RGBE_OUTPUT\n color = packRGBE(color.rgb);\n #elif !CC_USE_FLOAT_OUTPUT\n #if CC_USE_HDR && CC_TONE_MAPPING_TYPE == HDR_TONE_MAPPING_ACES\n color.rgb = ACESToneMap(color.rgb);\n #endif\n color.rgb = LinearToSRGB(color.rgb);\n #endif\n return color;\n }\n#else\n vec4 CCFragOutput (vec4 color) {\n return color;\n }\n#endif\nlayout(location = 0) in vec3 normal_w;\nlayout(location = 1) in vec3 pos_w;\nlayout(location = 2) in vec3 pos_l;\nlayout(location = 3) in vec3 right;\nlayout(location = 4) in vec3 up;\nlayout(location = 5) in vec3 forward;\nlayout(set = 1, binding = 0) uniform Constant {\n vec4 mainColor;\n vec4 cc_sh_linear_const_r;\n vec4 cc_sh_linear_const_g;\n vec4 cc_sh_linear_const_b;\n vec4 cc_sh_quadratic_r;\n vec4 cc_sh_quadratic_g;\n vec4 cc_sh_quadratic_b;\n vec4 cc_sh_quadratic_a;\n};\n#if CC_USE_LIGHT_PROBE\n #if CC_USE_LIGHT_PROBE\n vec3 SHEvaluate(vec3 normal)\n {\n vec3 result;\n #if USE_INSTANCING\n vec4 normal4 = vec4(normal, 1.0);\n result.r = dot(v_sh_linear_const_r, normal4);\n result.g = dot(v_sh_linear_const_g, normal4);\n result.b = dot(v_sh_linear_const_b, normal4);\n #else\n vec4 normal4 = vec4(normal, 1.0);\n result.r = dot(cc_sh_linear_const_r, normal4);\n result.g = dot(cc_sh_linear_const_g, normal4);\n result.b = dot(cc_sh_linear_const_b, normal4);\n vec4 n14 = normal.xyzz * normal.yzzx;\n float n5 = normal.x * normal.x - normal.y * normal.y;\n result.r += dot(cc_sh_quadratic_r, n14);\n result.g += dot(cc_sh_quadratic_g, n14);\n result.b += dot(cc_sh_quadratic_b, n14);\n result += (cc_sh_quadratic_a.rgb * n5);\n #endif\n #if CC_USE_HDR\n result *= cc_exposure.w * cc_exposure.x;\n #endif\n return result;\n }\n #endif\n#endif\nvec4 gizmo_fs (float alpha) {\n #if CC_USE_LIGHT_PROBE\n vec3 N = normalize(normal_w) * (float(gl_FrontFacing) * 2.0 - 1.0);\n vec3 diffuse = SHEvaluate(N);\n #if USE_FORWARD_PIPELINE\n return CCFragOutput(vec4(diffuse, mainColor.a * alpha));\n #else\n return vec4(diffuse, mainColor.a * alpha);\n #endif\n #else\n vec3 N = normalize(normal_w) * (float(gl_FrontFacing) * 2.0 - 1.0);\n vec3 V = normalize(cc_cameraPos.xyz - pos_w);\n vec3 points [4];\n points[0] = (forward * 3.0 + right + up) * 40.0;\n points[1] = (forward * 3.0 - right + up) * 40.0;\n points[2] = (forward * 3.0 - right - up) * 40.0;\n points[3] = (forward * 3.0 + right - up) * 40.0;\n vec3 diffuse = LinearToSRGB(mainColor.rgb * LTC_Evaluate(N, V, pos_l, mat3(1), points));\n #if USE_FORWARD_PIPELINE\n return CCFragOutput(vec4(diffuse, mainColor.a * alpha));\n #else\n return vec4(diffuse, mainColor.a * alpha);\n #endif\n #endif\n}\nvec4 front () {\n return gizmo_fs(1.0);\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = front(); }"
  539. },
  540. "glsl3": {
  541. "vert": "\nprecision mediump float;\nlayout(std140) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n};\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};\nin vec3 a_position;\nin vec3 a_normal;\nout vec3 normal_w;\nout vec3 pos_w;\nout vec3 pos_l;\nout vec3 right;\nout vec3 up;\nout vec3 forward;\nvec4 vert () {\n vec4 pos = vec4(a_position, 1);\n vec4 normal = vec4(a_normal, 0);\n pos_l = a_position;\n pos_w = (cc_matWorld * pos).xyz;\n normal_w = (cc_matWorldIT * normal).xyz;\n right = vec3(cc_matView[0][0], cc_matView[1][0], cc_matView[2][0]);\n up = vec3(cc_matView[0][1], cc_matView[1][1], cc_matView[2][1]);\n forward = vec3(cc_matView[0][2], cc_matView[1][2], cc_matView[2][2]);\n return cc_matProj * (cc_matView * cc_matWorld) * pos;\n}\nvoid main() { gl_Position = vert(); }",
  542. "frag": "\nprecision mediump float;\nmat3 transposeMat3 (mat3 v) {\n mat3 tmp;\n tmp[0] = vec3(v[0].x, v[1].x, v[2].x);\n tmp[1] = vec3(v[0].y, v[1].y, v[2].y);\n tmp[2] = vec3(v[0].z, v[1].z, v[2].z);\n return tmp;\n}\nvoid ClipQuadToHorizon (inout vec3 L[5], out int n) {\n int config = 0;\n if (L[0].z > 0.0) config += 1;\n if (L[1].z > 0.0) config += 2;\n if (L[2].z > 0.0) config += 4;\n if (L[3].z > 0.0) config += 8;\n config = 15;\n n = 0;\n if (config == 0)\n {\n }\n else if (config == 1) {\n n = 3;\n L[1] = -L[1].z * L[0] + L[0].z * L[1];\n L[2] = -L[3].z * L[0] + L[0].z * L[3];\n }\n else if (config == 2) {\n n = 3;\n L[0] = -L[0].z * L[1] + L[1].z * L[0];\n L[2] = -L[2].z * L[1] + L[1].z * L[2];\n }\n else if (config == 3) {\n n = 4;\n L[2] = -L[2].z * L[1] + L[1].z * L[2];\n L[3] = -L[3].z * L[0] + L[0].z * L[3];\n }\n else if (config == 4) {\n n = 3;\n L[0] = -L[3].z * L[2] + L[2].z * L[3];\n L[1] = -L[1].z * L[2] + L[2].z * L[1];\n }\n else if (config == 5) {\n n = 0;\n }\n else if (config == 6) {\n n = 4;\n L[0] = -L[0].z * L[1] + L[1].z * L[0];\n L[3] = -L[3].z * L[2] + L[2].z * L[3];\n }\n else if (config == 7) {\n n = 5;\n L[4] = -L[3].z * L[0] + L[0].z * L[3];\n L[3] = -L[3].z * L[2] + L[2].z * L[3];\n }\n else if (config == 8) {\n n = 3;\n L[0] = -L[0].z * L[3] + L[3].z * L[0];\n L[1] = -L[2].z * L[3] + L[3].z * L[2];\n L[2] = L[3];\n }\n else if (config == 9) {\n n = 4;\n L[1] = -L[1].z * L[0] + L[0].z * L[1];\n L[2] = -L[2].z * L[3] + L[3].z * L[2];\n }\n else if (config == 10) {\n n = 0;\n }\n else if (config == 11) {\n n = 5;\n L[4] = L[3];\n L[3] = -L[2].z * L[3] + L[3].z * L[2];\n L[2] = -L[2].z * L[1] + L[1].z * L[2];\n }\n else if (config == 12) {\n n = 4;\n L[1] = -L[1].z * L[2] + L[2].z * L[1];\n L[0] = -L[0].z * L[3] + L[3].z * L[0];\n }\n else if (config == 13) {\n n = 5;\n L[4] = L[3];\n L[3] = L[2];\n L[2] = -L[1].z * L[2] + L[2].z * L[1];\n L[1] = -L[1].z * L[0] + L[0].z * L[1];\n }\n else if (config == 14) {\n n = 5;\n L[4] = -L[0].z * L[3] + L[3].z * L[0];\n L[0] = -L[0].z * L[1] + L[1].z * L[0];\n }\n else if (config == 15) {\n n = 4;\n }\n if (n == 3) L[3] = L[0];\n if (n == 4) L[4] = L[0];\n}\nfloat IntegrateEdge (vec3 v1, vec3 v2) {\n float cosTheta = dot(v1, v2);\n float theta = acos(cosTheta);\n return cross(v1, v2).z * ((theta > 0.001) ? theta/sin(theta) : 4.0);\n}\nvec3 LTC_Evaluate (vec3 N, vec3 V, vec3 P, mat3 Minv, vec3 points[4]) {\n vec3 T1, T2;\n T1 = normalize(V - N*dot(V, N));\n T2 = cross(N, T1);\n Minv = Minv * transposeMat3(mat3(T1, T2, N));\n vec3 L[5];\n L[0] = Minv * (points[0] - P);\n L[1] = Minv * (points[1] - P);\n L[2] = Minv * (points[2] - P);\n L[3] = Minv * (points[3] - P);\n int n;\n ClipQuadToHorizon(L, n);\n if (n == 0) return vec3(0, 0, 0);\n L[0] = normalize(L[0]);\n L[1] = normalize(L[1]);\n L[2] = normalize(L[2]);\n L[3] = normalize(L[3]);\n L[4] = normalize(L[4]);\n float sum = 0.0;\n sum += IntegrateEdge(L[0], L[1]);\n sum += IntegrateEdge(L[1], L[2]);\n sum += IntegrateEdge(L[2], L[3]);\n if (n >= 4) sum += IntegrateEdge(L[3], L[4]);\n if (n == 5) sum += IntegrateEdge(L[4], L[0]);\n sum = max(0.0, sum);\n vec3 Lo_i = vec3(sum, sum, sum);\n return Lo_i;\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};\nvec3 LinearToSRGB(vec3 linear) {\n#ifdef CC_USE_SURFACE_SHADER\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC && CC_SURFACES_ENABLE_DEBUG_VIEW\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_GAMMA_CORRECTION) {\n return linear;\n }\n #endif\n#endif\n return sqrt(linear);\n}\n#if CC_USE_LIGHT_PROBE\n vec3 ACESToneMap (vec3 color) {\n color = min(color, vec3(8.0));\n const float A = 2.51;\n const float B = 0.03;\n const float C = 2.43;\n const float D = 0.59;\n const float E = 0.14;\n return (color * (A * color + B)) / (color * (C * color + D) + E);\n }\n vec4 packRGBE (vec3 rgb) {\n highp float maxComp = max(max(rgb.r, rgb.g), rgb.b);\n highp float e = 128.0;\n if (maxComp > 0.0001) {\n e = log(maxComp) / log(1.1);\n e = ceil(e);\n e = clamp(e + 128.0, 0.0, 255.0);\n }\n highp float sc = 1.0 / pow(1.1, e - 128.0);\n vec3 encode = clamp(rgb * sc, vec3(0.0), vec3(1.0)) * 255.0;\n vec3 encode_rounded = floor(encode) + step(encode - floor(encode), vec3(0.5));\n return vec4(encode_rounded, e) / 255.0;\n }\n vec4 CCFragOutput (vec4 color) {\n #if CC_USE_RGBE_OUTPUT\n color = packRGBE(color.rgb);\n #elif !CC_USE_FLOAT_OUTPUT\n #if CC_USE_HDR && CC_TONE_MAPPING_TYPE == HDR_TONE_MAPPING_ACES\n color.rgb = ACESToneMap(color.rgb);\n #endif\n color.rgb = LinearToSRGB(color.rgb);\n #endif\n return color;\n }\n#else\n vec4 CCFragOutput (vec4 color) {\n return color;\n }\n#endif\nin vec3 normal_w;\nin vec3 pos_w;\nin vec3 pos_l;\nin vec3 right;\nin vec3 up;\nin vec3 forward;\nlayout(std140) uniform Constant {\n vec4 mainColor;\n vec4 cc_sh_linear_const_r;\n vec4 cc_sh_linear_const_g;\n vec4 cc_sh_linear_const_b;\n vec4 cc_sh_quadratic_r;\n vec4 cc_sh_quadratic_g;\n vec4 cc_sh_quadratic_b;\n vec4 cc_sh_quadratic_a;\n};\n#if CC_USE_LIGHT_PROBE\n #if CC_USE_LIGHT_PROBE\n vec3 SHEvaluate(vec3 normal)\n {\n vec3 result;\n #if USE_INSTANCING\n vec4 normal4 = vec4(normal, 1.0);\n result.r = dot(v_sh_linear_const_r, normal4);\n result.g = dot(v_sh_linear_const_g, normal4);\n result.b = dot(v_sh_linear_const_b, normal4);\n #else\n vec4 normal4 = vec4(normal, 1.0);\n result.r = dot(cc_sh_linear_const_r, normal4);\n result.g = dot(cc_sh_linear_const_g, normal4);\n result.b = dot(cc_sh_linear_const_b, normal4);\n vec4 n14 = normal.xyzz * normal.yzzx;\n float n5 = normal.x * normal.x - normal.y * normal.y;\n result.r += dot(cc_sh_quadratic_r, n14);\n result.g += dot(cc_sh_quadratic_g, n14);\n result.b += dot(cc_sh_quadratic_b, n14);\n result += (cc_sh_quadratic_a.rgb * n5);\n #endif\n #if CC_USE_HDR\n result *= cc_exposure.w * cc_exposure.x;\n #endif\n return result;\n }\n #endif\n#endif\nvec4 gizmo_fs (float alpha) {\n #if CC_USE_LIGHT_PROBE\n vec3 N = normalize(normal_w) * (float(gl_FrontFacing) * 2.0 - 1.0);\n vec3 diffuse = SHEvaluate(N);\n #if USE_FORWARD_PIPELINE\n return CCFragOutput(vec4(diffuse, mainColor.a * alpha));\n #else\n return vec4(diffuse, mainColor.a * alpha);\n #endif\n #else\n vec3 N = normalize(normal_w) * (float(gl_FrontFacing) * 2.0 - 1.0);\n vec3 V = normalize(cc_cameraPos.xyz - pos_w);\n vec3 points [4];\n points[0] = (forward * 3.0 + right + up) * 40.0;\n points[1] = (forward * 3.0 - right + up) * 40.0;\n points[2] = (forward * 3.0 - right - up) * 40.0;\n points[3] = (forward * 3.0 + right - up) * 40.0;\n vec3 diffuse = LinearToSRGB(mainColor.rgb * LTC_Evaluate(N, V, pos_l, mat3(1), points));\n #if USE_FORWARD_PIPELINE\n return CCFragOutput(vec4(diffuse, mainColor.a * alpha));\n #else\n return vec4(diffuse, mainColor.a * alpha);\n #endif\n #endif\n}\nvec4 front () {\n return gizmo_fs(1.0);\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = front(); }"
  543. },
  544. "glsl1": {
  545. "vert": "\nprecision mediump float;\nuniform highp mat4 cc_matWorld;\n uniform highp mat4 cc_matWorldIT;\nuniform highp mat4 cc_matView;\n uniform highp mat4 cc_matProj;\nattribute vec3 a_position;\nattribute vec3 a_normal;\nvarying vec3 normal_w;\nvarying vec3 pos_w;\nvarying vec3 pos_l;\nvarying vec3 right;\nvarying vec3 up;\nvarying vec3 forward;\nvec4 vert () {\n vec4 pos = vec4(a_position, 1);\n vec4 normal = vec4(a_normal, 0);\n pos_l = a_position;\n pos_w = (cc_matWorld * pos).xyz;\n normal_w = (cc_matWorldIT * normal).xyz;\n right = vec3(cc_matView[0][0], cc_matView[1][0], cc_matView[2][0]);\n up = vec3(cc_matView[0][1], cc_matView[1][1], cc_matView[2][1]);\n forward = vec3(cc_matView[0][2], cc_matView[1][2], cc_matView[2][2]);\n return cc_matProj * (cc_matView * cc_matWorld) * pos;\n}\nvoid main() { gl_Position = vert(); }",
  546. "frag": "\nprecision mediump float;\nmat3 transposeMat3 (mat3 v) {\n mat3 tmp;\n tmp[0] = vec3(v[0].x, v[1].x, v[2].x);\n tmp[1] = vec3(v[0].y, v[1].y, v[2].y);\n tmp[2] = vec3(v[0].z, v[1].z, v[2].z);\n return tmp;\n}\nvoid ClipQuadToHorizon (inout vec3 L[5], out int n) {\n int config = 0;\n if (L[0].z > 0.0) config += 1;\n if (L[1].z > 0.0) config += 2;\n if (L[2].z > 0.0) config += 4;\n if (L[3].z > 0.0) config += 8;\n config = 15;\n n = 0;\n if (config == 0)\n {\n }\n else if (config == 1) {\n n = 3;\n L[1] = -L[1].z * L[0] + L[0].z * L[1];\n L[2] = -L[3].z * L[0] + L[0].z * L[3];\n }\n else if (config == 2) {\n n = 3;\n L[0] = -L[0].z * L[1] + L[1].z * L[0];\n L[2] = -L[2].z * L[1] + L[1].z * L[2];\n }\n else if (config == 3) {\n n = 4;\n L[2] = -L[2].z * L[1] + L[1].z * L[2];\n L[3] = -L[3].z * L[0] + L[0].z * L[3];\n }\n else if (config == 4) {\n n = 3;\n L[0] = -L[3].z * L[2] + L[2].z * L[3];\n L[1] = -L[1].z * L[2] + L[2].z * L[1];\n }\n else if (config == 5) {\n n = 0;\n }\n else if (config == 6) {\n n = 4;\n L[0] = -L[0].z * L[1] + L[1].z * L[0];\n L[3] = -L[3].z * L[2] + L[2].z * L[3];\n }\n else if (config == 7) {\n n = 5;\n L[4] = -L[3].z * L[0] + L[0].z * L[3];\n L[3] = -L[3].z * L[2] + L[2].z * L[3];\n }\n else if (config == 8) {\n n = 3;\n L[0] = -L[0].z * L[3] + L[3].z * L[0];\n L[1] = -L[2].z * L[3] + L[3].z * L[2];\n L[2] = L[3];\n }\n else if (config == 9) {\n n = 4;\n L[1] = -L[1].z * L[0] + L[0].z * L[1];\n L[2] = -L[2].z * L[3] + L[3].z * L[2];\n }\n else if (config == 10) {\n n = 0;\n }\n else if (config == 11) {\n n = 5;\n L[4] = L[3];\n L[3] = -L[2].z * L[3] + L[3].z * L[2];\n L[2] = -L[2].z * L[1] + L[1].z * L[2];\n }\n else if (config == 12) {\n n = 4;\n L[1] = -L[1].z * L[2] + L[2].z * L[1];\n L[0] = -L[0].z * L[3] + L[3].z * L[0];\n }\n else if (config == 13) {\n n = 5;\n L[4] = L[3];\n L[3] = L[2];\n L[2] = -L[1].z * L[2] + L[2].z * L[1];\n L[1] = -L[1].z * L[0] + L[0].z * L[1];\n }\n else if (config == 14) {\n n = 5;\n L[4] = -L[0].z * L[3] + L[3].z * L[0];\n L[0] = -L[0].z * L[1] + L[1].z * L[0];\n }\n else if (config == 15) {\n n = 4;\n }\n if (n == 3) L[3] = L[0];\n if (n == 4) L[4] = L[0];\n}\nfloat IntegrateEdge (vec3 v1, vec3 v2) {\n float cosTheta = dot(v1, v2);\n float theta = acos(cosTheta);\n return cross(v1, v2).z * ((theta > 0.001) ? theta/sin(theta) : 4.0);\n}\nvec3 LTC_Evaluate (vec3 N, vec3 V, vec3 P, mat3 Minv, vec3 points[4]) {\n vec3 T1, T2;\n T1 = normalize(V - N*dot(V, N));\n T2 = cross(N, T1);\n Minv = Minv * transposeMat3(mat3(T1, T2, N));\n vec3 L[5];\n L[0] = Minv * (points[0] - P);\n L[1] = Minv * (points[1] - P);\n L[2] = Minv * (points[2] - P);\n L[3] = Minv * (points[3] - P);\n int n;\n ClipQuadToHorizon(L, n);\n if (n == 0) return vec3(0, 0, 0);\n L[0] = normalize(L[0]);\n L[1] = normalize(L[1]);\n L[2] = normalize(L[2]);\n L[3] = normalize(L[3]);\n L[4] = normalize(L[4]);\n float sum = 0.0;\n sum += IntegrateEdge(L[0], L[1]);\n sum += IntegrateEdge(L[1], L[2]);\n sum += IntegrateEdge(L[2], L[3]);\n if (n >= 4) sum += IntegrateEdge(L[3], L[4]);\n if (n == 5) sum += IntegrateEdge(L[4], L[0]);\n sum = max(0.0, sum);\n vec3 Lo_i = vec3(sum, sum, sum);\n return Lo_i;\n}\nuniform highp vec4 cc_cameraPos;\n uniform mediump vec4 cc_exposure;\nvec3 LinearToSRGB(vec3 linear) {\n#ifdef CC_USE_SURFACE_SHADER\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC && CC_SURFACES_ENABLE_DEBUG_VIEW\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_GAMMA_CORRECTION) {\n return linear;\n }\n #endif\n#endif\n return sqrt(linear);\n}\n#if CC_USE_LIGHT_PROBE\n vec3 ACESToneMap (vec3 color) {\n color = min(color, vec3(8.0));\n const float A = 2.51;\n const float B = 0.03;\n const float C = 2.43;\n const float D = 0.59;\n const float E = 0.14;\n return (color * (A * color + B)) / (color * (C * color + D) + E);\n }\n vec4 packRGBE (vec3 rgb) {\n highp float maxComp = max(max(rgb.r, rgb.g), rgb.b);\n highp float e = 128.0;\n if (maxComp > 0.0001) {\n e = log(maxComp) / log(1.1);\n e = ceil(e);\n e = clamp(e + 128.0, 0.0, 255.0);\n }\n highp float sc = 1.0 / pow(1.1, e - 128.0);\n vec3 encode = clamp(rgb * sc, vec3(0.0), vec3(1.0)) * 255.0;\n vec3 encode_rounded = floor(encode) + step(encode - floor(encode), vec3(0.5));\n return vec4(encode_rounded, e) / 255.0;\n }\n vec4 CCFragOutput (vec4 color) {\n #if CC_USE_RGBE_OUTPUT\n color = packRGBE(color.rgb);\n #elif !CC_USE_FLOAT_OUTPUT\n #if CC_USE_HDR && CC_TONE_MAPPING_TYPE == HDR_TONE_MAPPING_ACES\n color.rgb = ACESToneMap(color.rgb);\n #endif\n color.rgb = LinearToSRGB(color.rgb);\n #endif\n return color;\n }\n#else\n vec4 CCFragOutput (vec4 color) {\n return color;\n }\n#endif\nvarying vec3 normal_w;\nvarying vec3 pos_w;\nvarying vec3 pos_l;\nvarying vec3 right;\nvarying vec3 up;\nvarying vec3 forward;\n uniform vec4 mainColor;\n uniform vec4 cc_sh_linear_const_r;\n uniform vec4 cc_sh_linear_const_g;\n uniform vec4 cc_sh_linear_const_b;\n uniform vec4 cc_sh_quadratic_r;\n uniform vec4 cc_sh_quadratic_g;\n uniform vec4 cc_sh_quadratic_b;\n uniform vec4 cc_sh_quadratic_a;\n#if CC_USE_LIGHT_PROBE\n #if CC_USE_LIGHT_PROBE\n vec3 SHEvaluate(vec3 normal)\n {\n vec3 result;\n #if USE_INSTANCING\n vec4 normal4 = vec4(normal, 1.0);\n result.r = dot(v_sh_linear_const_r, normal4);\n result.g = dot(v_sh_linear_const_g, normal4);\n result.b = dot(v_sh_linear_const_b, normal4);\n #else\n vec4 normal4 = vec4(normal, 1.0);\n result.r = dot(cc_sh_linear_const_r, normal4);\n result.g = dot(cc_sh_linear_const_g, normal4);\n result.b = dot(cc_sh_linear_const_b, normal4);\n vec4 n14 = normal.xyzz * normal.yzzx;\n float n5 = normal.x * normal.x - normal.y * normal.y;\n result.r += dot(cc_sh_quadratic_r, n14);\n result.g += dot(cc_sh_quadratic_g, n14);\n result.b += dot(cc_sh_quadratic_b, n14);\n result += (cc_sh_quadratic_a.rgb * n5);\n #endif\n #if CC_USE_HDR\n result *= cc_exposure.w * cc_exposure.x;\n #endif\n return result;\n }\n #endif\n#endif\nvec4 gizmo_fs (float alpha) {\n #if CC_USE_LIGHT_PROBE\n vec3 N = normalize(normal_w) * (float(gl_FrontFacing) * 2.0 - 1.0);\n vec3 diffuse = SHEvaluate(N);\n #if USE_FORWARD_PIPELINE\n return CCFragOutput(vec4(diffuse, mainColor.a * alpha));\n #else\n return vec4(diffuse, mainColor.a * alpha);\n #endif\n #else\n vec3 N = normalize(normal_w) * (float(gl_FrontFacing) * 2.0 - 1.0);\n vec3 V = normalize(cc_cameraPos.xyz - pos_w);\n vec3 points [4];\n points[0] = (forward * 3.0 + right + up) * 40.0;\n points[1] = (forward * 3.0 - right + up) * 40.0;\n points[2] = (forward * 3.0 - right - up) * 40.0;\n points[3] = (forward * 3.0 + right - up) * 40.0;\n vec3 diffuse = LinearToSRGB(mainColor.rgb * LTC_Evaluate(N, V, pos_l, mat3(1), points));\n #if USE_FORWARD_PIPELINE\n return CCFragOutput(vec4(diffuse, mainColor.a * alpha));\n #else\n return vec4(diffuse, mainColor.a * alpha);\n #endif\n #endif\n}\nvec4 front () {\n return gizmo_fs(1.0);\n}\nvoid main() { gl_FragColor = front(); }"
  547. },
  548. "builtins": {
  549. "globals": {
  550. "blocks": [
  551. {
  552. "name": "CCGlobal",
  553. "defines": []
  554. },
  555. {
  556. "name": "CCCamera",
  557. "defines": []
  558. }
  559. ],
  560. "samplerTextures": [],
  561. "buffers": [],
  562. "images": []
  563. },
  564. "locals": {
  565. "blocks": [
  566. {
  567. "name": "CCLocal",
  568. "defines": []
  569. }
  570. ],
  571. "samplerTextures": [],
  572. "buffers": [],
  573. "images": []
  574. },
  575. "statistics": {
  576. "CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS": 56,
  577. "CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS": 50
  578. }
  579. },
  580. "defines": [
  581. {
  582. "name": "CC_USE_DEBUG_VIEW",
  583. "type": "number",
  584. "defines": [],
  585. "range": [
  586. 0,
  587. 3
  588. ]
  589. },
  590. {
  591. "name": "CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC",
  592. "type": "boolean",
  593. "defines": [
  594. "CC_USE_DEBUG_VIEW"
  595. ]
  596. },
  597. {
  598. "name": "CC_SURFACES_ENABLE_DEBUG_VIEW",
  599. "type": "boolean",
  600. "defines": [
  601. "CC_USE_DEBUG_VIEW",
  602. "CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC"
  603. ]
  604. },
  605. {
  606. "name": "CC_USE_LIGHT_PROBE",
  607. "type": "boolean",
  608. "defines": [],
  609. "default": 0
  610. },
  611. {
  612. "name": "CC_USE_RGBE_OUTPUT",
  613. "type": "boolean",
  614. "defines": [
  615. "CC_USE_LIGHT_PROBE"
  616. ]
  617. },
  618. {
  619. "name": "CC_USE_FLOAT_OUTPUT",
  620. "type": "boolean",
  621. "defines": [
  622. "CC_USE_LIGHT_PROBE",
  623. "!CC_USE_RGBE_OUTPUT"
  624. ]
  625. },
  626. {
  627. "name": "CC_USE_HDR",
  628. "type": "boolean",
  629. "defines": [
  630. "CC_USE_LIGHT_PROBE",
  631. "CC_USE_LIGHT_PROBE"
  632. ]
  633. },
  634. {
  635. "name": "CC_TONE_MAPPING_TYPE",
  636. "type": "number",
  637. "defines": [
  638. "CC_USE_HDR",
  639. "CC_USE_LIGHT_PROBE",
  640. "!CC_USE_RGBE_OUTPUT",
  641. "!CC_USE_FLOAT_OUTPUT"
  642. ],
  643. "range": [
  644. 0,
  645. 3
  646. ]
  647. },
  648. {
  649. "name": "HDR_TONE_MAPPING_ACES",
  650. "type": "boolean",
  651. "defines": [
  652. "CC_USE_HDR",
  653. "CC_TONE_MAPPING_TYPE",
  654. "CC_USE_LIGHT_PROBE",
  655. "!CC_USE_RGBE_OUTPUT",
  656. "!CC_USE_FLOAT_OUTPUT"
  657. ]
  658. },
  659. {
  660. "name": "USE_INSTANCING",
  661. "type": "boolean",
  662. "defines": [
  663. "CC_USE_LIGHT_PROBE",
  664. "CC_USE_LIGHT_PROBE"
  665. ]
  666. },
  667. {
  668. "name": "USE_FORWARD_PIPELINE",
  669. "type": "boolean",
  670. "defines": [
  671. "CC_USE_LIGHT_PROBE"
  672. ]
  673. }
  674. ],
  675. "name": "internal/editor/light-probe-visualization|gizmo-vs:vert|gizmo-fs:front"
  676. },
  677. {
  678. "blocks": [
  679. {
  680. "name": "Constant",
  681. "members": [
  682. {
  683. "name": "mainColor",
  684. "type": 16,
  685. "count": 1
  686. },
  687. {
  688. "name": "cc_sh_linear_const_r",
  689. "type": 16,
  690. "count": 1
  691. },
  692. {
  693. "name": "cc_sh_linear_const_g",
  694. "type": 16,
  695. "count": 1
  696. },
  697. {
  698. "name": "cc_sh_linear_const_b",
  699. "type": 16,
  700. "count": 1
  701. },
  702. {
  703. "name": "cc_sh_quadratic_r",
  704. "type": 16,
  705. "count": 1
  706. },
  707. {
  708. "name": "cc_sh_quadratic_g",
  709. "type": 16,
  710. "count": 1
  711. },
  712. {
  713. "name": "cc_sh_quadratic_b",
  714. "type": 16,
  715. "count": 1
  716. },
  717. {
  718. "name": "cc_sh_quadratic_a",
  719. "type": 16,
  720. "count": 1
  721. }
  722. ],
  723. "defines": [],
  724. "stageFlags": 16,
  725. "binding": 0
  726. }
  727. ],
  728. "samplerTextures": [],
  729. "samplers": [],
  730. "textures": [],
  731. "buffers": [],
  732. "images": [],
  733. "subpassInputs": [],
  734. "attributes": [
  735. {
  736. "name": "a_position",
  737. "defines": [],
  738. "format": 32,
  739. "location": 0
  740. },
  741. {
  742. "name": "a_normal",
  743. "defines": [],
  744. "format": 32,
  745. "location": 1
  746. }
  747. ],
  748. "varyings": [
  749. {
  750. "name": "normal_w",
  751. "type": 15,
  752. "count": 1,
  753. "defines": [],
  754. "stageFlags": 17,
  755. "location": 0
  756. },
  757. {
  758. "name": "pos_w",
  759. "type": 15,
  760. "count": 1,
  761. "defines": [],
  762. "stageFlags": 17,
  763. "location": 1
  764. },
  765. {
  766. "name": "pos_l",
  767. "type": 15,
  768. "count": 1,
  769. "defines": [],
  770. "stageFlags": 17,
  771. "location": 2
  772. },
  773. {
  774. "name": "right",
  775. "type": 15,
  776. "count": 1,
  777. "defines": [],
  778. "stageFlags": 17,
  779. "location": 3
  780. },
  781. {
  782. "name": "up",
  783. "type": 15,
  784. "count": 1,
  785. "defines": [],
  786. "stageFlags": 17,
  787. "location": 4
  788. },
  789. {
  790. "name": "forward",
  791. "type": 15,
  792. "count": 1,
  793. "defines": [],
  794. "stageFlags": 17,
  795. "location": 5
  796. }
  797. ],
  798. "fragColors": [
  799. {
  800. "name": "cc_FragColor",
  801. "typename": "vec4",
  802. "type": 16,
  803. "count": 1,
  804. "defines": [],
  805. "stageFlags": 16,
  806. "location": 0
  807. }
  808. ],
  809. "descriptors": [
  810. {
  811. "rate": 0,
  812. "blocks": [
  813. {
  814. "tags": {
  815. "builtin": "local"
  816. },
  817. "name": "CCLocal",
  818. "members": [
  819. {
  820. "name": "cc_matWorld",
  821. "typename": "mat4",
  822. "type": 25,
  823. "count": 1,
  824. "precision": "highp "
  825. },
  826. {
  827. "name": "cc_matWorldIT",
  828. "typename": "mat4",
  829. "type": 25,
  830. "count": 1,
  831. "precision": "highp "
  832. },
  833. {
  834. "name": "cc_lightingMapUVParam",
  835. "typename": "vec4",
  836. "type": 16,
  837. "count": 1,
  838. "precision": "highp "
  839. },
  840. {
  841. "name": "cc_localShadowBias",
  842. "typename": "vec4",
  843. "type": 16,
  844. "count": 1,
  845. "precision": "highp "
  846. },
  847. {
  848. "name": "cc_reflectionProbeData1",
  849. "typename": "vec4",
  850. "type": 16,
  851. "count": 1,
  852. "precision": "highp "
  853. },
  854. {
  855. "name": "cc_reflectionProbeData2",
  856. "typename": "vec4",
  857. "type": 16,
  858. "count": 1,
  859. "precision": "highp "
  860. },
  861. {
  862. "name": "cc_reflectionProbeBlendData1",
  863. "typename": "vec4",
  864. "type": 16,
  865. "count": 1,
  866. "precision": "highp "
  867. },
  868. {
  869. "name": "cc_reflectionProbeBlendData2",
  870. "typename": "vec4",
  871. "type": 16,
  872. "count": 1,
  873. "precision": "highp "
  874. }
  875. ],
  876. "defines": [],
  877. "stageFlags": 1
  878. }
  879. ],
  880. "samplerTextures": [],
  881. "samplers": [],
  882. "textures": [],
  883. "buffers": [],
  884. "images": [],
  885. "subpassInputs": []
  886. },
  887. {
  888. "rate": 1,
  889. "blocks": [
  890. {
  891. "name": "Constant",
  892. "members": [
  893. {
  894. "name": "mainColor",
  895. "type": 16,
  896. "count": 1
  897. },
  898. {
  899. "name": "cc_sh_linear_const_r",
  900. "type": 16,
  901. "count": 1
  902. },
  903. {
  904. "name": "cc_sh_linear_const_g",
  905. "type": 16,
  906. "count": 1
  907. },
  908. {
  909. "name": "cc_sh_linear_const_b",
  910. "type": 16,
  911. "count": 1
  912. },
  913. {
  914. "name": "cc_sh_quadratic_r",
  915. "type": 16,
  916. "count": 1
  917. },
  918. {
  919. "name": "cc_sh_quadratic_g",
  920. "type": 16,
  921. "count": 1
  922. },
  923. {
  924. "name": "cc_sh_quadratic_b",
  925. "type": 16,
  926. "count": 1
  927. },
  928. {
  929. "name": "cc_sh_quadratic_a",
  930. "type": 16,
  931. "count": 1
  932. }
  933. ],
  934. "defines": [],
  935. "stageFlags": 16,
  936. "binding": 0
  937. }
  938. ],
  939. "samplerTextures": [],
  940. "samplers": [],
  941. "textures": [],
  942. "buffers": [],
  943. "images": [],
  944. "subpassInputs": []
  945. },
  946. {
  947. "rate": 2,
  948. "blocks": [],
  949. "samplerTextures": [],
  950. "samplers": [],
  951. "textures": [],
  952. "buffers": [],
  953. "images": [],
  954. "subpassInputs": []
  955. },
  956. {
  957. "rate": 3,
  958. "blocks": [
  959. {
  960. "tags": {
  961. "builtin": "global"
  962. },
  963. "name": "CCGlobal",
  964. "members": [
  965. {
  966. "name": "cc_time",
  967. "typename": "vec4",
  968. "type": 16,
  969. "count": 1,
  970. "precision": "highp "
  971. },
  972. {
  973. "name": "cc_screenSize",
  974. "typename": "vec4",
  975. "type": 16,
  976. "count": 1,
  977. "precision": "mediump "
  978. },
  979. {
  980. "name": "cc_nativeSize",
  981. "typename": "vec4",
  982. "type": 16,
  983. "count": 1,
  984. "precision": "mediump "
  985. },
  986. {
  987. "name": "cc_probeInfo",
  988. "typename": "vec4",
  989. "type": 16,
  990. "count": 1,
  991. "precision": "mediump "
  992. },
  993. {
  994. "name": "cc_debug_view_mode",
  995. "typename": "vec4",
  996. "type": 16,
  997. "count": 1,
  998. "precision": "mediump "
  999. }
  1000. ],
  1001. "defines": [],
  1002. "stageFlags": 17
  1003. },
  1004. {
  1005. "tags": {
  1006. "builtin": "global"
  1007. },
  1008. "name": "CCCamera",
  1009. "members": [
  1010. {
  1011. "name": "cc_matView",
  1012. "typename": "mat4",
  1013. "type": 25,
  1014. "count": 1,
  1015. "precision": "highp "
  1016. },
  1017. {
  1018. "name": "cc_matViewInv",
  1019. "typename": "mat4",
  1020. "type": 25,
  1021. "count": 1,
  1022. "precision": "highp "
  1023. },
  1024. {
  1025. "name": "cc_matProj",
  1026. "typename": "mat4",
  1027. "type": 25,
  1028. "count": 1,
  1029. "precision": "highp "
  1030. },
  1031. {
  1032. "name": "cc_matProjInv",
  1033. "typename": "mat4",
  1034. "type": 25,
  1035. "count": 1,
  1036. "precision": "highp "
  1037. },
  1038. {
  1039. "name": "cc_matViewProj",
  1040. "typename": "mat4",
  1041. "type": 25,
  1042. "count": 1,
  1043. "precision": "highp "
  1044. },
  1045. {
  1046. "name": "cc_matViewProjInv",
  1047. "typename": "mat4",
  1048. "type": 25,
  1049. "count": 1,
  1050. "precision": "highp "
  1051. },
  1052. {
  1053. "name": "cc_cameraPos",
  1054. "typename": "vec4",
  1055. "type": 16,
  1056. "count": 1,
  1057. "precision": "highp "
  1058. },
  1059. {
  1060. "name": "cc_surfaceTransform",
  1061. "typename": "vec4",
  1062. "type": 16,
  1063. "count": 1,
  1064. "precision": "mediump "
  1065. },
  1066. {
  1067. "name": "cc_screenScale",
  1068. "typename": "vec4",
  1069. "type": 16,
  1070. "count": 1,
  1071. "precision": "mediump "
  1072. },
  1073. {
  1074. "name": "cc_exposure",
  1075. "typename": "vec4",
  1076. "type": 16,
  1077. "count": 1,
  1078. "precision": "mediump "
  1079. },
  1080. {
  1081. "name": "cc_mainLitDir",
  1082. "typename": "vec4",
  1083. "type": 16,
  1084. "count": 1,
  1085. "precision": "mediump "
  1086. },
  1087. {
  1088. "name": "cc_mainLitColor",
  1089. "typename": "vec4",
  1090. "type": 16,
  1091. "count": 1,
  1092. "precision": "mediump "
  1093. },
  1094. {
  1095. "name": "cc_ambientSky",
  1096. "typename": "vec4",
  1097. "type": 16,
  1098. "count": 1,
  1099. "precision": "mediump "
  1100. },
  1101. {
  1102. "name": "cc_ambientGround",
  1103. "typename": "vec4",
  1104. "type": 16,
  1105. "count": 1,
  1106. "precision": "mediump "
  1107. },
  1108. {
  1109. "name": "cc_fogColor",
  1110. "typename": "vec4",
  1111. "type": 16,
  1112. "count": 1,
  1113. "precision": "mediump "
  1114. },
  1115. {
  1116. "name": "cc_fogBase",
  1117. "typename": "vec4",
  1118. "type": 16,
  1119. "count": 1,
  1120. "precision": "mediump "
  1121. },
  1122. {
  1123. "name": "cc_fogAdd",
  1124. "typename": "vec4",
  1125. "type": 16,
  1126. "count": 1,
  1127. "precision": "mediump "
  1128. },
  1129. {
  1130. "name": "cc_nearFar",
  1131. "typename": "vec4",
  1132. "type": 16,
  1133. "count": 1,
  1134. "precision": "mediump "
  1135. },
  1136. {
  1137. "name": "cc_viewPort",
  1138. "typename": "vec4",
  1139. "type": 16,
  1140. "count": 1,
  1141. "precision": "mediump "
  1142. }
  1143. ],
  1144. "defines": [],
  1145. "stageFlags": 17
  1146. }
  1147. ],
  1148. "samplerTextures": [],
  1149. "samplers": [],
  1150. "textures": [],
  1151. "buffers": [],
  1152. "images": [],
  1153. "subpassInputs": []
  1154. }
  1155. ],
  1156. "hash": 2568219391,
  1157. "glsl4": {
  1158. "vert": "\nprecision mediump float;\nlayout(set = 2, binding = 0) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n};\nlayout(set = 0, binding = 0) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_probeInfo;\n mediump vec4 cc_debug_view_mode;\n};\nlayout(set = 0, binding = 1) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nlayout(location = 0) in vec3 a_position;\nlayout(location = 1) in vec3 a_normal;\nlayout(location = 0) out vec3 normal_w;\nlayout(location = 1) out vec3 pos_w;\nlayout(location = 2) out vec3 pos_l;\nlayout(location = 3) out vec3 right;\nlayout(location = 4) out vec3 up;\nlayout(location = 5) out vec3 forward;\nvec4 vert () {\n vec4 pos = vec4(a_position, 1);\n vec4 normal = vec4(a_normal, 0);\n pos_l = a_position;\n pos_w = (cc_matWorld * pos).xyz;\n normal_w = (cc_matWorldIT * normal).xyz;\n right = vec3(cc_matView[0][0], cc_matView[1][0], cc_matView[2][0]);\n up = vec3(cc_matView[0][1], cc_matView[1][1], cc_matView[2][1]);\n forward = vec3(cc_matView[0][2], cc_matView[1][2], cc_matView[2][2]);\n return cc_matProj * (cc_matView * cc_matWorld) * pos;\n}\nvoid main() { gl_Position = vert(); }",
  1159. "frag": "\nprecision mediump float;\nmat3 transposeMat3 (mat3 v) {\n mat3 tmp;\n tmp[0] = vec3(v[0].x, v[1].x, v[2].x);\n tmp[1] = vec3(v[0].y, v[1].y, v[2].y);\n tmp[2] = vec3(v[0].z, v[1].z, v[2].z);\n return tmp;\n}\nvoid ClipQuadToHorizon (inout vec3 L[5], out int n) {\n int config = 0;\n if (L[0].z > 0.0) config += 1;\n if (L[1].z > 0.0) config += 2;\n if (L[2].z > 0.0) config += 4;\n if (L[3].z > 0.0) config += 8;\n config = 15;\n n = 0;\n if (config == 0)\n {\n }\n else if (config == 1) {\n n = 3;\n L[1] = -L[1].z * L[0] + L[0].z * L[1];\n L[2] = -L[3].z * L[0] + L[0].z * L[3];\n }\n else if (config == 2) {\n n = 3;\n L[0] = -L[0].z * L[1] + L[1].z * L[0];\n L[2] = -L[2].z * L[1] + L[1].z * L[2];\n }\n else if (config == 3) {\n n = 4;\n L[2] = -L[2].z * L[1] + L[1].z * L[2];\n L[3] = -L[3].z * L[0] + L[0].z * L[3];\n }\n else if (config == 4) {\n n = 3;\n L[0] = -L[3].z * L[2] + L[2].z * L[3];\n L[1] = -L[1].z * L[2] + L[2].z * L[1];\n }\n else if (config == 5) {\n n = 0;\n }\n else if (config == 6) {\n n = 4;\n L[0] = -L[0].z * L[1] + L[1].z * L[0];\n L[3] = -L[3].z * L[2] + L[2].z * L[3];\n }\n else if (config == 7) {\n n = 5;\n L[4] = -L[3].z * L[0] + L[0].z * L[3];\n L[3] = -L[3].z * L[2] + L[2].z * L[3];\n }\n else if (config == 8) {\n n = 3;\n L[0] = -L[0].z * L[3] + L[3].z * L[0];\n L[1] = -L[2].z * L[3] + L[3].z * L[2];\n L[2] = L[3];\n }\n else if (config == 9) {\n n = 4;\n L[1] = -L[1].z * L[0] + L[0].z * L[1];\n L[2] = -L[2].z * L[3] + L[3].z * L[2];\n }\n else if (config == 10) {\n n = 0;\n }\n else if (config == 11) {\n n = 5;\n L[4] = L[3];\n L[3] = -L[2].z * L[3] + L[3].z * L[2];\n L[2] = -L[2].z * L[1] + L[1].z * L[2];\n }\n else if (config == 12) {\n n = 4;\n L[1] = -L[1].z * L[2] + L[2].z * L[1];\n L[0] = -L[0].z * L[3] + L[3].z * L[0];\n }\n else if (config == 13) {\n n = 5;\n L[4] = L[3];\n L[3] = L[2];\n L[2] = -L[1].z * L[2] + L[2].z * L[1];\n L[1] = -L[1].z * L[0] + L[0].z * L[1];\n }\n else if (config == 14) {\n n = 5;\n L[4] = -L[0].z * L[3] + L[3].z * L[0];\n L[0] = -L[0].z * L[1] + L[1].z * L[0];\n }\n else if (config == 15) {\n n = 4;\n }\n if (n == 3) L[3] = L[0];\n if (n == 4) L[4] = L[0];\n}\nfloat IntegrateEdge (vec3 v1, vec3 v2) {\n float cosTheta = dot(v1, v2);\n float theta = acos(cosTheta);\n return cross(v1, v2).z * ((theta > 0.001) ? theta/sin(theta) : 4.0);\n}\nvec3 LTC_Evaluate (vec3 N, vec3 V, vec3 P, mat3 Minv, vec3 points[4]) {\n vec3 T1, T2;\n T1 = normalize(V - N*dot(V, N));\n T2 = cross(N, T1);\n Minv = Minv * transposeMat3(mat3(T1, T2, N));\n vec3 L[5];\n L[0] = Minv * (points[0] - P);\n L[1] = Minv * (points[1] - P);\n L[2] = Minv * (points[2] - P);\n L[3] = Minv * (points[3] - P);\n int n;\n ClipQuadToHorizon(L, n);\n if (n == 0) return vec3(0, 0, 0);\n L[0] = normalize(L[0]);\n L[1] = normalize(L[1]);\n L[2] = normalize(L[2]);\n L[3] = normalize(L[3]);\n L[4] = normalize(L[4]);\n float sum = 0.0;\n sum += IntegrateEdge(L[0], L[1]);\n sum += IntegrateEdge(L[1], L[2]);\n sum += IntegrateEdge(L[2], L[3]);\n if (n >= 4) sum += IntegrateEdge(L[3], L[4]);\n if (n == 5) sum += IntegrateEdge(L[4], L[0]);\n sum = max(0.0, sum);\n vec3 Lo_i = vec3(sum, sum, sum);\n return Lo_i;\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};\nvec3 LinearToSRGB(vec3 linear) {\n#ifdef CC_USE_SURFACE_SHADER\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC && CC_SURFACES_ENABLE_DEBUG_VIEW\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_GAMMA_CORRECTION) {\n return linear;\n }\n #endif\n#endif\n return sqrt(linear);\n}\n#if CC_USE_LIGHT_PROBE\n vec3 ACESToneMap (vec3 color) {\n color = min(color, vec3(8.0));\n const float A = 2.51;\n const float B = 0.03;\n const float C = 2.43;\n const float D = 0.59;\n const float E = 0.14;\n return (color * (A * color + B)) / (color * (C * color + D) + E);\n }\n vec4 packRGBE (vec3 rgb) {\n highp float maxComp = max(max(rgb.r, rgb.g), rgb.b);\n highp float e = 128.0;\n if (maxComp > 0.0001) {\n e = log(maxComp) / log(1.1);\n e = ceil(e);\n e = clamp(e + 128.0, 0.0, 255.0);\n }\n highp float sc = 1.0 / pow(1.1, e - 128.0);\n vec3 encode = clamp(rgb * sc, vec3(0.0), vec3(1.0)) * 255.0;\n vec3 encode_rounded = floor(encode) + step(encode - floor(encode), vec3(0.5));\n return vec4(encode_rounded, e) / 255.0;\n }\n vec4 CCFragOutput (vec4 color) {\n #if CC_USE_RGBE_OUTPUT\n color = packRGBE(color.rgb);\n #elif !CC_USE_FLOAT_OUTPUT\n #if CC_USE_HDR && CC_TONE_MAPPING_TYPE == HDR_TONE_MAPPING_ACES\n color.rgb = ACESToneMap(color.rgb);\n #endif\n color.rgb = LinearToSRGB(color.rgb);\n #endif\n return color;\n }\n#else\n vec4 CCFragOutput (vec4 color) {\n return color;\n }\n#endif\nlayout(location = 0) in vec3 normal_w;\nlayout(location = 1) in vec3 pos_w;\nlayout(location = 2) in vec3 pos_l;\nlayout(location = 3) in vec3 right;\nlayout(location = 4) in vec3 up;\nlayout(location = 5) in vec3 forward;\nlayout(set = 1, binding = 0) uniform Constant {\n vec4 mainColor;\n vec4 cc_sh_linear_const_r;\n vec4 cc_sh_linear_const_g;\n vec4 cc_sh_linear_const_b;\n vec4 cc_sh_quadratic_r;\n vec4 cc_sh_quadratic_g;\n vec4 cc_sh_quadratic_b;\n vec4 cc_sh_quadratic_a;\n};\n#if CC_USE_LIGHT_PROBE\n #if CC_USE_LIGHT_PROBE\n vec3 SHEvaluate(vec3 normal)\n {\n vec3 result;\n #if USE_INSTANCING\n vec4 normal4 = vec4(normal, 1.0);\n result.r = dot(v_sh_linear_const_r, normal4);\n result.g = dot(v_sh_linear_const_g, normal4);\n result.b = dot(v_sh_linear_const_b, normal4);\n #else\n vec4 normal4 = vec4(normal, 1.0);\n result.r = dot(cc_sh_linear_const_r, normal4);\n result.g = dot(cc_sh_linear_const_g, normal4);\n result.b = dot(cc_sh_linear_const_b, normal4);\n vec4 n14 = normal.xyzz * normal.yzzx;\n float n5 = normal.x * normal.x - normal.y * normal.y;\n result.r += dot(cc_sh_quadratic_r, n14);\n result.g += dot(cc_sh_quadratic_g, n14);\n result.b += dot(cc_sh_quadratic_b, n14);\n result += (cc_sh_quadratic_a.rgb * n5);\n #endif\n #if CC_USE_HDR\n result *= cc_exposure.w * cc_exposure.x;\n #endif\n return result;\n }\n #endif\n#endif\nvec4 gizmo_fs (float alpha) {\n #if CC_USE_LIGHT_PROBE\n vec3 N = normalize(normal_w) * (float(gl_FrontFacing) * 2.0 - 1.0);\n vec3 diffuse = SHEvaluate(N);\n #if USE_FORWARD_PIPELINE\n return CCFragOutput(vec4(diffuse, mainColor.a * alpha));\n #else\n return vec4(diffuse, mainColor.a * alpha);\n #endif\n #else\n vec3 N = normalize(normal_w) * (float(gl_FrontFacing) * 2.0 - 1.0);\n vec3 V = normalize(cc_cameraPos.xyz - pos_w);\n vec3 points [4];\n points[0] = (forward * 3.0 + right + up) * 40.0;\n points[1] = (forward * 3.0 - right + up) * 40.0;\n points[2] = (forward * 3.0 - right - up) * 40.0;\n points[3] = (forward * 3.0 + right - up) * 40.0;\n vec3 diffuse = LinearToSRGB(mainColor.rgb * LTC_Evaluate(N, V, pos_l, mat3(1), points));\n #if USE_FORWARD_PIPELINE\n return CCFragOutput(vec4(diffuse, mainColor.a * alpha));\n #else\n return vec4(diffuse, mainColor.a * alpha);\n #endif\n #endif\n}\nvec4 back () {\n return gizmo_fs(0.2);\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = back(); }"
  1160. },
  1161. "glsl3": {
  1162. "vert": "\nprecision mediump float;\nlayout(std140) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n highp vec4 cc_reflectionProbeData1;\n highp vec4 cc_reflectionProbeData2;\n highp vec4 cc_reflectionProbeBlendData1;\n highp vec4 cc_reflectionProbeBlendData2;\n};\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};\nin vec3 a_position;\nin vec3 a_normal;\nout vec3 normal_w;\nout vec3 pos_w;\nout vec3 pos_l;\nout vec3 right;\nout vec3 up;\nout vec3 forward;\nvec4 vert () {\n vec4 pos = vec4(a_position, 1);\n vec4 normal = vec4(a_normal, 0);\n pos_l = a_position;\n pos_w = (cc_matWorld * pos).xyz;\n normal_w = (cc_matWorldIT * normal).xyz;\n right = vec3(cc_matView[0][0], cc_matView[1][0], cc_matView[2][0]);\n up = vec3(cc_matView[0][1], cc_matView[1][1], cc_matView[2][1]);\n forward = vec3(cc_matView[0][2], cc_matView[1][2], cc_matView[2][2]);\n return cc_matProj * (cc_matView * cc_matWorld) * pos;\n}\nvoid main() { gl_Position = vert(); }",
  1163. "frag": "\nprecision mediump float;\nmat3 transposeMat3 (mat3 v) {\n mat3 tmp;\n tmp[0] = vec3(v[0].x, v[1].x, v[2].x);\n tmp[1] = vec3(v[0].y, v[1].y, v[2].y);\n tmp[2] = vec3(v[0].z, v[1].z, v[2].z);\n return tmp;\n}\nvoid ClipQuadToHorizon (inout vec3 L[5], out int n) {\n int config = 0;\n if (L[0].z > 0.0) config += 1;\n if (L[1].z > 0.0) config += 2;\n if (L[2].z > 0.0) config += 4;\n if (L[3].z > 0.0) config += 8;\n config = 15;\n n = 0;\n if (config == 0)\n {\n }\n else if (config == 1) {\n n = 3;\n L[1] = -L[1].z * L[0] + L[0].z * L[1];\n L[2] = -L[3].z * L[0] + L[0].z * L[3];\n }\n else if (config == 2) {\n n = 3;\n L[0] = -L[0].z * L[1] + L[1].z * L[0];\n L[2] = -L[2].z * L[1] + L[1].z * L[2];\n }\n else if (config == 3) {\n n = 4;\n L[2] = -L[2].z * L[1] + L[1].z * L[2];\n L[3] = -L[3].z * L[0] + L[0].z * L[3];\n }\n else if (config == 4) {\n n = 3;\n L[0] = -L[3].z * L[2] + L[2].z * L[3];\n L[1] = -L[1].z * L[2] + L[2].z * L[1];\n }\n else if (config == 5) {\n n = 0;\n }\n else if (config == 6) {\n n = 4;\n L[0] = -L[0].z * L[1] + L[1].z * L[0];\n L[3] = -L[3].z * L[2] + L[2].z * L[3];\n }\n else if (config == 7) {\n n = 5;\n L[4] = -L[3].z * L[0] + L[0].z * L[3];\n L[3] = -L[3].z * L[2] + L[2].z * L[3];\n }\n else if (config == 8) {\n n = 3;\n L[0] = -L[0].z * L[3] + L[3].z * L[0];\n L[1] = -L[2].z * L[3] + L[3].z * L[2];\n L[2] = L[3];\n }\n else if (config == 9) {\n n = 4;\n L[1] = -L[1].z * L[0] + L[0].z * L[1];\n L[2] = -L[2].z * L[3] + L[3].z * L[2];\n }\n else if (config == 10) {\n n = 0;\n }\n else if (config == 11) {\n n = 5;\n L[4] = L[3];\n L[3] = -L[2].z * L[3] + L[3].z * L[2];\n L[2] = -L[2].z * L[1] + L[1].z * L[2];\n }\n else if (config == 12) {\n n = 4;\n L[1] = -L[1].z * L[2] + L[2].z * L[1];\n L[0] = -L[0].z * L[3] + L[3].z * L[0];\n }\n else if (config == 13) {\n n = 5;\n L[4] = L[3];\n L[3] = L[2];\n L[2] = -L[1].z * L[2] + L[2].z * L[1];\n L[1] = -L[1].z * L[0] + L[0].z * L[1];\n }\n else if (config == 14) {\n n = 5;\n L[4] = -L[0].z * L[3] + L[3].z * L[0];\n L[0] = -L[0].z * L[1] + L[1].z * L[0];\n }\n else if (config == 15) {\n n = 4;\n }\n if (n == 3) L[3] = L[0];\n if (n == 4) L[4] = L[0];\n}\nfloat IntegrateEdge (vec3 v1, vec3 v2) {\n float cosTheta = dot(v1, v2);\n float theta = acos(cosTheta);\n return cross(v1, v2).z * ((theta > 0.001) ? theta/sin(theta) : 4.0);\n}\nvec3 LTC_Evaluate (vec3 N, vec3 V, vec3 P, mat3 Minv, vec3 points[4]) {\n vec3 T1, T2;\n T1 = normalize(V - N*dot(V, N));\n T2 = cross(N, T1);\n Minv = Minv * transposeMat3(mat3(T1, T2, N));\n vec3 L[5];\n L[0] = Minv * (points[0] - P);\n L[1] = Minv * (points[1] - P);\n L[2] = Minv * (points[2] - P);\n L[3] = Minv * (points[3] - P);\n int n;\n ClipQuadToHorizon(L, n);\n if (n == 0) return vec3(0, 0, 0);\n L[0] = normalize(L[0]);\n L[1] = normalize(L[1]);\n L[2] = normalize(L[2]);\n L[3] = normalize(L[3]);\n L[4] = normalize(L[4]);\n float sum = 0.0;\n sum += IntegrateEdge(L[0], L[1]);\n sum += IntegrateEdge(L[1], L[2]);\n sum += IntegrateEdge(L[2], L[3]);\n if (n >= 4) sum += IntegrateEdge(L[3], L[4]);\n if (n == 5) sum += IntegrateEdge(L[4], L[0]);\n sum = max(0.0, sum);\n vec3 Lo_i = vec3(sum, sum, sum);\n return Lo_i;\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};\nvec3 LinearToSRGB(vec3 linear) {\n#ifdef CC_USE_SURFACE_SHADER\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC && CC_SURFACES_ENABLE_DEBUG_VIEW\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_GAMMA_CORRECTION) {\n return linear;\n }\n #endif\n#endif\n return sqrt(linear);\n}\n#if CC_USE_LIGHT_PROBE\n vec3 ACESToneMap (vec3 color) {\n color = min(color, vec3(8.0));\n const float A = 2.51;\n const float B = 0.03;\n const float C = 2.43;\n const float D = 0.59;\n const float E = 0.14;\n return (color * (A * color + B)) / (color * (C * color + D) + E);\n }\n vec4 packRGBE (vec3 rgb) {\n highp float maxComp = max(max(rgb.r, rgb.g), rgb.b);\n highp float e = 128.0;\n if (maxComp > 0.0001) {\n e = log(maxComp) / log(1.1);\n e = ceil(e);\n e = clamp(e + 128.0, 0.0, 255.0);\n }\n highp float sc = 1.0 / pow(1.1, e - 128.0);\n vec3 encode = clamp(rgb * sc, vec3(0.0), vec3(1.0)) * 255.0;\n vec3 encode_rounded = floor(encode) + step(encode - floor(encode), vec3(0.5));\n return vec4(encode_rounded, e) / 255.0;\n }\n vec4 CCFragOutput (vec4 color) {\n #if CC_USE_RGBE_OUTPUT\n color = packRGBE(color.rgb);\n #elif !CC_USE_FLOAT_OUTPUT\n #if CC_USE_HDR && CC_TONE_MAPPING_TYPE == HDR_TONE_MAPPING_ACES\n color.rgb = ACESToneMap(color.rgb);\n #endif\n color.rgb = LinearToSRGB(color.rgb);\n #endif\n return color;\n }\n#else\n vec4 CCFragOutput (vec4 color) {\n return color;\n }\n#endif\nin vec3 normal_w;\nin vec3 pos_w;\nin vec3 pos_l;\nin vec3 right;\nin vec3 up;\nin vec3 forward;\nlayout(std140) uniform Constant {\n vec4 mainColor;\n vec4 cc_sh_linear_const_r;\n vec4 cc_sh_linear_const_g;\n vec4 cc_sh_linear_const_b;\n vec4 cc_sh_quadratic_r;\n vec4 cc_sh_quadratic_g;\n vec4 cc_sh_quadratic_b;\n vec4 cc_sh_quadratic_a;\n};\n#if CC_USE_LIGHT_PROBE\n #if CC_USE_LIGHT_PROBE\n vec3 SHEvaluate(vec3 normal)\n {\n vec3 result;\n #if USE_INSTANCING\n vec4 normal4 = vec4(normal, 1.0);\n result.r = dot(v_sh_linear_const_r, normal4);\n result.g = dot(v_sh_linear_const_g, normal4);\n result.b = dot(v_sh_linear_const_b, normal4);\n #else\n vec4 normal4 = vec4(normal, 1.0);\n result.r = dot(cc_sh_linear_const_r, normal4);\n result.g = dot(cc_sh_linear_const_g, normal4);\n result.b = dot(cc_sh_linear_const_b, normal4);\n vec4 n14 = normal.xyzz * normal.yzzx;\n float n5 = normal.x * normal.x - normal.y * normal.y;\n result.r += dot(cc_sh_quadratic_r, n14);\n result.g += dot(cc_sh_quadratic_g, n14);\n result.b += dot(cc_sh_quadratic_b, n14);\n result += (cc_sh_quadratic_a.rgb * n5);\n #endif\n #if CC_USE_HDR\n result *= cc_exposure.w * cc_exposure.x;\n #endif\n return result;\n }\n #endif\n#endif\nvec4 gizmo_fs (float alpha) {\n #if CC_USE_LIGHT_PROBE\n vec3 N = normalize(normal_w) * (float(gl_FrontFacing) * 2.0 - 1.0);\n vec3 diffuse = SHEvaluate(N);\n #if USE_FORWARD_PIPELINE\n return CCFragOutput(vec4(diffuse, mainColor.a * alpha));\n #else\n return vec4(diffuse, mainColor.a * alpha);\n #endif\n #else\n vec3 N = normalize(normal_w) * (float(gl_FrontFacing) * 2.0 - 1.0);\n vec3 V = normalize(cc_cameraPos.xyz - pos_w);\n vec3 points [4];\n points[0] = (forward * 3.0 + right + up) * 40.0;\n points[1] = (forward * 3.0 - right + up) * 40.0;\n points[2] = (forward * 3.0 - right - up) * 40.0;\n points[3] = (forward * 3.0 + right - up) * 40.0;\n vec3 diffuse = LinearToSRGB(mainColor.rgb * LTC_Evaluate(N, V, pos_l, mat3(1), points));\n #if USE_FORWARD_PIPELINE\n return CCFragOutput(vec4(diffuse, mainColor.a * alpha));\n #else\n return vec4(diffuse, mainColor.a * alpha);\n #endif\n #endif\n}\nvec4 back () {\n return gizmo_fs(0.2);\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = back(); }"
  1164. },
  1165. "glsl1": {
  1166. "vert": "\nprecision mediump float;\nuniform highp mat4 cc_matWorld;\n uniform highp mat4 cc_matWorldIT;\nuniform highp mat4 cc_matView;\n uniform highp mat4 cc_matProj;\nattribute vec3 a_position;\nattribute vec3 a_normal;\nvarying vec3 normal_w;\nvarying vec3 pos_w;\nvarying vec3 pos_l;\nvarying vec3 right;\nvarying vec3 up;\nvarying vec3 forward;\nvec4 vert () {\n vec4 pos = vec4(a_position, 1);\n vec4 normal = vec4(a_normal, 0);\n pos_l = a_position;\n pos_w = (cc_matWorld * pos).xyz;\n normal_w = (cc_matWorldIT * normal).xyz;\n right = vec3(cc_matView[0][0], cc_matView[1][0], cc_matView[2][0]);\n up = vec3(cc_matView[0][1], cc_matView[1][1], cc_matView[2][1]);\n forward = vec3(cc_matView[0][2], cc_matView[1][2], cc_matView[2][2]);\n return cc_matProj * (cc_matView * cc_matWorld) * pos;\n}\nvoid main() { gl_Position = vert(); }",
  1167. "frag": "\nprecision mediump float;\nmat3 transposeMat3 (mat3 v) {\n mat3 tmp;\n tmp[0] = vec3(v[0].x, v[1].x, v[2].x);\n tmp[1] = vec3(v[0].y, v[1].y, v[2].y);\n tmp[2] = vec3(v[0].z, v[1].z, v[2].z);\n return tmp;\n}\nvoid ClipQuadToHorizon (inout vec3 L[5], out int n) {\n int config = 0;\n if (L[0].z > 0.0) config += 1;\n if (L[1].z > 0.0) config += 2;\n if (L[2].z > 0.0) config += 4;\n if (L[3].z > 0.0) config += 8;\n config = 15;\n n = 0;\n if (config == 0)\n {\n }\n else if (config == 1) {\n n = 3;\n L[1] = -L[1].z * L[0] + L[0].z * L[1];\n L[2] = -L[3].z * L[0] + L[0].z * L[3];\n }\n else if (config == 2) {\n n = 3;\n L[0] = -L[0].z * L[1] + L[1].z * L[0];\n L[2] = -L[2].z * L[1] + L[1].z * L[2];\n }\n else if (config == 3) {\n n = 4;\n L[2] = -L[2].z * L[1] + L[1].z * L[2];\n L[3] = -L[3].z * L[0] + L[0].z * L[3];\n }\n else if (config == 4) {\n n = 3;\n L[0] = -L[3].z * L[2] + L[2].z * L[3];\n L[1] = -L[1].z * L[2] + L[2].z * L[1];\n }\n else if (config == 5) {\n n = 0;\n }\n else if (config == 6) {\n n = 4;\n L[0] = -L[0].z * L[1] + L[1].z * L[0];\n L[3] = -L[3].z * L[2] + L[2].z * L[3];\n }\n else if (config == 7) {\n n = 5;\n L[4] = -L[3].z * L[0] + L[0].z * L[3];\n L[3] = -L[3].z * L[2] + L[2].z * L[3];\n }\n else if (config == 8) {\n n = 3;\n L[0] = -L[0].z * L[3] + L[3].z * L[0];\n L[1] = -L[2].z * L[3] + L[3].z * L[2];\n L[2] = L[3];\n }\n else if (config == 9) {\n n = 4;\n L[1] = -L[1].z * L[0] + L[0].z * L[1];\n L[2] = -L[2].z * L[3] + L[3].z * L[2];\n }\n else if (config == 10) {\n n = 0;\n }\n else if (config == 11) {\n n = 5;\n L[4] = L[3];\n L[3] = -L[2].z * L[3] + L[3].z * L[2];\n L[2] = -L[2].z * L[1] + L[1].z * L[2];\n }\n else if (config == 12) {\n n = 4;\n L[1] = -L[1].z * L[2] + L[2].z * L[1];\n L[0] = -L[0].z * L[3] + L[3].z * L[0];\n }\n else if (config == 13) {\n n = 5;\n L[4] = L[3];\n L[3] = L[2];\n L[2] = -L[1].z * L[2] + L[2].z * L[1];\n L[1] = -L[1].z * L[0] + L[0].z * L[1];\n }\n else if (config == 14) {\n n = 5;\n L[4] = -L[0].z * L[3] + L[3].z * L[0];\n L[0] = -L[0].z * L[1] + L[1].z * L[0];\n }\n else if (config == 15) {\n n = 4;\n }\n if (n == 3) L[3] = L[0];\n if (n == 4) L[4] = L[0];\n}\nfloat IntegrateEdge (vec3 v1, vec3 v2) {\n float cosTheta = dot(v1, v2);\n float theta = acos(cosTheta);\n return cross(v1, v2).z * ((theta > 0.001) ? theta/sin(theta) : 4.0);\n}\nvec3 LTC_Evaluate (vec3 N, vec3 V, vec3 P, mat3 Minv, vec3 points[4]) {\n vec3 T1, T2;\n T1 = normalize(V - N*dot(V, N));\n T2 = cross(N, T1);\n Minv = Minv * transposeMat3(mat3(T1, T2, N));\n vec3 L[5];\n L[0] = Minv * (points[0] - P);\n L[1] = Minv * (points[1] - P);\n L[2] = Minv * (points[2] - P);\n L[3] = Minv * (points[3] - P);\n int n;\n ClipQuadToHorizon(L, n);\n if (n == 0) return vec3(0, 0, 0);\n L[0] = normalize(L[0]);\n L[1] = normalize(L[1]);\n L[2] = normalize(L[2]);\n L[3] = normalize(L[3]);\n L[4] = normalize(L[4]);\n float sum = 0.0;\n sum += IntegrateEdge(L[0], L[1]);\n sum += IntegrateEdge(L[1], L[2]);\n sum += IntegrateEdge(L[2], L[3]);\n if (n >= 4) sum += IntegrateEdge(L[3], L[4]);\n if (n == 5) sum += IntegrateEdge(L[4], L[0]);\n sum = max(0.0, sum);\n vec3 Lo_i = vec3(sum, sum, sum);\n return Lo_i;\n}\nuniform highp vec4 cc_cameraPos;\n uniform mediump vec4 cc_exposure;\nvec3 LinearToSRGB(vec3 linear) {\n#ifdef CC_USE_SURFACE_SHADER\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC && CC_SURFACES_ENABLE_DEBUG_VIEW\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_GAMMA_CORRECTION) {\n return linear;\n }\n #endif\n#endif\n return sqrt(linear);\n}\n#if CC_USE_LIGHT_PROBE\n vec3 ACESToneMap (vec3 color) {\n color = min(color, vec3(8.0));\n const float A = 2.51;\n const float B = 0.03;\n const float C = 2.43;\n const float D = 0.59;\n const float E = 0.14;\n return (color * (A * color + B)) / (color * (C * color + D) + E);\n }\n vec4 packRGBE (vec3 rgb) {\n highp float maxComp = max(max(rgb.r, rgb.g), rgb.b);\n highp float e = 128.0;\n if (maxComp > 0.0001) {\n e = log(maxComp) / log(1.1);\n e = ceil(e);\n e = clamp(e + 128.0, 0.0, 255.0);\n }\n highp float sc = 1.0 / pow(1.1, e - 128.0);\n vec3 encode = clamp(rgb * sc, vec3(0.0), vec3(1.0)) * 255.0;\n vec3 encode_rounded = floor(encode) + step(encode - floor(encode), vec3(0.5));\n return vec4(encode_rounded, e) / 255.0;\n }\n vec4 CCFragOutput (vec4 color) {\n #if CC_USE_RGBE_OUTPUT\n color = packRGBE(color.rgb);\n #elif !CC_USE_FLOAT_OUTPUT\n #if CC_USE_HDR && CC_TONE_MAPPING_TYPE == HDR_TONE_MAPPING_ACES\n color.rgb = ACESToneMap(color.rgb);\n #endif\n color.rgb = LinearToSRGB(color.rgb);\n #endif\n return color;\n }\n#else\n vec4 CCFragOutput (vec4 color) {\n return color;\n }\n#endif\nvarying vec3 normal_w;\nvarying vec3 pos_w;\nvarying vec3 pos_l;\nvarying vec3 right;\nvarying vec3 up;\nvarying vec3 forward;\n uniform vec4 mainColor;\n uniform vec4 cc_sh_linear_const_r;\n uniform vec4 cc_sh_linear_const_g;\n uniform vec4 cc_sh_linear_const_b;\n uniform vec4 cc_sh_quadratic_r;\n uniform vec4 cc_sh_quadratic_g;\n uniform vec4 cc_sh_quadratic_b;\n uniform vec4 cc_sh_quadratic_a;\n#if CC_USE_LIGHT_PROBE\n #if CC_USE_LIGHT_PROBE\n vec3 SHEvaluate(vec3 normal)\n {\n vec3 result;\n #if USE_INSTANCING\n vec4 normal4 = vec4(normal, 1.0);\n result.r = dot(v_sh_linear_const_r, normal4);\n result.g = dot(v_sh_linear_const_g, normal4);\n result.b = dot(v_sh_linear_const_b, normal4);\n #else\n vec4 normal4 = vec4(normal, 1.0);\n result.r = dot(cc_sh_linear_const_r, normal4);\n result.g = dot(cc_sh_linear_const_g, normal4);\n result.b = dot(cc_sh_linear_const_b, normal4);\n vec4 n14 = normal.xyzz * normal.yzzx;\n float n5 = normal.x * normal.x - normal.y * normal.y;\n result.r += dot(cc_sh_quadratic_r, n14);\n result.g += dot(cc_sh_quadratic_g, n14);\n result.b += dot(cc_sh_quadratic_b, n14);\n result += (cc_sh_quadratic_a.rgb * n5);\n #endif\n #if CC_USE_HDR\n result *= cc_exposure.w * cc_exposure.x;\n #endif\n return result;\n }\n #endif\n#endif\nvec4 gizmo_fs (float alpha) {\n #if CC_USE_LIGHT_PROBE\n vec3 N = normalize(normal_w) * (float(gl_FrontFacing) * 2.0 - 1.0);\n vec3 diffuse = SHEvaluate(N);\n #if USE_FORWARD_PIPELINE\n return CCFragOutput(vec4(diffuse, mainColor.a * alpha));\n #else\n return vec4(diffuse, mainColor.a * alpha);\n #endif\n #else\n vec3 N = normalize(normal_w) * (float(gl_FrontFacing) * 2.0 - 1.0);\n vec3 V = normalize(cc_cameraPos.xyz - pos_w);\n vec3 points [4];\n points[0] = (forward * 3.0 + right + up) * 40.0;\n points[1] = (forward * 3.0 - right + up) * 40.0;\n points[2] = (forward * 3.0 - right - up) * 40.0;\n points[3] = (forward * 3.0 + right - up) * 40.0;\n vec3 diffuse = LinearToSRGB(mainColor.rgb * LTC_Evaluate(N, V, pos_l, mat3(1), points));\n #if USE_FORWARD_PIPELINE\n return CCFragOutput(vec4(diffuse, mainColor.a * alpha));\n #else\n return vec4(diffuse, mainColor.a * alpha);\n #endif\n #endif\n}\nvec4 back () {\n return gizmo_fs(0.2);\n}\nvoid main() { gl_FragColor = back(); }"
  1168. },
  1169. "builtins": {
  1170. "globals": {
  1171. "blocks": [
  1172. {
  1173. "name": "CCGlobal",
  1174. "defines": []
  1175. },
  1176. {
  1177. "name": "CCCamera",
  1178. "defines": []
  1179. }
  1180. ],
  1181. "samplerTextures": [],
  1182. "buffers": [],
  1183. "images": []
  1184. },
  1185. "locals": {
  1186. "blocks": [
  1187. {
  1188. "name": "CCLocal",
  1189. "defines": []
  1190. }
  1191. ],
  1192. "samplerTextures": [],
  1193. "buffers": [],
  1194. "images": []
  1195. },
  1196. "statistics": {
  1197. "CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS": 56,
  1198. "CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS": 50
  1199. }
  1200. },
  1201. "defines": [
  1202. {
  1203. "name": "CC_USE_DEBUG_VIEW",
  1204. "type": "number",
  1205. "defines": [],
  1206. "range": [
  1207. 0,
  1208. 3
  1209. ]
  1210. },
  1211. {
  1212. "name": "CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC",
  1213. "type": "boolean",
  1214. "defines": [
  1215. "CC_USE_DEBUG_VIEW"
  1216. ]
  1217. },
  1218. {
  1219. "name": "CC_SURFACES_ENABLE_DEBUG_VIEW",
  1220. "type": "boolean",
  1221. "defines": [
  1222. "CC_USE_DEBUG_VIEW",
  1223. "CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC"
  1224. ]
  1225. },
  1226. {
  1227. "name": "CC_USE_LIGHT_PROBE",
  1228. "type": "boolean",
  1229. "defines": [],
  1230. "default": 0
  1231. },
  1232. {
  1233. "name": "CC_USE_RGBE_OUTPUT",
  1234. "type": "boolean",
  1235. "defines": [
  1236. "CC_USE_LIGHT_PROBE"
  1237. ]
  1238. },
  1239. {
  1240. "name": "CC_USE_FLOAT_OUTPUT",
  1241. "type": "boolean",
  1242. "defines": [
  1243. "CC_USE_LIGHT_PROBE",
  1244. "!CC_USE_RGBE_OUTPUT"
  1245. ]
  1246. },
  1247. {
  1248. "name": "CC_USE_HDR",
  1249. "type": "boolean",
  1250. "defines": [
  1251. "CC_USE_LIGHT_PROBE",
  1252. "CC_USE_LIGHT_PROBE"
  1253. ]
  1254. },
  1255. {
  1256. "name": "CC_TONE_MAPPING_TYPE",
  1257. "type": "number",
  1258. "defines": [
  1259. "CC_USE_HDR",
  1260. "CC_USE_LIGHT_PROBE",
  1261. "!CC_USE_RGBE_OUTPUT",
  1262. "!CC_USE_FLOAT_OUTPUT"
  1263. ],
  1264. "range": [
  1265. 0,
  1266. 3
  1267. ]
  1268. },
  1269. {
  1270. "name": "HDR_TONE_MAPPING_ACES",
  1271. "type": "boolean",
  1272. "defines": [
  1273. "CC_USE_HDR",
  1274. "CC_TONE_MAPPING_TYPE",
  1275. "CC_USE_LIGHT_PROBE",
  1276. "!CC_USE_RGBE_OUTPUT",
  1277. "!CC_USE_FLOAT_OUTPUT"
  1278. ]
  1279. },
  1280. {
  1281. "name": "USE_INSTANCING",
  1282. "type": "boolean",
  1283. "defines": [
  1284. "CC_USE_LIGHT_PROBE",
  1285. "CC_USE_LIGHT_PROBE"
  1286. ]
  1287. },
  1288. {
  1289. "name": "USE_FORWARD_PIPELINE",
  1290. "type": "boolean",
  1291. "defines": [
  1292. "CC_USE_LIGHT_PROBE"
  1293. ]
  1294. }
  1295. ],
  1296. "name": "internal/editor/light-probe-visualization|gizmo-vs:vert|gizmo-fs:back"
  1297. }
  1298. ],
  1299. "combinations": [],
  1300. "hideInEditor": true
  1301. }