Table of Contents

Struct SamplerStateDescription

Namespace
Stride.Graphics
Assembly
Stride.dll

Describes a Sampler State object, which determines how to sample Texture data.

[DataContract]
public struct SamplerStateDescription : IEquatable<SamplerStateDescription>
Implements
Extension Methods

Constructors

SamplerStateDescription()

Initializes a new instance of the SamplerStateDescription structure with default values.

public SamplerStateDescription()

Remarks

The default values are:
  <ul><li>Linear filtering (<xref href="Stride.Graphics.TextureFilter.Linear" data-throw-if-not-resolved="false"></xref>).</li><li><xref href="Stride.Graphics.TextureAddressMode.Clamp" data-throw-if-not-resolved="false"></xref> for <code>U</code>, <code>V</code>, and <code>W</code> Texture coordinates.</li><li>No Mip LOD bias (<code>0.0</code>).</li><li>A default maximum anisotropy of <code>16x</code>.</li><li>A comparison function that never passes (<xref href="Stride.Graphics.CompareFunction.Never" data-throw-if-not-resolved="false"></xref>).</li><li>A border color of black (<code>(0,0,0,0)</code>).</li><li>
      No clamping on Mip-levels (<xref href="Stride.Graphics.SamplerStateDescription.MinMipLevel" data-throw-if-not-resolved="false"></xref> is <code>-<xref href="System.Single.MaxValue" data-throw-if-not-resolved="false"></xref></code> and
      <xref href="Stride.Graphics.SamplerStateDescription.MaxMipLevel" data-throw-if-not-resolved="false"></xref> is <code><xref href="System.Single.MaxValue" data-throw-if-not-resolved="false"></xref></code>).
    </li></ul>
</remarks>

SamplerStateDescription(TextureFilter, TextureAddressMode)

Initializes a new instance of the SamplerStateDescription structure with default values, and a specific Texture filtering and addressing mode.

public SamplerStateDescription(TextureFilter filter, TextureAddressMode addressMode)

Parameters

filter TextureFilter

The Texture filtering mode.

addressMode TextureAddressMode

The Texture addressing mode for U, V, and W coordinates.

Remarks

The default values are:
  <ul><li>Linear filtering (<xref href="Stride.Graphics.TextureFilter.Linear" data-throw-if-not-resolved="false"></xref>).</li><li><xref href="Stride.Graphics.TextureAddressMode.Clamp" data-throw-if-not-resolved="false"></xref> for <code>U</code>, <code>V</code>, and <code>W</code> Texture coordinates.</li><li>No Mip LOD bias (<code>0.0</code>).</li><li>A default maximum anisotropy of <code>16x</code>.</li><li>A comparison function that never passes (<xref href="Stride.Graphics.CompareFunction.Never" data-throw-if-not-resolved="false"></xref>).</li><li>A border color of black (<code>(0,0,0,0)</code>).</li><li>
      No clamping on Mip-levels (<xref href="Stride.Graphics.SamplerStateDescription.MinMipLevel" data-throw-if-not-resolved="false"></xref> is <code>-<xref href="System.Single.MaxValue" data-throw-if-not-resolved="false"></xref></code> and
      <xref href="Stride.Graphics.SamplerStateDescription.MaxMipLevel" data-throw-if-not-resolved="false"></xref> is <code><xref href="System.Single.MaxValue" data-throw-if-not-resolved="false"></xref></code>).
    </li></ul>
</remarks>

Fields

AddressU

The method to use for resolving a U texture coordinate that is outside the [0, 1] range.

public TextureAddressMode AddressU

Field Value

TextureAddressMode

AddressV

The method to use for resolving a V texture coordinate that is outside the [0, 1] range.

public TextureAddressMode AddressV

Field Value

TextureAddressMode

AddressW

The method to use for resolving a W texture coordinate that is outside the [0, 1] range.

public TextureAddressMode AddressW

Field Value

TextureAddressMode

BorderColor

The border color to use if Border is specified for AddressU, AddressV, or AddressW.

public Color4 BorderColor

Field Value

