HLSL:径向切割纹理
HLSL: Cut a texture radially
我目前正在使用像素着色器:
float4 PixelShaderFunction(float2 coords: TEXCOORD0) : COLOR0
{
float4 color = tex2D(Sampler0,coords);
float dx = coords.x - 0.5f;
float dy = coords.y - 0.5f;
float tpos = dx * dx + dy * dy;
if(tpos <= 0.25f && tpos > 0.25f-width )
return color;
else
return float4(0.0f, 0.0f, 0.0f, 0.0f);
}
这样我就可以画圆了。但是我该如何切割圆圈,例如画30度圆?还是60度一个?
谢谢
我目前正在使用像素着色器:
float4 PixelShaderFunction(float2 coords: TEXCOORD0) : COLOR0
{
float4 color = tex2D(Sampler0,coords);
float dx = coords.x - 0.5f;
float dy = coords.y - 0.5f;
float tpos = dx * dx + dy * dy;
if(tpos <= 0.25f && tpos > 0.25f-width )
return color;
else
return float4(0.0f, 0.0f, 0.0f, 0.0f);
}
这样我就可以画圆了。但是我该如何切割圆圈,例如画30度圆?还是60度一个? 谢谢