StencilParameters
Holds stencil test settings.
Summary
Static Properties
DEFAULT | A default stencil state.[read only] |
Properties
fail | Operation to perform if stencil test is failed. |
func | A comparison function that decides if the pixel should be written, based on the current stencil buffer value, reference value, and mask value. |
readMask | Mask applied to stencil buffer value and reference value before comparison. |
ref | Sets stencil test reference value used in comparisons. |
writeMask | A bit mask applied to the stencil value, when written. |
zfail | Operation to perform if depth test is failed. |
zpass | Operation to perform if both stencil and depth test are passed. |
Methods
clone | Clone the stencil parameters. |
copy | Copies the contents of a source stencil parameters to this stencil parameters. |
Details
Static Properties
DEFAULT | A default stencil state. [read only] |
Constructor
StencilParameters([options])
Create a new StencilParameters instance.
Parameters
options | object | Options object to configure the stencil parameters. |
Properties
Operation to perform if stencil test is failed. Can be:
- STENCILOP_KEEP: don't change the stencil buffer value
- STENCILOP_ZERO: set value to zero
- STENCILOP_REPLACE: replace value with the reference value.
- STENCILOP_INCREMENT: increment the value
- STENCILOP_INCREMENTWRAP: increment the value, but wrap it to zero when it's larger than a maximum representable value
- STENCILOP_DECREMENT: decrement the value
- STENCILOP_DECREMENTWRAP: decrement the value, but wrap it to a maximum representable value, if the current value is 0
- STENCILOP_INVERT: invert the value bitwise
A comparison function that decides if the pixel should be written, based on the current stencil buffer value, reference value, and mask value. Can be:
- FUNC_NEVER: never pass
- FUNC_LESS: pass if (ref & mask) < (stencil & mask)
- FUNC_EQUAL: pass if (ref & mask) == (stencil & mask)
- FUNC_LESSEQUAL: pass if (ref & mask) <= (stencil & mask)
- FUNC_GREATER: pass if (ref & mask) > (stencil & mask)
- FUNC_NOTEQUAL: pass if (ref & mask) != (stencil & mask)
- FUNC_GREATEREQUAL: pass if (ref & mask) >= (stencil & mask)
- FUNC_ALWAYS: always pass
Operation to perform if both stencil and depth test are passed. Accepts the same values as
fail
.
Methods
clone()
Clone the stencil parameters.
Returns
StencilParametersA cloned StencilParameters object.
copy(rhs)
Copies the contents of a source stencil parameters to this stencil parameters.
Parameters
rhs | StencilParameters | A stencil parameters to copy from. |
Returns
StencilParametersSelf for chaining.