Struct SamplerStateDescription
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
<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
filterTextureFilterThe Texture filtering mode.
addressModeTextureAddressModeThe Texture addressing mode for U, V, and W coordinates.
Remarks
<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
AddressV
The method to use for resolving a V texture coordinate that is outside the [0, 1] range.
public TextureAddressMode AddressV
Field Value
AddressW
The method to use for resolving a W texture coordinate that is outside the [0, 1] range.
public TextureAddressMode AddressW
Field Value
BorderColor
public Color4 BorderColor
Field Value
CompareFunction
A function that compares sampled data against existing sampled data.
public CompareFunction CompareFunction
Field Value
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
DefaultAddressV
Default value for AddressV.
public const TextureAddressMode DefaultAddressV = Clamp
Field Value
DefaultAddressW
Default value for AddressW.
public const TextureAddressMode DefaultAddressW = Clamp
Field Value
DefaultBorderColor
Default value for BorderColor (black).
public static readonly Color4 DefaultBorderColor
Field Value
DefaultCompareFunction
Default value for CompareFunction.
public const CompareFunction DefaultCompareFunction = Never
Field Value
DefaultFilter
Default value for Filter.
public const TextureFilter DefaultFilter = Linear
Field Value
DefaultMaxAnisotropy
Default value for MaxAnisotropy.
public const int DefaultMaxAnisotropy = 16
Field Value
DefaultMaxMipLevel
Default value for MaxMipLevel.
public const float DefaultMaxMipLevel = 3.4028235E+38
Field Value
DefaultMinMipLevel
Default value for MinMipLevel.
public const float DefaultMinMipLevel = -3.4028235E+38
Field Value
DefaultMipMapLevelOfDetailBias
Default value for MipMapLevelOfDetailBias.
public const float DefaultMipMapLevelOfDetailBias = 0
Field Value
Filter
The filtering method to use when sampling a Texture.
public TextureFilter Filter
Field Value
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
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
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
MipMapLevelOfDetailBias
The offset to apply from the calculated mipmap level.
public float MipMapLevelOfDetailBias
Field Value
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
Remarks
The default values are:
- Linear filtering (Linear).
- Clamp for
U,V, andWTexture 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
-MaxValueand MaxMipLevel isMaxValue).
Methods
Equals(SamplerStateDescription)
Indicates whether the current object is equal to another object of the same type.
public readonly bool Equals(SamplerStateDescription other)
Parameters
otherSamplerStateDescriptionAn 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.
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
leftSamplerStateDescriptionrightSamplerStateDescription
Returns
operator !=(SamplerStateDescription, SamplerStateDescription)
public static bool operator !=(SamplerStateDescription left, SamplerStateDescription right)
Parameters
leftSamplerStateDescriptionrightSamplerStateDescription