Skip to content

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.

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.

ReturnsSignatureSummary
StencilStateof(StencilFunction function, int reference, int mask, StencilOperation fail, StencilOperation depthFail, StencilOperation pass) factoryCreates a state with the stencil on.

ReturnsSignatureSummary
booleanisEnabled()If false, the stencil is ignored: every fragment passes and the buffer is never written.
StencilFunctiongetFunction()Returns the comparison between the reference and the stored value.
intgetReference()Returns the value compared with the stored one, and written by REPLACE.
intgetMask()Returns the bits that the comparison reads.
StencilOperationgetFail()Returns the operation applied to the stored value when the comparison fails.
StencilOperationgetDepthFail()Returns the operation applied when the comparison passes and the depth test fails.
StencilOperationgetPass()Returns the operation applied when the comparison and the depth test pass.
booleanequals(Object other)If true, the other object is of the same class with the same switch, function, reference, mask and operations.
inthashCode()Returns a hash of the values that equals compares.
TypeNameValueSummary
StencilStateDISABLEDThe state with the stencil off, the stencil of a fresh render state.

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.

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.

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

Report a problem with this page