diff --git a/MonoGame.Framework/Graphics/States/SamplerState.cs b/MonoGame.Framework/Graphics/States/SamplerState.cs index f2788b1d0f4..8606c93f2fe 100644 --- a/MonoGame.Framework/Graphics/States/SamplerState.cs +++ b/MonoGame.Framework/Graphics/States/SamplerState.cs @@ -6,6 +6,9 @@ namespace Microsoft.Xna.Framework.Graphics { + /// + /// Contains sampler state, which determines how to sample texture data. + /// public partial class SamplerState : GraphicsResource { static SamplerState() @@ -18,11 +21,83 @@ static SamplerState() PointWrap = new SamplerState("SamplerState.PointWrap", TextureFilter.Point, TextureAddressMode.Wrap); } + /// + /// Contains default state for anisotropic filtering and texture coordinate clamping. + /// + /// + /// This built-in state object has the following settings: + /// + /// Filter = TextureFilter.Anisotropic, + /// AddressU = TextureAddressMode.Clamp, + /// AddressV = TextureAddressMode.Clamp, + /// AddressW = TextureAddressMode.Clamp, + /// + /// public static readonly SamplerState AnisotropicClamp; + /// + /// Contains default state for anisotropic filtering and texture coordinate wrapping. + /// + /// + /// This built-in state object has the following settings: + /// + /// Filter = TextureFilter.Anisotropic, + /// AddressU = TextureAddressMode.Wrap, + /// AddressV = TextureAddressMode.Wrap, + /// AddressW = TextureAddressMode.Wrap, + /// + /// public static readonly SamplerState AnisotropicWrap; + /// + /// Contains default state for linear filtering and texture coordinate clamping. + /// + /// + /// This built-in state object has the following settings: + /// + /// Filter = TextureFilter.Linear, + /// AddressU = TextureAddressMode.Clamp, + /// AddressV = TextureAddressMode.Clamp, + /// AddressW = TextureAddressMode.Clamp, + /// + /// public static readonly SamplerState LinearClamp; + /// + /// Contains default state for linear filtering and texture coordinate wrapping. + /// + /// + /// This built-in state object has the following settings: + /// + /// Filter = TextureFilter.Linear, + /// AddressU = TextureAddressMode.Wrap, + /// AddressV = TextureAddressMode.Wrap, + /// AddressW = TextureAddressMode.Wrap, + /// + /// public static readonly SamplerState LinearWrap; + /// + /// Contains default state for point filtering and texture coordinate clamping. + /// + /// + /// This built-in state object has the following settings: + /// + /// Filter = TextureFilter.Point, + /// AddressU = TextureAddressMode.Clamp, + /// AddressV = TextureAddressMode.Clamp, + /// AddressW = TextureAddressMode.Clamp, + /// + /// public static readonly SamplerState PointClamp; + /// + /// Contains default state for point filtering and texture coordinate wrapping. + /// + /// + /// This built-in state object has the following settings: + /// + /// Filter = TextureFilter.Point, + /// AddressU = TextureAddressMode.Wrap, + /// AddressV = TextureAddressMode.Wrap, + /// AddressW = TextureAddressMode.Wrap, + /// + /// public static readonly SamplerState PointWrap; private readonly bool _defaultStateObject; @@ -38,6 +113,9 @@ static SamplerState() private TextureFilterMode _filterMode; private CompareFunction _comparisonFunction; + /// + /// Gets or sets the texture-address mode for the u-coordinate. + /// public TextureAddressMode AddressU { get { return _addressU; } @@ -48,6 +126,9 @@ public TextureAddressMode AddressU } } + /// + /// Gets or sets the texture-address mode for the v-coordinate. + /// public TextureAddressMode AddressV { get { return _addressV; } @@ -58,6 +139,9 @@ public TextureAddressMode AddressV } } + /// + /// Gets or sets the texture-address mode for the w-coordinate. + /// public TextureAddressMode AddressW { get { return _addressW; } @@ -68,6 +152,10 @@ public TextureAddressMode AddressW } } + /// + /// Gets or sets the color to use for texels outside of range, + /// when is used. + /// public Color BorderColor { get { return _borderColor; } @@ -78,6 +166,9 @@ public Color BorderColor } } + /// + /// Gets or sets the type of filtering during sampling. + /// public TextureFilter Filter { get { return _filter; } @@ -88,6 +179,14 @@ public TextureFilter Filter } } + /// + /// Gets or sets the maximum anisotropy. + /// The default value is 4. + /// + /// + /// Use anisotropic filtering to reduce blur and aliasing effects + /// when texturing a surface that will be viewed at an extreme viewing angle. + /// public int MaxAnisotropy { get { return _maxAnisotropy; } @@ -98,6 +197,12 @@ public int MaxAnisotropy } } + /// + /// Gets or sets the level of detail (LOD) index of the largest map to use. + /// + /// + /// The maximum LOD, which ranges from 0 to n-1, where n is the index of the largest map. + /// public int MaxMipLevel { get { return _maxMipLevel; } @@ -108,6 +213,14 @@ public int MaxMipLevel } } + /// + /// Gets or sets the mipmap LOD bias. The default value is 0. + /// A negative value indicates a larger mipmap level; a positive value indicates a smaller mipmap level. + /// + /// + /// Mipmap LOD bias offsets the mipmap level from which a texture is sampled + /// (the result is computed using trilinear texturing between the nearest two levels). + /// public float MipMapLevelOfDetailBias { get { return _mipMapLevelOfDetailBias; } @@ -131,6 +244,9 @@ public CompareFunction ComparisonFunction } } + /// + /// Gets or sets filtering mode for texture samplers. + /// public TextureFilterMode FilterMode { get { return _filterMode; } @@ -158,6 +274,10 @@ internal void ThrowIfBound() throw new InvalidOperationException("You cannot modify the sampler state after it has been bound to the graphics device!"); } + /// + /// Creates a new instance of the class + /// with default values equivalent to . + /// public SamplerState() { Filter = TextureFilter.Linear; @@ -205,6 +325,7 @@ internal SamplerState Clone() partial void PlatformDispose(); + /// protected override void Dispose(bool disposing) { if (!IsDisposed) @@ -214,4 +335,4 @@ protected override void Dispose(bool disposing) base.Dispose(disposing); } } -} \ No newline at end of file +}