Example #1
0
 /// <summary>
 /// Creates a new 2D <see cref="Texture" />.
 /// </summary>
 /// <param name="device">The <see cref="GraphicsDevice"/>.</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="textureData">Texture datas through an array of <see cref="DataBox"/> </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>
 /// <param name="multisampleCount">The multisample count.</param>
 /// <returns>A new instance of 2D <see cref="Texture" /> class.</returns>
 public static Texture New2D(
     GraphicsDevice device,
     int width,
     int height,
     MipMapCount mipCount,
     PixelFormat format,
     DataBox[] textureData,
     TextureFlags textureFlags         = TextureFlags.ShaderResource,
     int arraySize                     = 1,
     GraphicsResourceUsage usage       = GraphicsResourceUsage.Default,
     MultisampleCount multisampleCount = MultisampleCount.None)
 {
     return(new Texture(device).InitializeFrom(TextureDescription.New2D(width, height, mipCount, format, textureFlags, arraySize, usage, multisampleCount), textureData));
 }
Example #2
0
 /// <summary>
 /// Creates a new 3D <see cref="Texture"/>.
 /// </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="usage">The usage.</param>
 /// <param name="textureFlags">true if the texture needs to support unordered read write.</param>
 /// <returns>
 /// A new instance of 3D <see cref="Texture"/> class.
 /// </returns>
 public static Texture New3D(GraphicsDevice device, int width, int height, int depth, MipMapCount mipCount, PixelFormat format, TextureFlags textureFlags = TextureFlags.ShaderResource, GraphicsResourceUsage usage = GraphicsResourceUsage.Default)
 {
     return(new Texture(device).InitializeFrom(TextureDescription.New3D(width, height, depth, mipCount, format, textureFlags, usage)));
 }
 /// <summary>
 /// Creates a new 1D <see cref="Texture"/>.
 /// </summary>
 /// <param name="device">The <see cref="GraphicsDevice"/>.</param>
 /// <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="usage">The usage.</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>
 /// <returns>
 /// A new instance of 1D <see cref="Texture"/> class.
 /// </returns>
 public static Texture New1D(GraphicsDevice device, int width, MipMapCount mipCount, PixelFormat format, TextureFlags textureFlags = TextureFlags.ShaderResource, int arraySize = 1, GraphicsResourceUsage usage = GraphicsResourceUsage.Default)
 {
     return(New(device, TextureDescription.New1D(width, mipCount, format, textureFlags, arraySize, usage)));
 }
 /// <summary>
 /// Creates a new Cube <see cref="Texture" />.
 /// </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 &gt;=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 2D <see cref="Texture" /> class.</returns>
 public static Texture NewCube(GraphicsDevice device, int size, MipMapCount mipCount, PixelFormat format, TextureFlags textureFlags = TextureFlags.ShaderResource, GraphicsResourceUsage usage = GraphicsResourceUsage.Default)
 {
     return(new Texture(device).InitializeFrom(TextureDescription.NewCube(size, mipCount, format, textureFlags, usage)));
 }