064ae782-abda-4f01-b374-fa8eaed467c1.json 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. {
  2. "__type__": "cc.EffectAsset",
  3. "_name": "kuang",
  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. "width": {
  33. "value": [
  34. 0.05
  35. ],
  36. "type": 13
  37. },
  38. "height": {
  39. "value": [
  40. 0.05
  41. ],
  42. "type": 13
  43. }
  44. },
  45. "program": "kuang|vs|fs"
  46. }
  47. ]
  48. }
  49. ],
  50. "shaders": [
  51. {
  52. "hash": 2700426003,
  53. "glsl3": {
  54. "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}",
  55. "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\nuniform Props{\n float width;\n float height;\n};\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 if(v_uv0.x > width && v_uv0.x < 1.0 - width){\n if(v_uv0.y > height && v_uv0.y < 1.0 - height){\n o.a = 0.0;\n }\n }\n o *= v_color;\n ALPHA_TEST(o);\n gl_FragColor = o;\n}"
  56. },
  57. "glsl1": {
  58. "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}",
  59. "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\nuniform float width;\nuniform float height;\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 if(v_uv0.x > width && v_uv0.x < 1.0 - width){\n if(v_uv0.y > height && v_uv0.y < 1.0 - height){\n o.a = 0.0;\n }\n }\n o *= v_color;\n ALPHA_TEST(o);\n gl_FragColor = o;\n}"
  60. },
  61. "builtins": {
  62. "globals": {
  63. "blocks": [
  64. {
  65. "name": "CCGlobal",
  66. "defines": []
  67. }
  68. ],
  69. "samplers": []
  70. },
  71. "locals": {
  72. "blocks": [
  73. {
  74. "name": "CCLocal",
  75. "defines": []
  76. }
  77. ],
  78. "samplers": []
  79. }
  80. },
  81. "defines": [
  82. {
  83. "name": "USE_TEXTURE",
  84. "type": "boolean",
  85. "defines": []
  86. },
  87. {
  88. "name": "CC_USE_MODEL",
  89. "type": "boolean",
  90. "defines": []
  91. },
  92. {
  93. "name": "USE_ALPHA_TEST",
  94. "type": "boolean",
  95. "defines": []
  96. },
  97. {
  98. "name": "CC_USE_ALPHA_ATLAS_texture",
  99. "type": "boolean",
  100. "defines": [
  101. "USE_TEXTURE"
  102. ]
  103. },
  104. {
  105. "name": "INPUT_IS_GAMMA",
  106. "type": "boolean",
  107. "defines": [
  108. "USE_TEXTURE"
  109. ]
  110. }
  111. ],
  112. "blocks": [
  113. {
  114. "name": "ALPHA_TEST",
  115. "members": [
  116. {
  117. "name": "alphaThreshold",
  118. "type": 13,
  119. "count": 1
  120. }
  121. ],
  122. "defines": [
  123. "USE_ALPHA_TEST"
  124. ],
  125. "binding": 0
  126. },
  127. {
  128. "name": "Props",
  129. "members": [
  130. {
  131. "name": "width",
  132. "type": 13,
  133. "count": 1
  134. },
  135. {
  136. "name": "height",
  137. "type": 13,
  138. "count": 1
  139. }
  140. ],
  141. "defines": [],
  142. "binding": 1
  143. }
  144. ],
  145. "samplers": [
  146. {
  147. "name": "texture",
  148. "type": 29,
  149. "count": 1,
  150. "defines": [
  151. "USE_TEXTURE"
  152. ],
  153. "binding": 30
  154. }
  155. ],
  156. "record": null,
  157. "name": "kuang|vs|fs"
  158. }
  159. ]
  160. }