60f7195c-ec2a-45eb-ba94-8955f60e81d0.json 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545
  1. {
  2. "__type__": "cc.EffectAsset",
  3. "_name": "for2d/builtin-sprite",
  4. "_objFlags": 0,
  5. "__editorExtras__": {},
  6. "_native": "",
  7. "techniques": [
  8. {
  9. "passes": [
  10. {
  11. "blendState": {
  12. "targets": [
  13. {
  14. "blend": true,
  15. "blendSrc": 2,
  16. "blendDst": 4,
  17. "blendDstAlpha": 4
  18. }
  19. ]
  20. },
  21. "rasterizerState": {
  22. "cullMode": 0
  23. },
  24. "program": "for2d/builtin-sprite|sprite-vs:vert|sprite-fs:frag",
  25. "depthStencilState": {
  26. "depthTest": false,
  27. "depthWrite": false
  28. },
  29. "properties": {
  30. "alphaThreshold": {
  31. "value": [
  32. 0.5
  33. ],
  34. "type": 13
  35. }
  36. }
  37. }
  38. ]
  39. }
  40. ],
  41. "shaders": [
  42. {
  43. "blocks": [
  44. {
  45. "name": "ALPHA_TEST_DATA",
  46. "members": [
  47. {
  48. "name": "alphaThreshold",
  49. "type": 13,
  50. "count": 1
  51. }
  52. ],
  53. "defines": [
  54. "USE_ALPHA_TEST"
  55. ],
  56. "stageFlags": 16,
  57. "binding": 0
  58. }
  59. ],
  60. "samplerTextures": [],
  61. "samplers": [],
  62. "textures": [],
  63. "buffers": [],
  64. "images": [],
  65. "subpassInputs": [],
  66. "attributes": [
  67. {
  68. "name": "a_position",
  69. "defines": [],
  70. "format": 32,
  71. "location": 0
  72. },
  73. {
  74. "name": "a_texCoord",
  75. "defines": [],
  76. "format": 21,
  77. "location": 1
  78. },
  79. {
  80. "name": "a_color",
  81. "defines": [],
  82. "format": 44,
  83. "location": 2
  84. }
  85. ],
  86. "varyings": [
  87. {
  88. "name": "color",
  89. "type": 16,
  90. "count": 1,
  91. "defines": [],
  92. "stageFlags": 17,
  93. "location": 0
  94. },
  95. {
  96. "name": "uv0",
  97. "type": 14,
  98. "count": 1,
  99. "defines": [],
  100. "stageFlags": 17,
  101. "location": 1
  102. }
  103. ],
  104. "fragColors": [
  105. {
  106. "name": "cc_FragColor",
  107. "typename": "vec4",
  108. "type": 16,
  109. "count": 1,
  110. "defines": [],
  111. "stageFlags": 16,
  112. "location": 0
  113. }
  114. ],
  115. "descriptors": [
  116. {
  117. "rate": 0,
  118. "blocks": [
  119. {
  120. "tags": {
  121. "builtin": "local"
  122. },
  123. "name": "CCLocal",
  124. "members": [
  125. {
  126. "name": "cc_matWorld",
  127. "typename": "mat4",
  128. "type": 25,
  129. "count": 1,
  130. "precision": "highp "
  131. },
  132. {
  133. "name": "cc_matWorldIT",
  134. "typename": "mat4",
  135. "type": 25,
  136. "count": 1,
  137. "precision": "highp "
  138. },
  139. {
  140. "name": "cc_lightingMapUVParam",
  141. "typename": "vec4",
  142. "type": 16,
  143. "count": 1,
  144. "precision": "highp "
  145. },
  146. {
  147. "name": "cc_localShadowBias",
  148. "typename": "vec4",
  149. "type": 16,
  150. "count": 1,
  151. "precision": "highp "
  152. },
  153. {
  154. "name": "cc_reflectionProbeData1",
  155. "typename": "vec4",
  156. "type": 16,
  157. "count": 1,
  158. "precision": "highp "
  159. },
  160. {
  161. "name": "cc_reflectionProbeData2",
  162. "typename": "vec4",
  163. "type": 16,
  164. "count": 1,
  165. "precision": "highp "
  166. },
  167. {
  168. "name": "cc_reflectionProbeBlendData1",
  169. "typename": "vec4",
  170. "type": 16,
  171. "count": 1,
  172. "precision": "highp "
  173. },
  174. {
  175. "name": "cc_reflectionProbeBlendData2",
  176. "typename": "vec4",
  177. "type": 16,
  178. "count": 1,
  179. "precision": "highp "
  180. }
  181. ],
  182. "defines": [
  183. "USE_LOCAL"
  184. ],
  185. "stageFlags": 1
  186. }
  187. ],
  188. "samplerTextures": [
  189. {
  190. "tags": {
  191. "builtin": "local"
  192. },
  193. "name": "cc_spriteTexture",
  194. "typename": "sampler2D",
  195. "type": 28,
  196. "count": 1,
  197. "defines": [
  198. "USE_TEXTURE"
  199. ],
  200. "stageFlags": 16
  201. }
  202. ],
  203. "samplers": [],
  204. "textures": [],
  205. "buffers": [],
  206. "images": [],
  207. "subpassInputs": []
  208. },
  209. {
  210. "rate": 1,
  211. "blocks": [
  212. {
  213. "name": "ALPHA_TEST_DATA",
  214. "members": [
  215. {
  216. "name": "alphaThreshold",
  217. "type": 13,
  218. "count": 1
  219. }
  220. ],
  221. "defines": [
  222. "USE_ALPHA_TEST"
  223. ],
  224. "stageFlags": 16,
  225. "binding": 0
  226. }
  227. ],
  228. "samplerTextures": [],
  229. "samplers": [],
  230. "textures": [],
  231. "buffers": [],
  232. "images": [],
  233. "subpassInputs": []
  234. },
  235. {
  236. "rate": 2,
  237. "blocks": [],
  238. "samplerTextures": [],
  239. "samplers": [],
  240. "textures": [],
  241. "buffers": [],
  242. "images": [],
  243. "subpassInputs": []
  244. },
  245. {
  246. "rate": 3,
  247. "blocks": [
  248. {
  249. "tags": {
  250. "builtin": "global"
  251. },
  252. "name": "CCGlobal",
  253. "members": [
  254. {
  255. "name": "cc_time",
  256. "typename": "vec4",
  257. "type": 16,
  258. "count": 1,
  259. "precision": "highp "
  260. },
  261. {
  262. "name": "cc_screenSize",
  263. "typename": "vec4",
  264. "type": 16,
  265. "count": 1,
  266. "precision": "mediump "
  267. },
  268. {
  269. "name": "cc_nativeSize",
  270. "typename": "vec4",
  271. "type": 16,
  272. "count": 1,
  273. "precision": "mediump "
  274. },
  275. {
  276. "name": "cc_probeInfo",
  277. "typename": "vec4",
  278. "type": 16,
  279. "count": 1,
  280. "precision": "mediump "
  281. },
  282. {
  283. "name": "cc_debug_view_mode",
  284. "typename": "vec4",
  285. "type": 16,
  286. "count": 1,
  287. "precision": "mediump "
  288. }
  289. ],
  290. "defines": [],
  291. "stageFlags": 1
  292. },
  293. {
  294. "tags": {
  295. "builtin": "global"
  296. },
  297. "name": "CCCamera",
  298. "members": [
  299. {
  300. "name": "cc_matView",
  301. "typename": "mat4",
  302. "type": 25,
  303. "count": 1,
  304. "precision": "highp "
  305. },
  306. {
  307. "name": "cc_matViewInv",
  308. "typename": "mat4",
  309. "type": 25,
  310. "count": 1,
  311. "precision": "highp "
  312. },
  313. {
  314. "name": "cc_matProj",
  315. "typename": "mat4",
  316. "type": 25,
  317. "count": 1,
  318. "precision": "highp "
  319. },
  320. {
  321. "name": "cc_matProjInv",
  322. "typename": "mat4",
  323. "type": 25,
  324. "count": 1,
  325. "precision": "highp "
  326. },
  327. {
  328. "name": "cc_matViewProj",
  329. "typename": "mat4",
  330. "type": 25,
  331. "count": 1,
  332. "precision": "highp "
  333. },
  334. {
  335. "name": "cc_matViewProjInv",
  336. "typename": "mat4",
  337. "type": 25,
  338. "count": 1,
  339. "precision": "highp "
  340. },
  341. {
  342. "name": "cc_cameraPos",
  343. "typename": "vec4",
  344. "type": 16,
  345. "count": 1,
  346. "precision": "highp "
  347. },
  348. {
  349. "name": "cc_surfaceTransform",
  350. "typename": "vec4",
  351. "type": 16,
  352. "count": 1,
  353. "precision": "mediump "
  354. },
  355. {
  356. "name": "cc_screenScale",
  357. "typename": "vec4",
  358. "type": 16,
  359. "count": 1,
  360. "precision": "mediump "
  361. },
  362. {
  363. "name": "cc_exposure",
  364. "typename": "vec4",
  365. "type": 16,
  366. "count": 1,
  367. "precision": "mediump "
  368. },
  369. {
  370. "name": "cc_mainLitDir",
  371. "typename": "vec4",
  372. "type": 16,
  373. "count": 1,
  374. "precision": "mediump "
  375. },
  376. {
  377. "name": "cc_mainLitColor",
  378. "typename": "vec4",
  379. "type": 16,
  380. "count": 1,
  381. "precision": "mediump "
  382. },
  383. {
  384. "name": "cc_ambientSky",
  385. "typename": "vec4",
  386. "type": 16,
  387. "count": 1,
  388. "precision": "mediump "
  389. },
  390. {
  391. "name": "cc_ambientGround",
  392. "typename": "vec4",
  393. "type": 16,
  394. "count": 1,
  395. "precision": "mediump "
  396. },
  397. {
  398. "name": "cc_fogColor",
  399. "typename": "vec4",
  400. "type": 16,
  401. "count": 1,
  402. "precision": "mediump "
  403. },
  404. {
  405. "name": "cc_fogBase",
  406. "typename": "vec4",
  407. "type": 16,
  408. "count": 1,
  409. "precision": "mediump "
  410. },
  411. {
  412. "name": "cc_fogAdd",
  413. "typename": "vec4",
  414. "type": 16,
  415. "count": 1,
  416. "precision": "mediump "
  417. },
  418. {
  419. "name": "cc_nearFar",
  420. "typename": "vec4",
  421. "type": 16,
  422. "count": 1,
  423. "precision": "mediump "
  424. },
  425. {
  426. "name": "cc_viewPort",
  427. "typename": "vec4",
  428. "type": 16,
  429. "count": 1,
  430. "precision": "mediump "
  431. }
  432. ],
  433. "defines": [],
  434. "stageFlags": 1
  435. }
  436. ],
  437. "samplerTextures": [],
  438. "samplers": [],
  439. "textures": [],
  440. "buffers": [],
  441. "images": [],
  442. "subpassInputs": []
  443. }
  444. ],
  445. "hash": 2249878161,
  446. "glsl4": {
  447. "vert": "\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};\n#if USE_LOCAL\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\n#if SAMPLE_FROM_RT\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\n#endif\nlayout(location = 0) in vec3 a_position;\nlayout(location = 1) in vec2 a_texCoord;\nlayout(location = 2) in vec4 a_color;\nlayout(location = 0) out vec4 color;\nlayout(location = 1) out vec2 uv0;\nvec4 vert () {\n vec4 pos = vec4(a_position, 1);\n #if USE_LOCAL\n pos = cc_matWorld * pos;\n #endif\n #if USE_PIXEL_ALIGNMENT\n pos = cc_matView * pos;\n pos.xyz = floor(pos.xyz);\n pos = cc_matProj * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n uv0 = a_texCoord;\n #if SAMPLE_FROM_RT\n uv0 = cc_cameraPos.w > 1.0 ? vec2(uv0.x, 1.0 - uv0.y) : uv0;\n #endif\n color = a_color;\n return pos;\n}\nvoid main() { gl_Position = vert(); }",
  448. "frag": "\nprecision highp float;\nvec4 CCSampleWithAlphaSeparated(sampler2D tex, vec2 uv) {\n#if CC_USE_EMBEDDED_ALPHA\n return vec4(texture(tex, uv).rgb, texture(tex, uv + vec2(0.0, 0.5)).r);\n#else\n return texture(tex, uv);\n#endif\n}\n#if USE_ALPHA_TEST\n layout(set = 1, binding = 0) uniform ALPHA_TEST_DATA {\n float alphaThreshold;\n };\n#endif\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\nlayout(location = 0) in vec4 color;\n#if USE_TEXTURE\n layout(location = 1) in vec2 uv0;\n layout(set = 2, binding = 12) uniform sampler2D cc_spriteTexture;\n#endif\nvec4 frag () {\n vec4 o = vec4(1, 1, 1, 1);\n #if USE_TEXTURE\n o *= CCSampleWithAlphaSeparated(cc_spriteTexture, uv0);\n #if IS_GRAY\n float gray = 0.2126 * o.r + 0.7152 * o.g + 0.0722 * o.b;\n o.r = o.g = o.b = gray;\n #endif\n #endif\n o *= color;\n ALPHA_TEST(o);\n return o;\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = frag(); }"
  449. },
  450. "glsl3": {
  451. "vert": "\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};\n#if USE_LOCAL\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\n#if SAMPLE_FROM_RT\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\n#endif\nin vec3 a_position;\nin vec2 a_texCoord;\nin vec4 a_color;\nout vec4 color;\nout vec2 uv0;\nvec4 vert () {\n vec4 pos = vec4(a_position, 1);\n #if USE_LOCAL\n pos = cc_matWorld * pos;\n #endif\n #if USE_PIXEL_ALIGNMENT\n pos = cc_matView * pos;\n pos.xyz = floor(pos.xyz);\n pos = cc_matProj * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n uv0 = a_texCoord;\n #if SAMPLE_FROM_RT\n uv0 = cc_cameraPos.w > 1.0 ? vec2(uv0.x, 1.0 - uv0.y) : uv0;\n #endif\n color = a_color;\n return pos;\n}\nvoid main() { gl_Position = vert(); }",
  452. "frag": "\nprecision highp float;\nvec4 CCSampleWithAlphaSeparated(sampler2D tex, vec2 uv) {\n#if CC_USE_EMBEDDED_ALPHA\n return vec4(texture(tex, uv).rgb, texture(tex, uv + vec2(0.0, 0.5)).r);\n#else\n return texture(tex, uv);\n#endif\n}\n#if USE_ALPHA_TEST\n layout(std140) uniform ALPHA_TEST_DATA {\n float alphaThreshold;\n };\n#endif\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\nin vec4 color;\n#if USE_TEXTURE\n in vec2 uv0;\n uniform sampler2D cc_spriteTexture;\n#endif\nvec4 frag () {\n vec4 o = vec4(1, 1, 1, 1);\n #if USE_TEXTURE\n o *= CCSampleWithAlphaSeparated(cc_spriteTexture, uv0);\n #if IS_GRAY\n float gray = 0.2126 * o.r + 0.7152 * o.g + 0.0722 * o.b;\n o.r = o.g = o.b = gray;\n #endif\n #endif\n o *= color;\n ALPHA_TEST(o);\n return o;\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = frag(); }"
  453. },
  454. "glsl1": {
  455. "vert": "\nprecision highp float;\nuniform highp mat4 cc_matView;\n uniform highp mat4 cc_matProj;\n uniform highp mat4 cc_matViewProj;\n uniform highp vec4 cc_cameraPos;\n#if USE_LOCAL\n uniform highp mat4 cc_matWorld;\n#endif\n#if SAMPLE_FROM_RT\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\n#endif\nattribute vec3 a_position;\nattribute vec2 a_texCoord;\nattribute vec4 a_color;\nvarying vec4 color;\nvarying vec2 uv0;\nvec4 vert () {\n vec4 pos = vec4(a_position, 1);\n #if USE_LOCAL\n pos = cc_matWorld * pos;\n #endif\n #if USE_PIXEL_ALIGNMENT\n pos = cc_matView * pos;\n pos.xyz = floor(pos.xyz);\n pos = cc_matProj * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n uv0 = a_texCoord;\n #if SAMPLE_FROM_RT\n uv0 = cc_cameraPos.w > 1.0 ? vec2(uv0.x, 1.0 - uv0.y) : uv0;\n #endif\n color = a_color;\n return pos;\n}\nvoid main() { gl_Position = vert(); }",
  456. "frag": "\nprecision highp float;\nvec4 CCSampleWithAlphaSeparated(sampler2D tex, vec2 uv) {\n#if CC_USE_EMBEDDED_ALPHA\n return vec4(texture2D(tex, uv).rgb, texture2D(tex, uv + vec2(0.0, 0.5)).r);\n#else\n return texture2D(tex, uv);\n#endif\n}\n#if USE_ALPHA_TEST\n uniform float alphaThreshold;\n#endif\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\nvarying vec4 color;\n#if USE_TEXTURE\n varying vec2 uv0;\n uniform sampler2D cc_spriteTexture;\n#endif\nvec4 frag () {\n vec4 o = vec4(1, 1, 1, 1);\n #if USE_TEXTURE\n o *= CCSampleWithAlphaSeparated(cc_spriteTexture, uv0);\n #if IS_GRAY\n float gray = 0.2126 * o.r + 0.7152 * o.g + 0.0722 * o.b;\n o.r = o.g = o.b = gray;\n #endif\n #endif\n o *= color;\n ALPHA_TEST(o);\n return o;\n}\nvoid main() { gl_FragColor = frag(); }"
  457. },
  458. "builtins": {
  459. "globals": {
  460. "blocks": [
  461. {
  462. "name": "CCGlobal",
  463. "defines": []
  464. },
  465. {
  466. "name": "CCCamera",
  467. "defines": []
  468. }
  469. ],
  470. "samplerTextures": [],
  471. "buffers": [],
  472. "images": []
  473. },
  474. "locals": {
  475. "blocks": [
  476. {
  477. "name": "CCLocal",
  478. "defines": [
  479. "USE_LOCAL"
  480. ]
  481. }
  482. ],
  483. "samplerTextures": [
  484. {
  485. "name": "cc_spriteTexture",
  486. "defines": [
  487. "USE_TEXTURE"
  488. ]
  489. }
  490. ],
  491. "buffers": [],
  492. "images": []
  493. },
  494. "statistics": {
  495. "CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS": 56,
  496. "CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS": 1
  497. }
  498. },
  499. "defines": [
  500. {
  501. "name": "USE_LOCAL",
  502. "type": "boolean",
  503. "defines": []
  504. },
  505. {
  506. "name": "SAMPLE_FROM_RT",
  507. "type": "boolean",
  508. "defines": []
  509. },
  510. {
  511. "name": "USE_PIXEL_ALIGNMENT",
  512. "type": "boolean",
  513. "defines": []
  514. },
  515. {
  516. "name": "CC_USE_EMBEDDED_ALPHA",
  517. "type": "boolean",
  518. "defines": []
  519. },
  520. {
  521. "name": "USE_ALPHA_TEST",
  522. "type": "boolean",
  523. "defines": []
  524. },
  525. {
  526. "name": "USE_TEXTURE",
  527. "type": "boolean",
  528. "defines": []
  529. },
  530. {
  531. "name": "IS_GRAY",
  532. "type": "boolean",
  533. "defines": [
  534. "USE_TEXTURE"
  535. ]
  536. }
  537. ],
  538. "name": "for2d/builtin-sprite|sprite-vs:vert|sprite-fs:frag"
  539. }
  540. ],
  541. "combinations": [
  542. {}
  543. ],
  544. "hideInEditor": false
  545. }