Spine-Skeleton-Lit-Common-Shadow.cginc 669 B

123456789101112131415161718192021222324252627282930
  1. #ifndef SKELETON_LIT_COMMON_SHADOW_INCLUDED
  2. #define SKELETON_LIT_COMMON_SHADOW_INCLUDED
  3. #include "UnityCG.cginc"
  4. struct v2f {
  5. V2F_SHADOW_CASTER;
  6. float4 uvAndAlpha : TEXCOORD1;
  7. };
  8. uniform float4 _MainTex_ST;
  9. v2f vertShadow(appdata_base v, float4 vertexColor : COLOR) {
  10. v2f o;
  11. TRANSFER_SHADOW_CASTER(o)
  12. o.uvAndAlpha.xy = TRANSFORM_TEX(v.texcoord, _MainTex);
  13. o.uvAndAlpha.z = 0;
  14. o.uvAndAlpha.a = vertexColor.a;
  15. return o;
  16. }
  17. uniform sampler2D _MainTex;
  18. uniform fixed SHADOW_CUTOFF;
  19. float4 fragShadow (v2f i) : SV_Target {
  20. fixed4 texcol = tex2D(_MainTex, i.uvAndAlpha.xy);
  21. clip(texcol.a * i.uvAndAlpha.a - SHADOW_CUTOFF);
  22. SHADOW_CASTER_FRAGMENT(i)
  23. }
  24. #endif