/// <summary> /// Unpacks the texture minification filter. /// This defines the filtering used when the texture covers an area on the screen /// that is smaller than the texture size. /// </summary> /// <returns>The minification filter</returns> public MinFilter UnpackMinFilter() { SamplerMinFilter minFilter = (SamplerMinFilter)((Word1 >> 4) & 3); SamplerMipFilter mipFilter = (SamplerMipFilter)((Word1 >> 6) & 3); return(ConvertFilter(minFilter, mipFilter)); }
/// <summary> /// Converts two minification and filter enum, to a single minification enum, /// including mipmap filtering information, as expected from the host API. /// </summary> /// <param name="minFilter">The minification filter</param> /// <param name="mipFilter">The mipmap level filter</param> /// <returns>The combined, host API compatible filter enum</returns> private static MinFilter ConvertFilter(SamplerMinFilter minFilter, SamplerMipFilter mipFilter) { switch (mipFilter) { case SamplerMipFilter.None: switch (minFilter) { case SamplerMinFilter.Nearest: return(MinFilter.Nearest); case SamplerMinFilter.Linear: return(MinFilter.Linear); } break; case SamplerMipFilter.Nearest: switch (minFilter) { case SamplerMinFilter.Nearest: return(MinFilter.NearestMipmapNearest); case SamplerMinFilter.Linear: return(MinFilter.LinearMipmapNearest); } break; case SamplerMipFilter.Linear: switch (minFilter) { case SamplerMinFilter.Nearest: return(MinFilter.NearestMipmapLinear); case SamplerMinFilter.Linear: return(MinFilter.LinearMipmapLinear); } break; } return(MinFilter.Nearest); }
public TextureSampler(SamplerMinFilter min, SamplerMagFilter mag, SamplerWrapMode str = SamplerWrapMode.ClampToEdge) : this(Native.TextureSampler.CreateSampler((byte)min, (byte)mag, (byte)str, (byte)str, (byte)str)) { ManuallyRegisterCache(NativePtr, this); }