/// <summary> /// Creates a new texture sampler object. /// </summary> /// <param name="filter">The filtering mode.</param> /// <param name="addressMode">The coordinate addressing mode.</param> /// <param name="aniso">The anisotropic filtring level.</param> /// <param name="color">The border color for ClampToBorder sampling.</param> public Sampler ( TextureFilter filter = TextureFilter.Linear, AddressMode addressMode = AddressMode.ClampToEdge, AnisotropyLevel aniso = AnisotropyLevel.None, ClampBorderColor color = ClampBorderColor.OpaqueBlack ) { Filter = filter; AddressMode = addressMode; Anisotropy = aniso; BorderColor = color; unchecked { int hash = 14461 * (5051 + filter.GetHashCode()); hash *= (5051 + addressMode.GetHashCode()); hash *= (5051 + aniso.GetHashCode()); _hash = hash * (5051 + color.GetHashCode()); } }
public override int GetHashCode() { unchecked { int hash = 17; hash = hash * 23 + Type.GetHashCode(); hash = hash * 23 + MinFilter.GetHashCode(); hash = hash * 23 + MagFilter.GetHashCode(); hash = hash * 23 + MipFilter.GetHashCode(); hash = hash * 23 + AddressU.GetHashCode(); hash = hash * 23 + AddressV.GetHashCode(); hash = hash * 23 + AddressW.GetHashCode(); hash = hash * 23 + BorderColor.GetHashCode(); hash = hash * 23 + ComparisonFunction.GetHashCode(); hash = hash * 23 + MaximumAnisotropy.GetHashCode(); hash = hash * 23 + MipLodBias.GetHashCode(); hash = hash * 23 + MinimumLod.GetHashCode(); hash = hash * 23 + MaximumLod.GetHashCode(); return(hash); } }