summaryrefslogtreecommitdiff
path: root/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/Graphics
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2021-04-12 19:23:37 +0800
committerchai <chaifix@163.com>2021-04-12 19:23:37 +0800
commit5e7fdb87120bb1883b4358df6f3248c0fc43c917 (patch)
tree6a742e388cbbd3148473fb46b40ab8ede6d5aa51 /Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/Graphics
parent6aed8a5cf13145e6291e4e95ee6774d5e5b4b3b8 (diff)
*mask
Diffstat (limited to 'Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/Graphics')
-rw-r--r--Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/Graphics/MaskableGraphic.cs6
1 files changed, 6 insertions, 0 deletions
diff --git a/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/Graphics/MaskableGraphic.cs b/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/Graphics/MaskableGraphic.cs
index 51e2fe2..0d0f327 100644
--- a/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/Graphics/MaskableGraphic.cs
+++ b/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/Graphics/MaskableGraphic.cs
@@ -68,6 +68,7 @@ namespace UnityEngine.UI
if (m_ShouldRecalculateStencil)
{
var rootCanvas = MaskUtilities.FindRootSortOverrideCanvas(transform);
+ // Graphic在masks下的深度,如果不是0且没有mask组件意味着是普通的非mask用graphic(如果是0一定是mask用的graphic)
m_StencilValue = maskable ? MaskUtilities.GetStencilDepth(transform, rootCanvas) : 0;
m_ShouldRecalculateStencil = false;
}
@@ -78,6 +79,11 @@ namespace UnityEngine.UI
Mask maskComponent = GetComponent<Mask>();
if (m_StencilValue > 0 && (maskComponent == null || !maskComponent.IsActive()))
{
+ // Ref = (1 << stencilValue) - 1
+ // Op = Keep
+ // Func = Equal
+ // ReadMask = (1 << stencilValue) - 1
+ // WriteMask = 0
var maskMat = StencilMaterial.Add(toUse, (1 << m_StencilValue) - 1, StencilOp.Keep, CompareFunction.Equal, ColorWriteMask.All, (1 << m_StencilValue) - 1, 0);
StencilMaterial.Remove(m_MaskMaterial);
m_MaskMaterial = maskMat;