Seven is the number.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

62 lines
1.3 KiB

3 years ago
  1. #pragma target 2.0
  2. #include "UnityCG.cginc"
  3. #include "UnityUI.cginc"
  4. #pragma multi_compile_local _ UNITY_UI_CLIP_RECT
  5. #pragma multi_compile_local _ UNITY_UI_ALPHACLIP
  6. struct appdata_t
  7. {
  8. float4 vertex : POSITION;
  9. float4 color : COLOR;
  10. float2 texcoord : TEXCOORD0;
  11. UNITY_VERTEX_INPUT_INSTANCE_ID
  12. };
  13. struct v2f
  14. {
  15. float4 vertex : SV_POSITION;
  16. fixed4 color : COLOR;
  17. float2 texcoord : TEXCOORD0;
  18. float4 worldPosition : TEXCOORD1;
  19. UNITY_VERTEX_OUTPUT_STEREO
  20. };
  21. sampler2D _MainTex;
  22. fixed4 _TextureSampleAdd;
  23. float4 _ClipRect;
  24. float4 _MainTex_ST;
  25. v2f vert(appdata_t v)
  26. {
  27. v2f OUT;
  28. UNITY_SETUP_INSTANCE_ID(v);
  29. UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(OUT);
  30. OUT.worldPosition = v.vertex;
  31. OUT.vertex = UnityObjectToClipPos(OUT.worldPosition);
  32. OUT.texcoord = TRANSFORM_TEX(v.texcoord, _MainTex);
  33. OUT.color.a = v.color.a;
  34. OUT.color.rgb = v.color.rgb * v.color.a;
  35. return OUT;
  36. }
  37. fixed4 frag(v2f IN) : SV_Target
  38. {
  39. float4 color = (tex2D(_MainTex, IN.texcoord) + _TextureSampleAdd) * IN.color;
  40. #ifdef UNITY_UI_CLIP_RECT
  41. color.a *= UnityGet2DClipping(IN.worldPosition.xy, _ClipRect);
  42. #endif
  43. #ifdef UNITY_UI_ALPHACLIP
  44. clip (color.a - 0.001);
  45. #endif
  46. #ifdef DO_BLEND_POSTPROCESS
  47. DO_BLEND_POSTPROCESS
  48. #endif
  49. return color;
  50. }