Package foundry.veil.api.client.util
Class ScissorStack
java.lang.Object
foundry.veil.api.client.util.ScissorStack
A utility class to manage scissor clipping regions.
This allows for restricting rendering to specific rectangular areas.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Clears all scissored regions and disables scissoring.boolean
containsPoint
(float x, float y) Checks if the current scissor region contains the x, y point.@Nullable net.minecraft.client.gui.navigation.ScreenRectangle
getTop()
boolean
isEmpty()
void
pop()
Removes the top scissor clipping region from the stack.void
push
(float x, float y, float width, float height) Pushes a new scissor clipping region onto the stack.void
push
(int x, int y, int width, int height) Pushes a new scissor clipping region onto the stack.int
size()
-
Constructor Details
-
ScissorStack
public ScissorStack()
-
-
Method Details
-
push
public void push(int x, int y, int width, int height) Pushes a new scissor clipping region onto the stack. The region is automatically constrained by any existing regions on the stack.- Parameters:
x
- The x-coordinate of the top-left cornery
- The y-coordinate of the top-left cornerwidth
- The width of the regionheight
- The height of the region
-
push
public void push(float x, float y, float width, float height) Pushes a new scissor clipping region onto the stack. The region is automatically constrained by any existing regions on the stack.- Parameters:
x
- The x-coordinate of the top-left cornery
- The y-coordinate of the top-left cornerwidth
- The width of the regionheight
- The height of the region- Since:
- 1.3.0
-
pop
public void pop()Removes the top scissor clipping region from the stack. If there are any regions remaining, the previous region is reapplied. -
getTop
@Nullable public @Nullable net.minecraft.client.gui.navigation.ScreenRectangle getTop()- Returns:
- The top of the scissor stack or
null
if scissoring is disabled - Since:
- 1.3.0
-
containsPoint
public boolean containsPoint(float x, float y) Checks if the current scissor region contains the x, y point.- Parameters:
x
- The x position to checky
- The y position to check- Returns:
- Whether that position is contained in the scissor bounds
- Since:
- 1.3.0
-
size
public int size()- Returns:
- The number of regions in the stack
- Since:
- 1.3.0
-
isEmpty
public boolean isEmpty()- Returns:
- Whether all regions have been popped
- Since:
- 1.3.0
-
clear
public void clear()Clears all scissored regions and disables scissoring.- Since:
- 1.3.0
-