summaryrefslogtreecommitdiff
path: root/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/VertexModifiers/Outline.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/VertexModifiers/Outline.cs')
-rw-r--r--Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/VertexModifiers/Outline.cs44
1 files changed, 44 insertions, 0 deletions
diff --git a/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/VertexModifiers/Outline.cs b/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/VertexModifiers/Outline.cs
new file mode 100644
index 0000000..e14c862
--- /dev/null
+++ b/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/VertexModifiers/Outline.cs
@@ -0,0 +1,44 @@
+using System.Collections.Generic;
+
+namespace UnityEngine.UI
+{
+ [AddComponentMenu("UI/Effects/Outline", 15)]
+ public class Outline : Shadow
+ {
+ protected Outline()
+ {}
+
+ public override void ModifyMesh(VertexHelper vh)
+ {
+ if (!IsActive())
+ return;
+
+ var verts = ListPool<UIVertex>.Get();
+ vh.GetUIVertexStream(verts);
+
+ var neededCpacity = verts.Count * 5;
+ if (verts.Capacity < neededCpacity)
+ verts.Capacity = neededCpacity;
+
+ var start = 0;
+ var end = verts.Count;
+ ApplyShadowZeroAlloc(verts, effectColor, start, verts.Count, effectDistance.x, effectDistance.y);
+
+ start = end;
+ end = verts.Count;
+ ApplyShadowZeroAlloc(verts, effectColor, start, verts.Count, effectDistance.x, -effectDistance.y);
+
+ start = end;
+ end = verts.Count;
+ ApplyShadowZeroAlloc(verts, effectColor, start, verts.Count, -effectDistance.x, effectDistance.y);
+
+ start = end;
+ end = verts.Count;
+ ApplyShadowZeroAlloc(verts, effectColor, start, verts.Count, -effectDistance.x, -effectDistance.y);
+
+ vh.Clear();
+ vh.AddUIVertexTriangleStream(verts);
+ ListPool<UIVertex>.Release(verts);
+ }
+ }
+}