Color4

CompareFunction

A function that compares sampled data against existing sampled data.

public CompareFunction CompareFunction

Field Value

CompareFunction

Remarks

This function will be used when specifying one of the comparison filtering modes in Filter.

DefaultAddressU

Default value for AddressU.

public const TextureAddressMode DefaultAddressU = Clamp

Field Value

TextureAddressMode

DefaultAddressV

Default value for AddressV.

public const TextureAddressMode DefaultAddressV = Clamp

Field Value

TextureAddressMode

DefaultAddressW

Default value for AddressW.

public const TextureAddressMode DefaultAddressW = Clamp

Field Value

TextureAddressMode

DefaultBorderColor

Default value for BorderColor (black).

public static readonly Color4 DefaultBorderColor

Field Value

Color4

DefaultCompareFunction

Default value for CompareFunction.

public const CompareFunction DefaultCompareFunction = Never

Field Value

CompareFunction

DefaultFilter

Default value for Filter.

public const TextureFilter DefaultFilter = Linear

Field Value

TextureFilter

DefaultMaxAnisotropy

Default value for MaxAnisotropy.

public const int DefaultMaxAnisotropy = 16

Field Value

int

DefaultMaxMipLevel

Default value for MaxMipLevel.

public const float DefaultMaxMipLevel = 3.4028235E+38

Field Value

float

DefaultMinMipLevel

Default value for MinMipLevel.

public const float DefaultMinMipLevel = -3.4028235E+38

Field Value

float

DefaultMipMapLevelOfDetailBias

Default value for MipMapLevelOfDetailBias.

public const float DefaultMipMapLevelOfDetailBias = 0

Field Value

float

Filter

The filtering method to use when sampling a Texture.

public TextureFilter Filter

Field Value

TextureFilter

MaxAnisotropy

The clamping value used if Anisotropic or ComparisonAnisotropic is specified in Filter. Valid values are between 1 and 16.

public int MaxAnisotropy

Field Value

int

MaxMipLevel

The upper end of the mipmap range to clamp access to, where 0 is the largest and most detailed mipmap level and any level higher than that is less detailed.

public float MaxMipLevel

Field Value

float

Remarks

This value must be greater than or equal to MinMipLevel. To have no upper limit set this to a large value such as MaxValue.

MinMipLevel

The lower end of the mipmap range to clamp access to, where 0 is the largest and most detailed mipmap level and any level higher than that is less detailed.

public float MinMipLevel

Field Value

float

MipMapLevelOfDetailBias

The offset to apply from the calculated mipmap level.

public float MipMapLevelOfDetailBias

Field Value

float

Remarks

For example, if a Texture should be sampled at mipmap level 3 and MipMapLevelOfDetailBias is 2, then the Texture will be sampled at mipmap level 5.

Properties

Default

Returns a SamplerStateDescription with default values.

public static SamplerStateDescription Default { get; }

Property Value

SamplerStateDescription

Remarks

The default values are:

  • Linear filtering (Linear).
  • Clamp for U, V, and W Texture coordinates.
  • No Mip LOD bias (0.0).
  • A default maximum anisotropy of 16x.
  • A comparison function that never passes (Never).
  • A border color of black ((0,0,0,0)).
  • No clamping on Mip-levels (MinMipLevel is -MaxValue and MaxMipLevel is MaxValue).

Methods

Equals(SamplerStateDescription)

Indicates whether the current object is equal to another object of the same type.

public readonly bool Equals(SamplerStateDescription other)

Parameters

other SamplerStateDescription

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.

ToString()

Returns the fully qualified type name of this instance.

public override readonly string ToString()

Returns

string

The fully qualified type name.

Operators

operator ==(SamplerStateDescription, SamplerStateDescription)

public static bool operator ==(SamplerStateDescription left, SamplerStateDescription right)

Parameters

left SamplerStateDescription
right SamplerStateDescription

Returns

bool

operator !=(SamplerStateDescription, SamplerStateDescription)

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

Parameters

left SamplerStateDescription
right SamplerStateDescription

Returns

bool