StencilState
final class StencilState
Package: dev.joid.lib.bridge.render.state · Module: core · Source: StencilState.java
The immutable stencil settings of the render state, comparison, reference, mask and the three operations.
Description
Section titled “Description”The core sets it through stencil(...) of the RenderState for the masks: a first draw writes a region into the stencil buffer, and the next draws pass only where the comparison holds.
A backend reads it from the state at each draw and maps each value to its API, such as glStencilFunc and glStencilOp or the stencil state of a pipeline.
Two equal states compare equal.
The stencil applies to the window only: the core never uses a stencil in a framebuffer.
Learn more
Section titled “Learn more”Creation
Section titled “Creation”| Returns | Signature | Summary |
|---|---|---|
StencilState | of(StencilFunction function, int reference, int mask, StencilOperation fail, StencilOperation depthFail, StencilOperation pass) factory | Creates a state with the stencil on. |
Methods
Section titled “Methods”| Returns | Signature | Summary |
|---|---|---|
boolean | isEnabled() | If false, the stencil is ignored: every fragment passes and the buffer is never written. |
StencilFunction | getFunction() | Returns the comparison between the reference and the stored value. |
int | getReference() | Returns the value compared with the stored one, and written by REPLACE. |
int | getMask() | Returns the bits that the comparison reads. |
StencilOperation | getFail() | Returns the operation applied to the stored value when the comparison fails. |
StencilOperation | getDepthFail() | Returns the operation applied when the comparison passes and the depth test fails. |
StencilOperation | getPass() | Returns the operation applied when the comparison and the depth test pass. |
boolean | equals(Object other) | If true, the other object is of the same class with the same switch, function, reference, mask and operations. |
int | hashCode() | Returns a hash of the values that equals compares. |
Constants and fields
Section titled “Constants and fields”| Type | Name | Value | Summary |
|---|---|---|---|
StencilState | DISABLED | The state with the stencil off, the stencil of a fresh render state. |
Creation details
Section titled “Creation details”StencilState of(StencilFunction function, int reference, int mask, StencilOperation fail, StencilOperation depthFail, StencilOperation pass) factory
Creates a state with the stencil on.
A fragment passes when function holds between reference & mask and the stored value & mask; fail applies when the comparison fails, depthFail when it passes but the depth test fails, and pass when both pass.
Method details
Section titled “Method details”isEnabled
Section titled “isEnabled”boolean isEnabled()
If false, the stencil is ignored: every fragment passes and the buffer is never written.
getFunction
Section titled “getFunction”StencilFunction getFunction()
Returns the comparison between the reference and the stored value.
getReference
Section titled “getReference”int getReference()
Returns the value compared with the stored one, and written by REPLACE.
getMask
Section titled “getMask”int getMask()
Returns the bits that the comparison reads.
getFail
Section titled “getFail”StencilOperation getFail()
Returns the operation applied to the stored value when the comparison fails.
getDepthFail
Section titled “getDepthFail”StencilOperation getDepthFail()
Returns the operation applied when the comparison passes and the depth test fails.
getPass
Section titled “getPass”StencilOperation getPass()
Returns the operation applied when the comparison and the depth test pass.
equals
Section titled “equals”boolean equals(Object other)
If true, the other object is of the same class with the same switch, function, reference, mask and operations.
hashCode
Section titled “hashCode”int hashCode()
Returns a hash of the values that equals compares.
Constant and field details
Section titled “Constant and field details”DISABLED
Section titled “DISABLED”StencilState DISABLED
The state with the stencil off, the stencil of a fresh render state.
fluent returns the instance, typed for chaining · factory creates an instance · signal also accepts a value that follows signals, as a signal, an expression or a lambda (When does JOID compute this value again?) · hook called by JOID, override it · abstract you implement it · default interface method with a body · static called on the class · protected visible to subclasses
