Documentation / device / StencilState
Interface: StencilState
Defined in: libs/device/src/render_states.ts:214
The render states related to the stencil buffer
Properties
enabled
enabled:
boolean
Defined in: libs/device/src/render_states.ts:218
true if stencil testing should be enabled
failOp
failOp:
StencilOp
Defined in: libs/device/src/render_states.ts:220
The function to use for front stencil state when the stencil test fails
failOpBack
failOpBack:
StencilOp
Defined in: libs/device/src/render_states.ts:222
The function to use for back stencil state when the stencil test fails of the back stencil state
zFailOp
zFailOp:
StencilOp
Defined in: libs/device/src/render_states.ts:224
The function to use for front stencil state when the stencil test passes but depth test fails
zFailOpBack
zFailOpBack:
StencilOp
Defined in: libs/device/src/render_states.ts:226
The function to use for back stencil state when the stencil test passes but depth test fails
passOp
passOp:
StencilOp
Defined in: libs/device/src/render_states.ts:228
The function to use for front stencil state when both the stencil test and the depth test pass
passOpBack
passOpBack:
StencilOp
Defined in: libs/device/src/render_states.ts:230
The function to use for back stencil state when both the stencil test and the depth test pass
func
func:
CompareFunc
Defined in: libs/device/src/render_states.ts:232
The test function for front stencil state
funcBack
funcBack:
CompareFunc
Defined in: libs/device/src/render_states.ts:234
The test function for back stencil state
ref
ref:
number
Defined in: libs/device/src/render_states.ts:236
The reference value for the stencil test
writeMask
writeMask:
number
Defined in: libs/device/src/render_states.ts:238
A bit mask to control which bits can be written while writing to the stencil buffer
readMask
readMask:
number
Defined in: libs/device/src/render_states.ts:240
A bit mask that is used to AND the reference value and the stored stencil value
Methods
clone()
clone():
StencilState
Defined in: libs/device/src/render_states.ts:216
Creates a new StencilState by copying this one
Returns
StencilState
enable()
enable(
b):this
Defined in: libs/device/src/render_states.ts:246
Enables or disables the stencil test
Parameters
b
boolean
true if stencil test should be enabled
Returns
this
self
setFrontOp()
setFrontOp(
fail,zfail,pass):this
Defined in: libs/device/src/render_states.ts:254
Sets the stencil operations for front stencil state
Parameters
fail
The function to use when the stencil test fails
zfail
The function to use when the stencil test passes bug depth test fails
pass
The function to use when both the stencil test and the depth test pass
Returns
this
self
setBackOp()
setBackOp(
fail,zfail,pass):this
Defined in: libs/device/src/render_states.ts:262
Sets the stencil operations for back stencil state
Parameters
fail
The function to use when the stencil test fails
zfail
The function to use when the stencil test passes bug depth test fails
pass
The function to use when both the stencil test and the depth test pass
Returns
this
self
setFrontCompareFunc()
setFrontCompareFunc(
func):this
Defined in: libs/device/src/render_states.ts:268
Sets the compare function for front stencil state
Parameters
func
The compare function
Returns
this
self
setBackCompareFunc()
setBackCompareFunc(
func):this
Defined in: libs/device/src/render_states.ts:274
Sets the compare function for back stencil state
Parameters
func
The compare function
Returns
this
self
setReference()
setReference(
ref):this
Defined in: libs/device/src/render_states.ts:280
Sets the reference value for the stencil test
Parameters
ref
number
The reference value
Returns
this
self
setWriteMask()
setWriteMask(
mask):this
Defined in: libs/device/src/render_states.ts:286
Sets the bit mask for writing to the stencil buffer
Parameters
mask
number
The write mask
Returns
this
self
setReadMask()
setReadMask(
mask):this
Defined in: libs/device/src/render_states.ts:292
Sets the bit mask for reading from the stencil buffer and reference value
Parameters
mask
number
The read mask
Returns
this
self