27 using SiliconStudio.Core.Serialization.Converters;
28 using SiliconStudio.Paradox.Games;
29 using SiliconStudio.Core;
31 namespace SiliconStudio.
Paradox.Graphics
36 [
DataConverter(AutoGenerate =
false, ContentReference =
true, DataType =
false)]
89 return new Texture2D(device, textureDescription);
105 return New(device, width, height,
false, format, textureFlags, arraySize, usage);
122 return new Texture2D(device, NewDescription(width, height, format, textureFlags, mipCount, arraySize, usage));
142 return New(device, width, height, 1,
format,
new []{ GetDataBox(
format, width, height, 1, textureData, (IntPtr)Interop.Fixed(textureData)) }, textureFlags, 1, usage);
160 return new Texture2D(device, NewDescription(width, height, format, textureFlags, mipCount, arraySize, usage), textureData);
173 if (image == null)
throw new ArgumentNullException(
"image");
175 throw new ArgumentException(
"Invalid image. Must be 2D",
"image");
177 return new Texture2D(device, CreateTextureDescriptionFromImage(image, textureFlags, usage), image.
ToDataBox());
191 var texture = Texture.Load(device, stream, textureFlags, usage);
193 throw new ArgumentException(
string.Format(
"Texture is not type of [Texture2D] but [{0}]", texture.GetType().Name));
194 return (Texture2D)texture;
static new Texture2D New(GraphicsDevice device, Image image, TextureFlags textureFlags=TextureFlags.ShaderResource, GraphicsResourceUsage usage=GraphicsResourceUsage.Immutable)
Creates a new Texture2D directly from an Image.
A simple wrapper to specify number of mipmaps. Set to true to specify all mipmaps or sets an integer ...
Provides method to instantiate an image 1D/2D/3D supporting TextureArray and mipmaps on the CPU or to...
static Texture2D New(GraphicsDevice device, int width, int height, MipMapCount mipCount, PixelFormat format, TextureFlags textureFlags=TextureFlags.ShaderResource, int arraySize=1, GraphicsResourceUsage usage=GraphicsResourceUsage.Default)
Creates a new Texture2D.
Base class for converters to/from a data type.
GraphicsResourceUsage
Identifies expected resource use during rendering. The usage directly reflects whether a resource is ...
ImageDescription Description
Description of this image.
override Texture ToStaging()
Return an equivalent staging texture CPU read-writable from this instance.
TextureDimension
Defines the dimension of a texture.
Performs primitive-based rendering, creates resources, handles system-level variables, adjusts gamma ramp levels, and creates shaders. See The+GraphicsDevice+class to learn more about the class.
A Common description for all textures.
static Texture2D New(GraphicsDevice device, TextureDescription textureDescription)
Creates a new texture from a Direct3D11.Texture2D.
A Texture 2D frontend to SharpDX.Direct3D11.Texture2D.
static Texture2D New(GraphicsDevice device, int width, int height, PixelFormat format, TextureFlags textureFlags=TextureFlags.ShaderResource, int arraySize=1, GraphicsResourceUsage usage=GraphicsResourceUsage.Default)
Creates a new Texture2D with a single mipmap.
A Texture 2D frontend to SharpDX.Direct3D11.Texture2D.
static Texture2D New(GraphicsDevice device, Texture2D texture)
Creates a new texture from a Direct3D11.Texture2D.
override Texture Clone()
Makes a copy of this texture.
DataBox[] ToDataBox()
Gets the databox from this image.
Provides access to data organized in 3D.
_In_ size_t _In_ size_t _In_ DXGI_FORMAT format
PixelFormat
Defines various types of pixel formats.
static new Texture2D Load(GraphicsDevice device, Stream stream, TextureFlags textureFlags=TextureFlags.ShaderResource, GraphicsResourceUsage usage=GraphicsResourceUsage.Immutable)
Loads a 2D texture from a stream.
static Texture2D New(GraphicsDevice device, int width, int height, MipMapCount mipCount, PixelFormat format, DataBox[] textureData, TextureFlags textureFlags=TextureFlags.ShaderResource, int arraySize=1, GraphicsResourceUsage usage=GraphicsResourceUsage.Default)
Creates a new Texture2D.
TextureDimension Dimension
The dimension of a texture.
Base class for texture resources.