Struct DepthStencilStencilOpDescription
Describes the stencil operations and comparison function used during stencil testing for a given face orientation (front or back).
[DataContract]
public struct DepthStencilStencilOpDescription : IEquatable<DepthStencilStencilOpDescription>
- Implements
- Inherited Members
- Extension Methods
Remarks
This structure defines how the stencil buffer is updated based on the outcome of the stencil and depth tests. It is used in DepthStencilStateDescription to configure separate behavior for front-facing and back-facing polygons.
Constructors
DepthStencilStencilOpDescription()
Initializes a new instance of the DepthStencilStencilOpDescription structure with default values.
public DepthStencilStencilOpDescription()
Remarks
<ul><li>
Always keep the current value (<xref href="Stride.Graphics.StencilOperation.Keep" data-throw-if-not-resolved="false"></xref>) in all cases
(i.e., <xref href="Stride.Graphics.DepthStencilStencilOpDescription.StencilFail" data-throw-if-not-resolved="false"></xref>, <xref href="Stride.Graphics.DepthStencilStencilOpDescription.StencilDepthBufferFail" data-throw-if-not-resolved="false"></xref>, and <xref href="Stride.Graphics.DepthStencilStencilOpDescription.StencilPass" data-throw-if-not-resolved="false"></xref>).
</li><li>A comparison function that always passes (<xref href="Stride.Graphics.CompareFunction.Always" data-throw-if-not-resolved="false"></xref>).</li></ul>
</remarks>
Fields
Default
A Depth-Stencil Operation description with default values.
public static readonly DepthStencilStencilOpDescription Default
Field Value
Remarks
The default values are:
- Always keep the current value (Keep) in all cases (i.e., StencilFail, StencilDepthBufferFail, and StencilPass).
- A comparison function that always passes (Always).
DefaultStencilDepthBufferFail
Default value for StencilDepthBufferFail.
public const StencilOperation DefaultStencilDepthBufferFail = Keep
Field Value
DefaultStencilFail
Default value for StencilFail.
public const StencilOperation DefaultStencilFail = Keep
Field Value
DefaultStencilFunction
Default value for StencilFunction.
public const CompareFunction DefaultStencilFunction = Always
Field Value
DefaultStencilPass
Default value for StencilPass.
public const StencilOperation DefaultStencilPass = Keep
Field Value
StencilDepthBufferFail
Specifies the stencil operation to perform when the stencil test passes but the depth test fails.
public StencilOperation StencilDepthBufferFail
Field Value
Remarks
This is useful for effects like shadow volumes, where depth failure indicates occlusion.
StencilFail
Specifies the stencil operation to perform when the stencil test fails.
public StencilOperation StencilFail
Field Value
Remarks
This operation is applied regardless of the result of the depth test. Common values include Keep (no change) and Increment/Decrement for masking or outlining effects.
StencilFunction
Specifies the comparison function used to evaluate the stencil test.
public CompareFunction StencilFunction
Field Value
Remarks
The test compares the stencil buffer value with a reference value using this function. For example, Equal passes only if the values match.
StencilPass
Specifies the stencil operation to perform when both the stencil and depth tests pass.
public StencilOperation StencilPass
Field Value
Remarks
This is the most common path for visible pixels. The operation typically updates the stencil buffer to mark the pixel as processed.
Methods
Equals(DepthStencilStencilOpDescription)
Indicates whether the current object is equal to another object of the same type.
public readonly bool Equals(DepthStencilStencilOpDescription other)
Parameters
otherDepthStencilStencilOpDescriptionAn object to compare with this object.
Returns
Equals(object)
Indicates whether this instance and a specified object are equal.
public override readonly bool Equals(object obj)
Parameters
objobjectThe object to compare with the current instance.
Returns
- bool
true if
objand this instance are the same type and represent the same value; otherwise, false.
GetHashCode()
Returns the hash code for this instance.
public override readonly int GetHashCode()
Returns
- int
A 32-bit signed integer that is the hash code for this instance.
Operators
operator ==(DepthStencilStencilOpDescription, DepthStencilStencilOpDescription)
public static bool operator ==(DepthStencilStencilOpDescription left, DepthStencilStencilOpDescription right)
Parameters
Returns
operator !=(DepthStencilStencilOpDescription, DepthStencilStencilOpDescription)
public static bool operator !=(DepthStencilStencilOpDescription left, DepthStencilStencilOpDescription right)