本文整理汇总了C#中TextureFlags类的典型用法代码示例。如果您正苦于以下问题:C# TextureFlags类的具体用法?C# TextureFlags怎么用?C# TextureFlags使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TextureFlags类属于命名空间,在下文中一共展示了TextureFlags类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TextureItem
public TextureItem(TexturePackage package, string name, TextureFlags flags)
{
Package = package;
Name = name;
Flags = flags;
_subItems = new Dictionary<TextureSubItemType, TextureSubItem>();
}
示例2: New1D
private static TextureDescription New1D(int width, PixelFormat format, TextureFlags flags, int mipCount, int arraySize, GraphicsResourceUsage usage)
{
usage = (flags & TextureFlags.UnorderedAccess) != 0 ? GraphicsResourceUsage.Default : usage;
var desc = new TextureDescription()
{
Dimension = TextureDimension.Texture1D,
Width = width,
Height = 1,
Depth = 1,
ArraySize = arraySize,
Flags = flags,
Format = format,
MipLevels = Texture.CalculateMipMapCount(mipCount, width),
Usage = Texture.GetUsageWithFlags(usage, flags),
};
return desc;
}
示例3: New3D
private static TextureDescription New3D(int width, int height, int depth, PixelFormat format, TextureFlags flags, int mipCount, GraphicsResourceUsage usage)
{
var desc = new TextureDescription()
{
Width = width,
Height = height,
Depth = depth,
Flags = flags,
Format = format,
MipLevels = Texture.CalculateMipMapCount(mipCount, width, height, depth),
Usage = Texture.GetUsageWithFlags(usage, flags),
ArraySize = 1,
Dimension = TextureDimension.Texture3D,
MultiSampleLevel = MSAALevel.None
};
return desc;
}
示例4: New2D
private static TextureDescription New2D(int width, int height, PixelFormat format, TextureFlags textureFlags, int mipCount, int arraySize, GraphicsResourceUsage usage)
{
if ((textureFlags & TextureFlags.UnorderedAccess) != 0)
usage = GraphicsResourceUsage.Default;
var desc = new TextureDescription()
{
Dimension = TextureDimension.Texture2D,
Width = width,
Height = height,
Depth = 1,
ArraySize = arraySize,
MultiSampleLevel = MSAALevel.None,
Flags = textureFlags,
Format = format,
MipLevels = Texture.CalculateMipMapCount(mipCount, width, height),
Usage = Texture.GetUsageWithFlags(usage, textureFlags),
};
return desc;
}
示例5: Create
public static GLTexture Create(string name, Bitmap bitmap, int width, int height, TextureFlags flags)
{
if (Exists(name)) {
Delete(name);
}
var actualBitmap = bitmap;
if (ForceNonPowerOfTwoResize || !SupportsNonPowerOfTwo())
{
var w = NextPowerOfTwo(bitmap.Width);
var h = NextPowerOfTwo(bitmap.Height);
if (w != bitmap.Width || h != bitmap.Height) actualBitmap = new Bitmap(bitmap, w, h);
}
var data = actualBitmap.LockBits(
new Rectangle(0, 0, actualBitmap.Width, actualBitmap.Height),
ImageLockMode.ReadOnly,
System.Drawing.Imaging.PixelFormat.Format32bppArgb
);
var tex = CreateAndBindTexture();
SetTextureParameters();
GL.TexImage2D(
TextureTarget.Texture2D,
0,
PixelInternalFormat,
data.Width,
data.Height,
0,
PixelFormat.Bgra,
PixelType.UnsignedByte,
data.Scan0
);
actualBitmap.UnlockBits(data);
if (actualBitmap != bitmap)
{
actualBitmap.Dispose();
}
var texobj = new GLTexture(tex, name, flags) { Width = width, Height = height };
Textures.Add(name, texobj);
return texobj;
}
示例6: New
/// <summary>
/// Creates a new <see cref="RenderTargetCube" />.
/// </summary>
/// <param name="device">The <see cref="GraphicsDevice"/>.</param>
/// <param name="size">The size (in pixels) of the top-level faces of the cube texture.</param>
/// <param name="mipCount">Number of mipmaps, set to true to have all mipmaps, set to an int >=1 for a particular mipmap count.</param>
/// <param name="format">Describes the format to use.</param>
/// <param name="flags">Sets the texture flags (for unordered access...etc.)</param>
/// <returns>A new instance of <see cref="RenderTargetCube" /> class.</returns>
/// <msdn-id>ff476521</msdn-id>
/// <unmanaged>HRESULT ID3D11Device::CreateTexture2D([In] const D3D11_TEXTURE2D_DESC* pDesc,[In, Buffer, Optional] const D3D11_SUBRESOURCE_DATA* pInitialData,[Out, Fast] ID3D11Texture2D** ppTexture2D)</unmanaged>
/// <unmanaged-short>ID3D11Device::CreateTexture2D</unmanaged-short>
public static RenderTargetCube New(GraphicsDevice device, int size, MipMapCount mipCount, PixelFormat format, TextureFlags flags = TextureFlags.RenderTarget | TextureFlags.ShaderResource)
{
return new RenderTargetCube(device, NewRenderTargetDescription(size, format, flags | TextureFlags.RenderTarget, mipCount));
}
示例7: MyTexture
/// <summary>
/// Initializes a new instance of the <see cref="MyTexture"/> class.
/// </summary>
/// <param name="path">The path.</param>
/// <param name="manager">The manager.</param>
/// <param name="loadMethod">The load method. See <code>LoadMethod</code> enum.</param>
/// <param name="flags">The flags.</param>
protected MyTexture(string path, LoadMethod loadMethod, TextureFlags flags)
{
this.flags = flags;
this.Name = path;
// this.Manager = manager;
switch (loadMethod)
{
case LoadMethod.External:
this.LoadState = LoadState.Pending;
break;
case LoadMethod.Lazy:
this.LoadState = LoadState.LoadYourself;
break;
case LoadMethod.LazyBackground:
this.LoadState = LoadState.LoadYourselfBackground;
break;
default:
throw new ArgumentOutOfRangeException("loadMethod");
}
}
示例8: bgfx_create_frame_buffer
public static extern ushort bgfx_create_frame_buffer(ushort width, ushort height, TextureFormat format, TextureFlags flags);
示例9: bgfx_create_texture_cube
public static extern ushort bgfx_create_texture_cube(ushort size, byte numMips, TextureFormat format, TextureFlags flags, MemoryBlock.DataPtr* mem);
示例10: bgfx_create_texture_2d_scaled
public static extern ushort bgfx_create_texture_2d_scaled(BackbufferRatio ratio, byte numMips, TextureFormat format, TextureFlags flags);
示例11: MyTextureCube
/// <summary>
/// Initializes a new instance of the <see cref="MyTexture2D"/> class.
/// </summary>
/// <param name="path">The path.</param>
/// <param name="manager">The manager.</param>
/// <param name="loadMethod">if set to <c>true</c> [external load].</param>
/// <param name="flags">The flags.</param>
public MyTextureCube(string path, LoadMethod loadMethod, TextureFlags flags)
: base(path, loadMethod, flags)
{
}
示例12: NewCube
/// <summary>
/// Creates a new Cube <see cref="TextureDescription"/>.
/// </summary>
/// <param name="size">The size (in pixels) of the top-level faces of the cube texture.</param>
/// <param name="mipCount">Number of mipmaps, set to true to have all mipmaps, set to an int >=1 for a particular mipmap count.</param>
/// <param name="format">Describes the format to use.</param>
/// <param name="textureFlags">The texture flags.</param>
/// <param name="usage">The usage.</param>
/// <returns>A new instance of <see cref="TextureDescription"/> class.</returns>
public static TextureDescription NewCube(int size, MipMapCount mipCount, PixelFormat format, TextureFlags textureFlags = TextureFlags.ShaderResource, GraphicsResourceUsage usage = GraphicsResourceUsage.Default)
{
return NewCube(size, format, textureFlags, mipCount, usage);
}
示例13: CreateDescription
internal static Texture2DDescription CreateDescription(GraphicsDevice device, int width, int height, PixelFormat format, TextureFlags textureFlags, int mipCount, int arraySize, MSAALevel multiSampleCount)
{
// Make sure that the texture to create is a render target
textureFlags |= TextureFlags.RenderTarget;
var desc = Texture2DBase.NewDescription(width, height, format, textureFlags, mipCount, arraySize, ResourceUsage.Default);
// Sets the MSAALevel
int maximumMSAA = (int)device.Features[format].MSAALevelMax;
desc.SampleDescription.Count = Math.Max(1, Math.Min((int)multiSampleCount, maximumMSAA));
return desc;
}
示例14: NewDescription
protected static Texture1DDescription NewDescription(int width, PixelFormat format, TextureFlags textureFlags, int mipCount, int arraySize, ResourceUsage usage)
{
if ((textureFlags & TextureFlags.UnorderedAccess) != 0)
usage = ResourceUsage.Default;
var desc = new Texture1DDescription()
{
Width = width,
ArraySize = arraySize,
BindFlags = GetBindFlagsFromTextureFlags(textureFlags),
Format = format,
MipLevels = CalculateMipMapCount(mipCount, width),
Usage = usage,
CpuAccessFlags = GetCputAccessFlagsFromUsage(usage),
OptionFlags = ResourceOptionFlags.None
};
// If the texture is a RenderTarget + ShaderResource + MipLevels > 1, then allow for GenerateMipMaps method
if ((desc.BindFlags & BindFlags.RenderTarget) != 0 && (desc.BindFlags & BindFlags.ShaderResource) != 0 && desc.MipLevels > 1)
{
desc.OptionFlags |= ResourceOptionFlags.GenerateMipMaps;
}
return desc;
}
示例15: MyTexture2D
/// <summary>
/// Initializes a new instance of the <see cref="MyTexture2D"/> class.
/// </summary>
/// <param name="path">The path.</param>
/// <param name="manager">The manager.</param>
/// <param name="loadMethod">if set to <c>true</c> [external load].</param>
/// <param name="flags">The flags.</param>
public MyTexture2D(string contentDir, string path, LoadMethod loadMethod, TextureFlags flags)
: base(contentDir, path, loadMethod, flags)
{
}