2874f8dd-416c-4440-81b7-555975426e93.json 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. {
  2. "__type__": "cc.EffectAsset",
  3. "_name": "builtin-2d-sprite",
  4. "_objFlags": 0,
  5. "_native": "",
  6. "properties": null,
  7. "techniques": [
  8. {
  9. "passes": [
  10. {
  11. "blendState": {
  12. "targets": [
  13. {
  14. "blend": true
  15. }
  16. ]
  17. },
  18. "rasterizerState": {
  19. "cullMode": 0
  20. },
  21. "properties": {
  22. "texture": {
  23. "value": "white",
  24. "type": 29
  25. },
  26. "alphaThreshold": {
  27. "value": [
  28. 0.5
  29. ],
  30. "type": 13
  31. }
  32. },
  33. "program": "builtin-2d-sprite|vs|fs"
  34. }
  35. ]
  36. }
  37. ],
  38. "shaders": [
  39. {
  40. "hash": 3278106612,
  41. "glsl3": {
  42. "vert": "\nprecision highp float;\nuniform CCGlobal {\n mat4 cc_matView;\n mat4 cc_matViewInv;\n mat4 cc_matProj;\n mat4 cc_matProjInv;\n mat4 cc_matViewProj;\n mat4 cc_matViewProjInv;\n vec4 cc_cameraPos;\n vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_screenScale;\n};\nuniform CCLocal {\n mat4 cc_matWorld;\n mat4 cc_matWorldIT;\n};\nin vec3 a_position;\nin vec4 a_color;\nout vec4 v_color;\n#if USE_TEXTURE\nin vec2 a_uv0;\nout vec2 v_uv0;\n#endif\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n #if CC_USE_MODEL\n pos = cc_matViewProj * cc_matWorld * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n #if USE_TEXTURE\n v_uv0 = a_uv0;\n #endif\n v_color = a_color;\n gl_Position = pos;\n}",
  43. "frag": "\nprecision highp float;\n#if USE_ALPHA_TEST\n uniform ALPHA_TEST {\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 v_color;\n#if USE_TEXTURE\nin vec2 v_uv0;\nuniform sampler2D texture;\n#endif\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n #if USE_TEXTURE\n vec4 texture_tmp = texture(texture, v_uv0);\n #if CC_USE_ALPHA_ATLAS_texture\n texture_tmp.a *= texture(texture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #if INPUT_IS_GAMMA\n o.rgb *= (texture_tmp.rgb * texture_tmp.rgb);\n o.a *= texture_tmp.a;\n #else\n o *= texture_tmp;\n #endif\n #endif\n o *= v_color;\n ALPHA_TEST(o);\n gl_FragColor = o;\n}"
  44. },
  45. "glsl1": {
  46. "vert": "\nprecision highp float;\nuniform mat4 cc_matViewProj;\nuniform mat4 cc_matWorld;\nattribute vec3 a_position;\nattribute vec4 a_color;\nvarying vec4 v_color;\n#if USE_TEXTURE\nattribute vec2 a_uv0;\nvarying vec2 v_uv0;\n#endif\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n #if CC_USE_MODEL\n pos = cc_matViewProj * cc_matWorld * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n #if USE_TEXTURE\n v_uv0 = a_uv0;\n #endif\n v_color = a_color;\n gl_Position = pos;\n}",
  47. "frag": "\nprecision highp float;\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 v_color;\n#if USE_TEXTURE\nvarying vec2 v_uv0;\nuniform sampler2D texture;\n#endif\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n #if USE_TEXTURE\n vec4 texture_tmp = texture2D(texture, v_uv0);\n #if CC_USE_ALPHA_ATLAS_texture\n texture_tmp.a *= texture2D(texture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #if INPUT_IS_GAMMA\n o.rgb *= (texture_tmp.rgb * texture_tmp.rgb);\n o.a *= texture_tmp.a;\n #else\n o *= texture_tmp;\n #endif\n #endif\n o *= v_color;\n ALPHA_TEST(o);\n gl_FragColor = o;\n}"
  48. },
  49. "builtins": {
  50. "globals": {
  51. "blocks": [
  52. {
  53. "name": "CCGlobal",
  54. "defines": []
  55. }
  56. ],
  57. "samplers": []
  58. },
  59. "locals": {
  60. "blocks": [
  61. {
  62. "name": "CCLocal",
  63. "defines": []
  64. }
  65. ],
  66. "samplers": []
  67. }
  68. },
  69. "defines": [
  70. {
  71. "name": "USE_TEXTURE",
  72. "type": "boolean",
  73. "defines": []
  74. },
  75. {
  76. "name": "CC_USE_MODEL",
  77. "type": "boolean",
  78. "defines": []
  79. },
  80. {
  81. "name": "USE_ALPHA_TEST",
  82. "type": "boolean",
  83. "defines": []
  84. },
  85. {
  86. "name": "CC_USE_ALPHA_ATLAS_texture",
  87. "type": "boolean",
  88. "defines": [
  89. "USE_TEXTURE"
  90. ]
  91. },
  92. {
  93. "name": "INPUT_IS_GAMMA",
  94. "type": "boolean",
  95. "defines": [
  96. "USE_TEXTURE"
  97. ]
  98. }
  99. ],
  100. "blocks": [
  101. {
  102. "name": "ALPHA_TEST",
  103. "members": [
  104. {
  105. "name": "alphaThreshold",
  106. "type": 13,
  107. "count": 1
  108. }
  109. ],
  110. "defines": [
  111. "USE_ALPHA_TEST"
  112. ],
  113. "binding": 0
  114. }
  115. ],
  116. "samplers": [
  117. {
  118. "name": "texture",
  119. "type": 29,
  120. "count": 1,
  121. "defines": [
  122. "USE_TEXTURE"
  123. ],
  124. "binding": 30
  125. }
  126. ],
  127. "record": null,
  128. "name": "builtin-2d-sprite|vs|fs"
  129. }
  130. ]
  131. }