本文整理汇总了C#中MipMapCount类的典型用法代码示例。如果您正苦于以下问题:C# MipMapCount类的具体用法?C# MipMapCount怎么用?C# MipMapCount使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MipMapCount类属于命名空间,在下文中一共展示了MipMapCount类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: New2D
/// <summary>
/// Creates a new instance of a 2D <see cref="Image"/>.
/// </summary>
/// <param name="width">The width.</param>
/// <param name="height">The height.</param>
/// <param name="mipMapCount">The mip map count.</param>
/// <param name="format">The format.</param>
/// <param name="arraySize">Size of the array.</param>
/// <param name="dataPointer">Pointer to an existing buffer.</param>
/// <param name="rowStride">Specify a specific rowStride, only valid when mipMapCount == 1 and pixel format is not compressed.</param>
/// <returns>A new image.</returns>
public static Image New2D(int width, int height, MipMapCount mipMapCount, PixelFormat format, int arraySize, IntPtr dataPointer, int rowStride = 0)
{
return new Image(CreateDescription(TextureDimension.Texture2D, width, height, 1, mipMapCount, format, arraySize), dataPointer, 0, null, false, PitchFlags.None, rowStride);
}
示例2: NewCube
/// <summary>
/// Creates a new instance of a Cube <see cref="Image"/>.
/// </summary>
/// <param name="width">The width.</param>
/// <param name="mipMapCount">The mip map count.</param>
/// <param name="format">The format.</param>
/// <param name="dataPointer">Pointer to an existing buffer.</param>
/// <returns>A new image.</returns>
public static Image NewCube(int width, MipMapCount mipMapCount, PixelFormat format, IntPtr dataPointer)
{
return new Image(CreateDescription(TextureDimension.TextureCube, width, width, 1, mipMapCount, format, 6), dataPointer, 0, null, false);
}
示例3: New3D
/// <summary>
/// Creates a new instance of a 3D <see cref="Image"/>.
/// </summary>
/// <param name="width">The width.</param>
/// <param name="height">The height.</param>
/// <param name="depth">The depth.</param>
/// <param name="mipMapCount">The mip map count.</param>
/// <param name="format">The format.</param>
/// <returns>A new image.</returns>
public static Image New3D(int width, int height, int depth, MipMapCount mipMapCount, PixelFormat format)
{
return New3D(width, height, depth, mipMapCount, format, IntPtr.Zero);
}
示例4: New1D
/// <summary>
/// Creates a new instance of a 1D <see cref="Image"/>.
/// </summary>
/// <param name="width">The width.</param>
/// <param name="mipMapCount">The mip map count.</param>
/// <param name="format">The format.</param>
/// <param name="arraySize">Size of the array.</param>
/// <param name="dataPointer">Pointer to an existing buffer.</param>
/// <returns>A new image.</returns>
public static Image New1D(int width, MipMapCount mipMapCount, PixelFormat format, int arraySize, IntPtr dataPointer)
{
return new Image(CreateDescription(TextureDimension.Texture1D, width, 1, 1, mipMapCount, format, arraySize), dataPointer, 0, null, false);
}
示例5: GetTemporaryTexture2D
/// <summary>
/// Gets a <see cref="Texture" /> output for the specified description.
/// </summary>
/// <param name="allocator">The allocator.</param>
/// <param name="width">The width.</param>
/// <param name="height">The height.</param>
/// <param name="format">Describes the format to use.</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="flags">Sets the texture flags (for unordered access...etc.)</param>
/// <param name="arraySize">Size of the texture 2D array, default to 1.</param>
/// <returns>A new instance of <see cref="Texture" /> 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 Texture GetTemporaryTexture2D(this GraphicsResourceAllocator allocator, int width, int height, PixelFormat format, MipMapCount mipCount, TextureFlags flags = TextureFlags.RenderTarget | TextureFlags.ShaderResource, int arraySize = 1)
{
return allocator.GetTemporaryTexture(TextureDescription.New2D(width, height, mipCount, format, flags, arraySize));
}
示例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: CalculateMipLevels
/// <summary>
/// Calculates the number of miplevels for a Texture 2D.
/// </summary>
/// <param name="width">The width of the texture.</param>
/// <param name="height">The height of the texture.</param>
/// <param name="depth">The depth of the texture.</param>
/// <param name="mipLevels">A <see cref="MipMapCount"/>, set to true to calculates all mipmaps, to false to calculate only 1 miplevel, or > 1 to calculate a specific amount of levels.</param>
/// <returns>The number of miplevels.</returns>
public static int CalculateMipLevels(int width, int height, int depth, MipMapCount mipLevels)
{
if (mipLevels > 1)
{
if (!IsPow2(width) || !IsPow2(height) || !IsPow2(depth))
throw new InvalidOperationException("Width/Height/Depth must be power of 2");
int maxMips = CountMips(width, height, depth);
if (mipLevels > maxMips)
throw new InvalidOperationException(String.Format("MipLevels must be <= {0}", maxMips));
}
else if (mipLevels == 0)
{
if (!IsPow2(width) || !IsPow2(height) || !IsPow2(depth))
throw new InvalidOperationException("Width/Height/Depth must be power of 2");
mipLevels = CountMips(width, height, depth);
}
else
{
mipLevels = 1;
}
return mipLevels;
}
示例8: New
/// <summary>
/// Creates a new <see cref="RenderTarget3D" />.
/// </summary>
/// <param name="device">The <see cref="GraphicsDevice"/>.</param>
/// <param name="width">The width.</param>
/// <param name="height">The height.</param>
/// <param name="depth">The depth.</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>
/// <param name="arraySize">Size of the texture 3D array, default to 1.</param>
/// <returns>A new instance of <see cref="RenderTarget3D" /> class.</returns>
/// <msdn-id>ff476521</msdn-id>
/// <unmanaged>HRESULT ID3D11Device::CreateTexture3D([In] const D3D11_TEXTURE3D_DESC* pDesc,[In, Buffer, Optional] const D3D11_SUBRESOURCE_DATA* pInitialData,[Out, Fast] ID3D11Texture3D** ppTexture3D)</unmanaged>
/// <unmanaged-short>ID3D11Device::CreateTexture3D</unmanaged-short>
public static RenderTarget3D New(GraphicsDevice device, int width, int height, int depth, MipMapCount mipCount, PixelFormat format, TextureFlags flags = TextureFlags.RenderTarget | TextureFlags.ShaderResource, int arraySize = 1)
{
return new RenderTarget3D(device, NewRenderTargetDescription(width, height, depth, format, flags | TextureFlags.RenderTarget, mipCount));
}
示例9: NewScopedRenderTarget2D
/// <summary>
/// Gets a render target output for the specified description, scoped for the duration of the <see cref="DrawEffect.DrawCore"/>.
/// </summary>
/// <param name="width">The width.</param>
/// <param name="height">The height.</param>
/// <param name="format">Describes the format to use.</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="flags">Sets the texture flags (for unordered access...etc.)</param>
/// <param name="arraySize">Size of the texture 2D array, default to 1.</param>
/// <returns>A new instance of texture 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>
protected Texture NewScopedRenderTarget2D(int width, int height, PixelFormat format, MipMapCount mipCount, TextureFlags flags = TextureFlags.RenderTarget | TextureFlags.ShaderResource, int arraySize = 1)
{
CheckIsInDrawCore();
return PushScopedResource(Context.Allocator.GetTemporaryTexture2D(width, height, format, mipCount, flags, arraySize));
}
示例10: 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);
}
示例11: CreateDescription
/// <summary>
/// Creates a new texture description <see cref="RenderTarget2D" />.
/// </summary>
/// <param name="device">The <see cref="GraphicsDevice"/>.</param>
/// <param name="width">The width.</param>
/// <param name="height">The height.</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>
/// <param name="arraySize">Size of the texture 2D array, default to 1.</param>
/// <returns>A new instance of <see cref="RenderTarget2D" /> 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 Texture2DDescription CreateDescription(GraphicsDevice device, int width, int height, MipMapCount mipCount, PixelFormat format, TextureFlags flags = TextureFlags.RenderTarget | TextureFlags.ShaderResource, int arraySize = 1)
{
return CreateDescription(device.MainDevice, width, height, format, flags, mipCount, arraySize, MSAALevel.None);
}
示例12: New1D
/// <summary>
/// Creates a new 1D <see cref="TextureDescription" />.
/// </summary>
/// <param name="width">The width.</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">true if the texture needs to support unordered read write.</param>
/// <param name="arraySize">Size of the texture 2D array, default to 1.</param>
/// <param name="usage">The usage.</param>
/// <returns>A new instance of 1D <see cref="TextureDescription" /> class.</returns>
public static TextureDescription New1D(int width, MipMapCount mipCount, PixelFormat format, TextureFlags textureFlags = TextureFlags.ShaderResource, int arraySize = 1, GraphicsResourceUsage usage = GraphicsResourceUsage.Default)
{
return New1D(width, format, textureFlags, mipCount, arraySize, usage);
}
示例13: CreateDescription
private static ImageDescription CreateDescription(TextureDimension dimension, int width, int height, int depth, MipMapCount mipMapCount, PixelFormat format, int arraySize)
{
return new ImageDescription()
{
Width = width,
Height = height,
Depth = depth,
ArraySize = arraySize,
Dimension = dimension,
Format = format,
MipLevels = mipMapCount,
};
}
示例14: New3D
/// <summary>
/// Creates a new <see cref="TextureDescription" />.
/// </summary>
/// <param name="width">The width.</param>
/// <param name="height">The height.</param>
/// <param name="depth">The depth.</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">true if the texture needs to support unordered read write.</param>
/// <param name="usage">The usage.</param>
/// <returns>A new instance of <see cref="TextureDescription" /> class.</returns>
public static TextureDescription New3D(int width, int height, int depth, MipMapCount mipCount, PixelFormat format, TextureFlags textureFlags = TextureFlags.ShaderResource, GraphicsResourceUsage usage = GraphicsResourceUsage.Default)
{
return New3D(width, height, depth, format, textureFlags, mipCount, usage);
}