//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
//**************** Copyright (c) 2016 Marko Pintera (marko.pintera@gmail.com). All rights reserved. **********************//
using System;
using System.Runtime.CompilerServices;
namespace BansheeEngine
{
/** @addtogroup Rendering
* @{
*/
public partial class Texture
{
///
/// Creates a new blank 2D texture.
///
/// Width of the texture in pixels.
/// Height of the texture in pixels.
/// Format of the pixels.
/// Describes planned texture use.
/// If higher than 1, texture containing multiple samples per pixel is created.
/// Should the texture allocate memory for the entire mip-map chain or only the top level.
///
/// If true the texture data is assumed to have be gamma corrected and will be
/// converted back to linear space when sampled on GPU, and converted to gamma space
/// before being written by the GPU.
public static Texture Create2D(uint width, uint height, PixelFormat format = PixelFormat.RGBA8,
TextureUsage usage = TextureUsage.Default, uint numSamples = 1, bool hasMipmaps = false,
bool gammaCorrection = false)
{
Texture texture = new Texture(true);
Internal_create(texture, format, width, height, 1, TextureType.Texture2D, usage, numSamples,
hasMipmaps, gammaCorrection);
return texture;
}
///
/// Creates a new blank 3D texture.
///
/// Width of the texture in pixels.
/// Height of the texture in pixels.
/// Depth of the texture in pixels.
/// Format of the pixels.
/// Describes planned texture use.
/// Should the texture allocate memory for the entire mip-map chain or only the top level.
///
public static Texture Create3D(uint width, uint height, uint depth, PixelFormat format = PixelFormat.RGBA8,
TextureUsage usage = TextureUsage.Default, bool hasMipmaps = false)
{
Texture texture = new Texture(true);
Internal_create(texture, format, width, height, depth, TextureType.Texture3D, usage, 1,
hasMipmaps, false);
return texture;
}
///
/// Creates a new blank cubemap texture.
///
/// Width & height of a single cubemap face in pixels.
/// Format of the pixels.
/// Describes planned texture use.
/// Should the texture allocate memory for the entire mip-map chain or only the top level.
///
/// If true the texture data is assumed to have be gamma corrected and will be
/// converted back to linear space when sampled on GPU, and converted to gamma space
/// before being written by the GPU.
public static Texture CreateCube(uint size, PixelFormat format = PixelFormat.RGBA8,
TextureUsage usage = TextureUsage.Default, bool hasMipmaps = false, bool gammaCorrection = false)
{
Texture texture = new Texture(true);
Internal_create(texture, format, size, size, 1, TextureType.TextureCube, usage, 1,
hasMipmaps, gammaCorrection);
return texture;
}
}
///
/// Indices for the faces of a cube texture.
///
public enum CubeFace
{
PositiveX = 0,
NegativeX = 1,
PositiveY = 2,
NegativeY = 3,
PositiveZ = 4,
NegativeZ = 5,
}
/** @} */
}