浏览代码

Fix Rounded Rectangle

/main
Matt Dean 7 年前
当前提交
0364097d
共有 1 个文件被更改,包括 6 次插入7 次删除
  1. 13
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Procedural/Shape/RoundedRectangleNode.cs

13
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Procedural/Shape/RoundedRectangleNode.cs


return
@"
{
{precision}2 XMinAndMax = {precision}2(0.5 - Width / 2, 0.5 + Width / 2);
{precision}2 YMinAndMax = {precision}2(0.5 - Height / 2, 0.5 + Height / 2);
{precision} x = step( XMinAndMax.x, UV.x ) - step( XMinAndMax.y, UV.x );
{precision} y = step( YMinAndMax.x, UV.y ) - step( YMinAndMax.y, UV.y );
{precision} B = x * y;
Radius = min(abs(Radius), 0.5 * min(abs(Width), abs(Height)));
{precision}2 XMinAndMax = {precision}2(0.5 - abs(Width) / 2, 0.5 + abs(Width) / 2);
{precision}2 YMinAndMax = {precision}2(0.5 - abs(Height) / 2, 0.5 + abs(Height) / 2);
{precision} wide = (step( XMinAndMax.x, UV.x ) - step( XMinAndMax.y, UV.x )) * (step( YMinAndMax.x + Radius, UV.y ) - step( YMinAndMax.y - Radius, UV.y ));
{precision} tall = (step( XMinAndMax.x + Radius, UV.x ) - step( XMinAndMax.y - Radius, UV.x )) * (step( YMinAndMax.x, UV.y ) - step( YMinAndMax.y, UV.y ));
{precision} A = saturate(sw + se + nw + ne);
Out = A;
Out = saturate(wide + tall + sw + se + nw + ne);
}";
}
}
正在加载...
取消
保存