Skip to content

Commit

Permalink
Adds support to allow the 'rounded corners' image to BE a mask itself…
Browse files Browse the repository at this point in the history
…, so that a mask itself can be rounded (via the mask's source image).
  • Loading branch information
ArthurD committed Mar 17, 2023
1 parent 10116ba commit b130613
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions UiRoundedCorners/IndependentRoundedCorners.shader
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@
}

float alpha = CalcAlphaForIndependentCorners(i.uv, _halfSize.xy, _rect2props, _r);

#ifdef UNITY_UI_ALPHACLIP
clip(alpha - 0.001);
#endif

return mixAlpha(tex2D(_MainTex, i.uv), i.color, alpha);
}

Expand Down
5 changes: 5 additions & 0 deletions UiRoundedCorners/RoundedCorners.shader
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ Shader "UI/RoundedCorners/RoundedCorners" {
}

float alpha = CalcAlpha(i.uv, _WidthHeightRadius.xy, _WidthHeightRadius.z);

#ifdef UNITY_UI_ALPHACLIP
clip(alpha - 0.001);
#endif

return mixAlpha(tex2D(_MainTex, i.uv), i.color, alpha);
}

Expand Down

0 comments on commit b130613

Please sign in to comment.