79 lines
2.0 KiB
Plaintext
79 lines
2.0 KiB
Plaintext
Shader "Bamboo/ScratchCard/Brush"
|
|
{
|
|
Properties
|
|
{
|
|
_MainTex ("Sprite Texture", 2D) = "white" {}
|
|
_Color ("Tint", Color) = (1,1,1,1)
|
|
[PerRendererData] _OffsetScale ("Offset (xy) and Scale (zw)", Float) = (0, 0, 0, 0)
|
|
}
|
|
|
|
SubShader
|
|
{
|
|
Tags
|
|
{
|
|
"Queue"="Transparent"
|
|
"IgnoreProjector"="True"
|
|
"RenderType"="Transparent"
|
|
"PreviewType"="Plane"
|
|
"CanUseSpriteAtlas"="True"
|
|
}
|
|
|
|
Cull Off
|
|
Lighting Off
|
|
ZWrite Off
|
|
BlendOp RevSub
|
|
Blend Zero One, One One
|
|
|
|
Pass
|
|
{
|
|
Name "Default"
|
|
CGPROGRAM
|
|
#pragma vertex vert
|
|
#pragma fragment frag
|
|
#pragma target 2.0
|
|
|
|
#include "UnityCG.cginc"
|
|
#include "UnityUI.cginc"
|
|
|
|
struct appdata_t
|
|
{
|
|
float4 vertex : POSITION;
|
|
float4 color : COLOR;
|
|
float2 texcoord : TEXCOORD0;
|
|
};
|
|
|
|
struct v2f
|
|
{
|
|
float4 vertex : SV_POSITION;
|
|
fixed4 color : COLOR;
|
|
float2 texcoord : TEXCOORD0;
|
|
float4 worldPosition : TEXCOORD1;
|
|
};
|
|
|
|
sampler2D _MainTex;
|
|
fixed4 _Color;
|
|
float4 _ClipRect;
|
|
float4 _MainTex_ST;
|
|
float4 _OffsetScale;
|
|
|
|
v2f vert(appdata_t v)
|
|
{
|
|
v2f OUT;
|
|
|
|
OUT.worldPosition = (v.vertex + float4(_OffsetScale.xy, 0, 0));
|
|
OUT.vertex = UnityObjectToClipPos(OUT.worldPosition);
|
|
OUT.texcoord = TRANSFORM_TEX(v.texcoord, _MainTex) * _OffsetScale.zw;
|
|
OUT.color = v.color * _Color;
|
|
|
|
return OUT;
|
|
}
|
|
|
|
fixed4 frag(v2f IN) : SV_Target
|
|
{
|
|
half4 color = tex2D(_MainTex, IN.texcoord) * IN.color;
|
|
return color;
|
|
}
|
|
ENDCG
|
|
}
|
|
}
|
|
} |