37 lines
881 B
HLSL
37 lines
881 B
HLSL
#ifndef BLUR_CG_INCLUDED
|
|
#define BLUR_CG_INCLUDED
|
|
|
|
#include "UnityCG.cginc"
|
|
|
|
struct appdata_t
|
|
{
|
|
float4 vertex : POSITION;
|
|
float2 texcoord: TEXCOORD0;
|
|
float4 color : COLOR;
|
|
};
|
|
|
|
struct v2f
|
|
{
|
|
float4 vertex : POSITION;
|
|
float4 uvgrab : TEXCOORD0;
|
|
float4 color : COLOR;
|
|
};
|
|
|
|
v2f vert(appdata_t v)
|
|
{
|
|
v2f o;
|
|
o.vertex = UnityObjectToClipPos(v.vertex);
|
|
#if UNITY_UV_STARTS_AT_TOP
|
|
float scale = -1.0;
|
|
#else
|
|
float scale = 1.0;
|
|
#endif
|
|
o.uvgrab.xy = (float2(o.vertex.x, o.vertex.y * scale) + o.vertex.w) * 0.5;
|
|
o.uvgrab.zw = o.vertex.zw;
|
|
o.color = v.color;
|
|
return o;
|
|
}
|
|
|
|
#define GRABXYPIXEL(kernelx, kernely) tex2Dproj( _GrabTexture, UNITY_PROJ_COORD(float4(i.uvgrab.x + _GrabTexture_TexelSize.x * kernelx, i.uvgrab.y + _GrabTexture_TexelSize.y * kernely, i.uvgrab.z, i.uvgrab.w)))
|
|
|
|
#endif // BLUR_CG_INCLUDED
|