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)]
101 return New(device, size,
false, format, textureFlags, usage);
118 return new TextureCube(device, NewTextureCubeDescription(size, format, textureFlags, mipCount, usage));
137 if (textureData.Length != 6)
138 throw new ArgumentException(
"Invalid texture datas. First dimension must be equal to 6",
"textureData");
140 var dataBoxes =
new DataBox[6];
142 dataBoxes[0] = GetDataBox(
format,
size,
size, 1, textureData[0], (IntPtr)Interop.Fixed(textureData[0]));
143 dataBoxes[1] = GetDataBox(
format,
size,
size, 1, textureData[0], (IntPtr)Interop.Fixed(textureData[1]));
144 dataBoxes[2] = GetDataBox(
format,
size,
size, 1, textureData[0], (IntPtr)Interop.Fixed(textureData[2]));
145 dataBoxes[3] = GetDataBox(
format,
size,
size, 1, textureData[0], (IntPtr)Interop.Fixed(textureData[3]));
146 dataBoxes[4] = GetDataBox(
format,
size,
size, 1, textureData[0], (IntPtr)Interop.Fixed(textureData[4]));
147 dataBoxes[5] = GetDataBox(
format,
size,
size, 1, textureData[0], (IntPtr)Interop.Fixed(textureData[5]));
149 return new TextureCube(device, NewTextureCubeDescription(
size,
format, textureFlags, 1, usage), dataBoxes);
167 if (textureData.Length != 6)
168 throw new ArgumentException(
"Invalid texture datas. First dimension must be equal to 6",
"textureData");
170 return new TextureCube(device, NewTextureCubeDescription(size, format, textureFlags, 1, usage), textureData);
183 if (image == null)
throw new ArgumentNullException(
"image");
185 throw new ArgumentException(
"Invalid image. Must be Cube",
"image");
187 return new TextureCube(device, CreateTextureDescriptionFromImage(image, textureFlags, usage), image.
ToDataBox());
201 var texture = Texture.Load(device, stream, TextureFlags.ShaderResource, usage);
203 throw new ArgumentException(
string.Format(
"Texture is not type of [TextureCube] but [{0}]", texture.GetType().Name));
204 return (TextureCube)texture;
209 var desc = NewDescription(size, size, format, textureFlags, mipCount, 6, usage);
210 desc.Dimension = TextureDimension.TextureCube;
static TextureCube New(GraphicsDevice device, int size, MipMapCount mipCount, PixelFormat format, TextureFlags textureFlags=TextureFlags.ShaderResource, GraphicsResourceUsage usage=GraphicsResourceUsage.Default)
Creates a new TextureCube.
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 TextureCube New(GraphicsDevice device, TextureDescription description)
Creates a new texture from a Texture2DDescription.
static TextureCube New(GraphicsDevice device, int size, PixelFormat format, TextureFlags textureFlags=TextureFlags.ShaderResource, GraphicsResourceUsage usage=GraphicsResourceUsage.Default)
Creates a new TextureCube.
A TextureCube frontend to SharpDX.Direct3D11.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.
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.
override Texture Clone()
Makes a copy of this texture.
static new TextureCube New(GraphicsDevice device, Image image, TextureFlags textureFlags=TextureFlags.ShaderResource, GraphicsResourceUsage usage=GraphicsResourceUsage.Immutable)
Creates a new TextureCube directly from an Image.
A Common description for all textures.
static TextureCube New(GraphicsDevice device, TextureCube texture)
Creates a new texture from a Direct3D11.Texture2D.
A Texture 2D frontend to SharpDX.Direct3D11.Texture2D.
static TextureCube Load(GraphicsDevice device, Stream stream, bool isUnorderedReadWrite=false, GraphicsResourceUsage usage=GraphicsResourceUsage.Immutable)
Loads a Cube texture from a stream.
DataBox[] ToDataBox()
Gets the databox from this image.
override Texture ToStaging()
Return an equivalent staging texture CPU read-writable from this instance.
static TextureDescription NewTextureCubeDescription(int size, PixelFormat format, TextureFlags textureFlags, int mipCount, GraphicsResourceUsage usage)
Provides access to data organized in 3D.
_In_ size_t _In_ size_t _In_ DXGI_FORMAT format
_In_ size_t _In_ size_t size
PixelFormat
Defines various types of pixel formats.
static TextureCube New(GraphicsDevice device, int size, PixelFormat format, DataBox[] textureData, TextureFlags textureFlags=TextureFlags.ShaderResource, GraphicsResourceUsage usage=GraphicsResourceUsage.Immutable)
Creates a new TextureCube from a initial data..
TextureDimension Dimension
The dimension of a texture.
Base class for texture resources.