Skip to content

Commit

Permalink
Feature: Add ShadowMode: Shadow3. #11
Browse files Browse the repository at this point in the history
  • Loading branch information
Takashi Sakai committed Jan 15, 2018
1 parent 782ae2b commit 303fcfb
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions Assets/UIEffect/UIEffect.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ public enum ShadowMode
Shadow,
Outline,
Outline8,
Shadow3,
}

/// <summary>
Expand Down Expand Up @@ -384,17 +385,27 @@ static void ApplyShadow(List<UIVertex> verts, ref int start, ref int end, Shadow
// Append Shadow.
ApplyShadowZeroAlloc(s_Verts, ref start, ref end, effectDistance.x, effectDistance.y, factor, color, useGraphicAlpha);

// Append Shadow3.
if (ShadowMode.Shadow3 == mode)
{
ApplyShadowZeroAlloc(s_Verts, ref start, ref end, effectDistance.x, 0, factor, color, useGraphicAlpha);
ApplyShadowZeroAlloc(s_Verts, ref start, ref end, 0, effectDistance.y, factor, color, useGraphicAlpha);
}

// Append Outline.
if (ShadowMode.Outline <= mode)
else if (ShadowMode.Outline == mode)
{
ApplyShadowZeroAlloc(s_Verts, ref start, ref end, effectDistance.x, -effectDistance.y, factor, color, useGraphicAlpha);
ApplyShadowZeroAlloc(s_Verts, ref start, ref end, -effectDistance.x, effectDistance.y, factor, color, useGraphicAlpha);
ApplyShadowZeroAlloc(s_Verts, ref start, ref end, -effectDistance.x, -effectDistance.y, factor, color, useGraphicAlpha);
}

// Append Outline8.
if (ShadowMode.Outline8 <= mode)
else if (ShadowMode.Outline8 == mode)
{
ApplyShadowZeroAlloc(s_Verts, ref start, ref end, effectDistance.x, -effectDistance.y, factor, color, useGraphicAlpha);
ApplyShadowZeroAlloc(s_Verts, ref start, ref end, -effectDistance.x, effectDistance.y, factor, color, useGraphicAlpha);
ApplyShadowZeroAlloc(s_Verts, ref start, ref end, -effectDistance.x, -effectDistance.y, factor, color, useGraphicAlpha);
ApplyShadowZeroAlloc(s_Verts, ref start, ref end, -effectDistance.x, 0, factor, color, useGraphicAlpha);
ApplyShadowZeroAlloc(s_Verts, ref start, ref end, 0, -effectDistance.y, factor, color, useGraphicAlpha);
ApplyShadowZeroAlloc(s_Verts, ref start, ref end, effectDistance.x, 0, factor, color, useGraphicAlpha);
Expand Down

0 comments on commit 303fcfb

Please sign in to comment.