diff options
author | chai <chaifix@163.com> | 2021-05-08 23:15:13 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2021-05-08 23:15:13 +0800 |
commit | d07e14add74e017b52ab2371efeea1aa4ea10ced (patch) | |
tree | efd07869326e4c428f5bfe43fad0c2583d32a401 /Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/VertexModifiers/Outline.cs |
+init
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.cs | 44 |
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); + } + } +} |