d9956a56-5622-44a1-8b50-42449f24ecdd 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. // Effect Syntax Guide: https://docs.cocos.com/creator/manual/zh/shader/index.html
  2. CCEffect %{
  3. techniques:
  4. - name: opaque
  5. passes:
  6. - vert: legacy/main-functions/general-vs:vert # builtin header
  7. frag: unlit-fs:frag
  8. properties: &props
  9. mainTexture: { value: white }
  10. mainColor: { value: [1, 1, 1, 1], editor: { type: color } }
  11. - name: transparent
  12. passes:
  13. - vert: general-vs:vert # builtin header
  14. frag: unlit-fs:frag
  15. blendState:
  16. targets:
  17. - blend: true
  18. blendSrc: src_alpha
  19. blendDst: one_minus_src_alpha
  20. blendSrcAlpha: src_alpha
  21. blendDstAlpha: one_minus_src_alpha
  22. properties: *props
  23. }%
  24. CCProgram unlit-fs %{
  25. precision highp float;
  26. #include <legacy/output>
  27. #include <legacy/fog-fs>
  28. in vec2 v_uv;
  29. in vec3 v_position;
  30. uniform sampler2D mainTexture;
  31. uniform Constant {
  32. vec4 mainColor;
  33. };
  34. vec4 frag () {
  35. vec4 col = mainColor * texture(mainTexture, v_uv);
  36. CC_APPLY_FOG(col, v_position);
  37. return CCFragOutput(col);
  38. }
  39. }%