diff options
author | chai <chaifix@163.com> | 2021-04-12 19:23:37 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2021-04-12 19:23:37 +0800 |
commit | 5e7fdb87120bb1883b4358df6f3248c0fc43c917 (patch) | |
tree | 6a742e388cbbd3148473fb46b40ab8ede6d5aa51 /Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/Graphics | |
parent | 6aed8a5cf13145e6291e4e95ee6774d5e5b4b3b8 (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.cs | 6 |
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; |