StencilComparison is an Enum which describes the comparison operation that is performed during a Stencil test.
It can take on the following possible values:
- Always - (Default) Stencil test always passes no matter what
- Disabled - No stencil test is performed
- Never - Stencil test always fails
- Less - Stencil test passes only if the compared ID is less than the given ID
- Equal - Stencil test passes if the compared ID is exactly equal to the given ID
- LessOrEqual - Stencil test passes if the compared ID is exactly equal or less than the given ID
- Greater - Stencil test passes only if the compared ID is greater than the given ID
- NotEqual - Stencil test passes only if the compared ID is not equal to the given ID
- GreaterOrEqual - Stencil test passes if the compared ID is exactly equal or greater than the given ID
Usage
The comparsion operation is used in conjunction with other Stencil settings in order to perform a full test.
A very common operation mode is to compare for exact equality using the Equal mode to only draw in areas where the stencil value is equal to a specific ID.
Another common mode is to use Always in conjunction with the Replace StencilOperation to overwrite the current stencil value with a given ID.