30682f87-9f0d-4f17-8a44-72863791461b.json 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. {
  2. "__type__": "cc.EffectAsset",
  3. "_name": "builtin-2d-graphics",
  4. "_objFlags": 0,
  5. "_native": "",
  6. "properties": null,
  7. "techniques": [
  8. {
  9. "passes": [
  10. {
  11. "blendState": {
  12. "targets": [
  13. {
  14. "blend": true,
  15. "blendSrc": 1,
  16. "blendDst": 771,
  17. "blendSrcAlpha": 1,
  18. "blendDstAlpha": 771
  19. }
  20. ]
  21. },
  22. "rasterizerState": {
  23. "cullMode": 0
  24. },
  25. "properties": {
  26. "alphaThreshold": {
  27. "value": [
  28. 0.5
  29. ],
  30. "type": 13
  31. }
  32. },
  33. "program": "builtin-2d-graphics|vs|fs"
  34. }
  35. ]
  36. }
  37. ],
  38. "shaders": [
  39. {
  40. "hash": 550349795,
  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;\nin float a_dist;\nout float v_dist;\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n pos = cc_matViewProj * cc_matWorld * pos;\n v_color = a_color;\n v_dist = a_dist;\n gl_Position = pos;\n}",
  43. "frag": "\n#if CC_SUPPORT_standard_derivatives\n #extension GL_OES_standard_derivatives : enable\n#endif\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;\nin float v_dist;\nvoid main () {\n vec4 o = v_color;\n ALPHA_TEST(o);\n #if CC_SUPPORT_standard_derivatives\n float aa = fwidth(v_dist);\n #else\n float aa = 0.05;\n #endif\n float alpha = 1. - smoothstep(-aa, 0., abs(v_dist) - 1.0);\n o.rgb *= o.a;\n o *= alpha;\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;\nattribute float a_dist;\nvarying float v_dist;\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n pos = cc_matViewProj * cc_matWorld * pos;\n v_color = a_color;\n v_dist = a_dist;\n gl_Position = pos;\n}",
  47. "frag": "\n#if CC_SUPPORT_standard_derivatives\n #extension GL_OES_standard_derivatives : enable\n#endif\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;\nvarying float v_dist;\nvoid main () {\n vec4 o = v_color;\n ALPHA_TEST(o);\n #if CC_SUPPORT_standard_derivatives\n float aa = fwidth(v_dist);\n #else\n float aa = 0.05;\n #endif\n float alpha = 1. - smoothstep(-aa, 0., abs(v_dist) - 1.0);\n o.rgb *= o.a;\n o *= alpha;\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": "CC_SUPPORT_standard_derivatives",
  72. "type": "boolean",
  73. "defines": []
  74. },
  75. {
  76. "name": "USE_ALPHA_TEST",
  77. "type": "boolean",
  78. "defines": []
  79. }
  80. ],
  81. "blocks": [
  82. {
  83. "name": "ALPHA_TEST",
  84. "members": [
  85. {
  86. "name": "alphaThreshold",
  87. "type": 13,
  88. "count": 1
  89. }
  90. ],
  91. "defines": [
  92. "USE_ALPHA_TEST"
  93. ],
  94. "binding": 0
  95. }
  96. ],
  97. "samplers": [],
  98. "record": null,
  99. "name": "builtin-2d-graphics|vs|fs"
  100. }
  101. ]
  102. }