Table of Contents

Struct DepthStencilStencilOpDescription

Namespace
Stride.Graphics
Assembly
Stride.Graphics.dll

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

The default values are:
  <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

DepthStencilStencilOpDescription

Remarks

The default values are:

DefaultStencilDepthBufferFail

Default value for StencilDepthBufferFail.

public const StencilOperation DefaultStencilDepthBufferFail = Keep

Field Value

StencilOperation

DefaultStencilFail

Default value for StencilFail.

public const StencilOperation DefaultStencilFail = Keep

Field Value

StencilOperation

DefaultStencilFunction

Default value for StencilFunction.

public const CompareFunction DefaultStencilFunction = Always

Field Value

CompareFunction

DefaultStencilPass

Default value for StencilPass.

public const StencilOperation DefaultStencilPass = Keep

Field Value

StencilOperation

StencilDepthBufferFail

Specifies the stencil operation to perform when the stencil test passes but the depth test fails.

public StencilOperation StencilDepthBufferFail

Field Value

StencilOperation

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

StencilOperation

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

CompareFunction

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

StencilOperation

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

other DepthStencilStencilOpDescription

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

Equals(object)

Indicates whether this instance and a specified object are equal.

public override readonly bool Equals(object obj)

Parameters

obj object

The object to compare with the current instance.

Returns

bool

true if obj and 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

left DepthStencilStencilOpDescription
right DepthStencilStencilOpDescription

Returns

bool

operator !=(DepthStencilStencilOpDescription, DepthStencilStencilOpDescription)

public static bool operator !=(DepthStencilStencilOpDescription left, DepthStencilStencilOpDescription right)

Parameters

left DepthStencilStencilOpDescription
right DepthStencilStencilOpDescription

Returns

bool