Spine-SkeletonLit-UnlitPass-URP-2D.hlsl 925 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #ifndef SKELETONLIT_UNLIT_PASS_INCLUDED
  2. #define SKELETONLIT_UNLIT_PASS_INCLUDED
  3. struct Attributes
  4. {
  5. float3 positionOS : POSITION;
  6. float4 color : COLOR;
  7. float2 uv : TEXCOORD0;
  8. };
  9. struct Varyings
  10. {
  11. float4 positionCS : SV_POSITION;
  12. float4 color : COLOR;
  13. float2 uv : TEXCOORD0;
  14. };
  15. TEXTURE2D(_MainTex);
  16. SAMPLER(sampler_MainTex);
  17. float4 _MainTex_ST;
  18. Varyings UnlitVertex(Attributes attributes)
  19. {
  20. Varyings o = (Varyings)0;
  21. o.positionCS = TransformObjectToHClip(attributes.positionOS);
  22. o.uv = TRANSFORM_TEX(attributes.uv, _MainTex);
  23. o.uv = attributes.uv;
  24. o.color = attributes.color;
  25. return o;
  26. }
  27. float4 UnlitFragment(Varyings i) : SV_Target
  28. {
  29. half4 tex = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.uv);
  30. half4 main;
  31. #if defined(_STRAIGHT_ALPHA_INPUT)
  32. main.rgb = tex.rgb * i.color.rgb * tex.a;
  33. #else
  34. main.rgb = tex.rgb * i.color.rgb;
  35. #endif
  36. main.a = tex.a * i.color.a;
  37. return main;
  38. }
  39. #endif