本文整理汇总了C#中WrapMode.HasFlag方法的典型用法代码示例。如果您正苦于以下问题:C# WrapMode.HasFlag方法的具体用法?C# WrapMode.HasFlag怎么用?C# WrapMode.HasFlag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WrapMode
的用法示例。
在下文中一共展示了WrapMode.HasFlag方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateSamplerState
public static D3D.SamplerState CreateSamplerState(this D3D.Device device, WrapMode wrapMode, InterpolationMode interpolationMode)
{
var desc = new D3D.SamplerStateDescription();
if (wrapMode.HasFlag(WrapMode.Tile))
{
desc.AddressU = D3D.TextureAddressMode.Wrap;
desc.AddressV = D3D.TextureAddressMode.Wrap;
}
else
{
desc.AddressU = D3D.TextureAddressMode.Clamp;
desc.AddressV = D3D.TextureAddressMode.Clamp;
}
if (wrapMode.HasFlag(WrapMode.MirrorX)) desc.AddressU = D3D.TextureAddressMode.Mirror;
if (wrapMode.HasFlag(WrapMode.MirrorY)) desc.AddressV = D3D.TextureAddressMode.Mirror;
desc.AddressW = D3D.TextureAddressMode.Clamp;
switch (interpolationMode)
{
case InterpolationMode.Linear:
desc.Filter = D3D.Filter.MinMagMipLinear;
break;
case InterpolationMode.Anisotropic:
desc.Filter = D3D.Filter.Anisotropic;
break;
default:
desc.Filter = D3D.Filter.MinLinearMagMipPoint;
break;
}
desc.ComparisonFunction = D3D.Comparison.Never;
desc.MaximumAnisotropy = 16;
desc.MinimumLod = 0;
desc.MaximumLod = float.MaxValue;
var samplerState = new D3D.SamplerState(device, desc);
return samplerState;
}