Skip to content

Commit

Permalink
Fixed: Color effect on shadow is incorrect. #55
Browse files Browse the repository at this point in the history
  • Loading branch information
mob-sakai committed Apr 11, 2018
1 parent ad4b358 commit cb35a2a
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions Assets/UIEffect/UIEffect.cs
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ public static string GetVariantName(Shader shader, ToneMode tone, ColorMode colo
/// Append shadow vertices.
/// * It is similar to Shadow component implementation.
/// </summary>
static void _ApplyShadow(List<UIVertex> verts, ref int start, ref int end, ShadowStyle mode, float toneLevel, float blur, Vector2 effectDistance, Color color, bool useGraphicAlpha)
void _ApplyShadow(List<UIVertex> verts, ref int start, ref int end, ShadowStyle mode, float toneLevel, float blur, Vector2 effectDistance, Color color, bool useGraphicAlpha)
{
if (ShadowStyle.None == mode)
return;
Expand Down Expand Up @@ -448,7 +448,7 @@ static void _ApplyShadow(List<UIVertex> verts, ref int start, ref int end, Shado
/// Append shadow vertices.
/// * It is similar to Shadow component implementation.
/// </summary>
static void _ApplyShadowZeroAlloc(List<UIVertex> verts, ref int start, ref int end, float x, float y, Vector2 factor, Color color, bool useGraphicAlpha)
void _ApplyShadowZeroAlloc(List<UIVertex> verts, ref int start, ref int end, float x, float y, Vector2 factor, Color color, bool useGraphicAlpha)
{
// Check list capacity.
var neededCapacity = verts.Count + end - start;
Expand All @@ -467,6 +467,12 @@ static void _ApplyShadowZeroAlloc(List<UIVertex> verts, ref int start, ref int e
vt.position.Set(v.x + x, v.y + y, v.z);

Color vertColor = color;

if(colorMode != ColorMode.None)
{
vertColor.r = vertColor.g = vertColor.b = 1;
}

vertColor.a = useGraphicAlpha ? color.a * vt.color.a / 255 : color.a;
vt.color = vertColor;

Expand Down

0 comments on commit cb35a2a

Please sign in to comment.