attacked.effect 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. // Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
  2. CCEffect %{
  3. techniques:
  4. - passes:
  5. - vert: vs
  6. frag: fs
  7. blendState:
  8. targets:
  9. - blend: true
  10. rasterizerState:
  11. cullMode: none
  12. properties:
  13. texture: { value: white }
  14. alphaThreshold: { value: 0.5 }
  15. addColor: { value: [0.8, 0.8, 0.8, 0.8] }
  16. }%
  17. CCProgram vs %{
  18. precision highp float;
  19. #include <cc-global>
  20. #include <cc-local>
  21. in vec3 a_position;
  22. in vec4 a_color;
  23. out vec4 v_color;
  24. #if USE_TEXTURE
  25. in vec2 a_uv0;
  26. out vec2 v_uv0;
  27. #endif
  28. void main () {
  29. vec4 pos = vec4(a_position, 1);
  30. #if CC_USE_MODEL
  31. pos = cc_matViewProj * cc_matWorld * pos;
  32. #else
  33. pos = cc_matViewProj * pos;
  34. #endif
  35. #if USE_TEXTURE
  36. v_uv0 = a_uv0;
  37. #endif
  38. v_color = a_color;
  39. gl_Position = pos;
  40. }
  41. }%
  42. CCProgram fs %{
  43. precision highp float;
  44. #include <alpha-test>
  45. in vec4 v_color;
  46. #if USE_TEXTURE
  47. in vec2 v_uv0;
  48. uniform sampler2D texture;
  49. #endif
  50. uniform LAMYOUM_COM{
  51. vec4 addColor;
  52. };
  53. void main () {
  54. vec4 o = vec4(1, 1, 1, 1);
  55. #if USE_TEXTURE
  56. o *= texture(texture, v_uv0);
  57. #if CC_USE_ALPHA_ATLAS_TEXTURE
  58. o.a *= texture2D(texture, v_uv0 + vec2(0, 0.5)).r;
  59. #endif
  60. #endif
  61. #if USE_TINT
  62. #endif
  63. o *= v_color;
  64. o.rgb = addColor.rgb;
  65. ALPHA_TEST(o);
  66. gl_FragColor = o;
  67. }
  68. }%