-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcounter_gradient.fx
32 lines (29 loc) · 940 Bytes
/
counter_gradient.fx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
bool vert;
float center;
float counter;
int dir;
float4 color1;
float4 color2;
float4 ps_main(in float2 texCoord : TEXCOORD0) : COLOR0
{
float gradient= vert ? texCoord.y/center : texCoord.x/center;
float4 output=lerp(color1,color2,gradient);
if(dir==0)
{
output*= float4(texCoord.x < counter, texCoord.x < counter, texCoord.x < counter, texCoord.x < counter);
}
if(dir==1)
{
output*= float4(texCoord.x > 1.0-counter, texCoord.x > 1.0-counter, texCoord.x > 1.0-counter, texCoord.x > 1.0-counter);
}
if(dir==2)
{
output*= float4(texCoord.y < counter, texCoord.y < counter, texCoord.y < counter, texCoord.y < counter);
}
if(dir==3)
{
output*= float4(texCoord.y > 1.0-counter, texCoord.y > 1.0-counter, texCoord.y > 1.0-counter, texCoord.y > 1.0-counter);
}
return output;
}
technique tech_main { pass P0 {PixelShader = compile ps_2_0 ps_main();}}