Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions Assets/Scripts/Core/UpdateContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public struct ClipInfo
public uint clipId;
public int rectMaskDepth;
public int referenceValue;
public int compareValue;
public bool reversed;
}

Expand Down Expand Up @@ -60,10 +61,12 @@ public void Begin()
batchingDepth = 0;
rectMaskDepth = 0;
stencilReferenceValue = 0;
stencilCompareValue = 0;
alpha = 1;
grayed = false;

clipped = false;
clipInfo = default;
_clipStack.Clear();

Stats.ObjectCount = 0;
Expand Down Expand Up @@ -181,6 +184,7 @@ public void EnterClipping(uint clipId, bool reversedMask)

clipInfo.clipId = clipId;
clipInfo.referenceValue = stencilReferenceValue;
clipInfo.compareValue = stencilCompareValue;
clipInfo.reversed = reversedMask;
clipped = true;
}
Expand All @@ -192,6 +196,7 @@ public void LeaveClipping()
{
clipInfo = _clipStack.Pop();
stencilReferenceValue = clipInfo.referenceValue;
stencilCompareValue = clipInfo.compareValue;
rectMaskDepth = clipInfo.rectMaskDepth;
clipped = stencilReferenceValue != 0 || rectMaskDepth != 0;
}
Expand All @@ -203,14 +208,19 @@ public void EnterPaintingMode()

clipInfo.rectMaskDepth = 0;
clipInfo.referenceValue = 0;
clipInfo.compareValue = 0;
clipInfo.reversed = false;
rectMaskDepth = 0;
stencilReferenceValue = 0;
stencilCompareValue = 0;
clipped = false;
}

public void LeavePaintingMode()
{
clipInfo = _clipStack.Pop();
stencilReferenceValue = clipInfo.referenceValue;
stencilCompareValue = clipInfo.compareValue;
rectMaskDepth = clipInfo.rectMaskDepth;
clipped = stencilReferenceValue != 0 || rectMaskDepth != 0;
}
Expand Down