Class TextureCube
Represents a set of six 2D textures, one for each face of a cube.
public class TextureCube : Texture, IDisposable
- Inheritance
-
TextureCube
- Implements
- Derived
- Inherited Members
Remarks
A texel represents the smallest unit of a texture that can be read from or written to by the GPU. A texel is composed of 1 to 4 components. Specifically, a texel may be any one of the available texture formats represented in the SurfaceFormat enumeration.
A cube texture is a collection of six textures, one for each face of the cube. All faces must be present in the cube texture. Also, a cube map surface must be the same pixel size in all three dimensions (x, y, and z).
Constructors
TextureCube(GraphicsDevice, int, bool, SurfaceFormat)
Creates an uninitialized TextureCube resource of the specified dimensions
public TextureCube(GraphicsDevice graphicsDevice, int size, bool mipMap, SurfaceFormat format)
Parameters
graphicsDeviceGraphicsDeviceThe graphics device that will display the cube texture.
sizeintThe width and height, in pixels, of the cube texture.
mipMapbooltrue if mimapping is enabled for this cube texture; otherwise, false.
formatSurfaceFormatThe surface format used by this cube texture.
Exceptions
- ArgumentNullException
The
graphicsDeviceparameter is null.- ArgumentOutOfRangeException
The
sizeparameter is less than or equal to zero.
Properties
Size
Gets the width and height of the cube map face in pixels.
public int Size { get; }
Property Value
- int
The width and height of a cube map face in pixels.
Methods
GetData<T>(CubeMapFace, int, Rectangle?, T[], int, int)
Copies the texture cube data into an array.
public void GetData<T>(CubeMapFace cubeMapFace, int level, Rectangle? rect, T[] data, int startIndex, int elementCount) where T : struct
Parameters
cubeMapFaceCubeMapFaceThe cube map face.
levelintThe mipmap level to copy from.
rectRectangle?The section of the texture where the data will be placed. null indicates the data will be copied over the entire texture.
dataT[]The array of data to copy.
startIndexintThe index of the element in the array at which to start copying.
elementCountintThe number of elements to copy.
Type Parameters
TThe type of the elements in the array.
Exceptions
- ArgumentException
One of the following conditions is true:
-
The
levelparameter is larger than the number of levels in this texture. -
The
rectis outside the bounds of the texture. -
The
Ttype size is invalid for the format of this texture. -
The
startIndexparameter is less than zero or is greater than or equal to the length of the data array. -
The
dataarray parameter is too small.
-
The
- ArgumentNullException
The
dataparameter is null.
GetData<T>(CubeMapFace, T[])
Copies the texture cube data into an array.
public void GetData<T>(CubeMapFace cubeMapFace, T[] data) where T : struct
Parameters
cubeMapFaceCubeMapFaceThe cube map face.
dataT[]The array of data to copy.
Type Parameters
TThe type of the elements in the array.
Exceptions
- ArgumentException
One of the following conditions is true:
-
The
Ttype size is invalid for the format of this texture. -
The
dataarray parameter is too small.
-
The
- ArgumentNullException
The
dataparameter is null.
GetData<T>(CubeMapFace, T[], int, int)
Copies the texture cube data into an array.
public void GetData<T>(CubeMapFace cubeMapFace, T[] data, int startIndex, int elementCount) where T : struct
Parameters
cubeMapFaceCubeMapFaceThe cube map face.
dataT[]The array of data to copy.
startIndexintThe index of the element in the array at which to start copying.
elementCountintThe number of elements to copy.
Type Parameters
TThe type of the elements in the array.
Exceptions
- ArgumentException
One of the following conditions is true:
-
The
Ttype size is invalid for the format of this texture. -
The
startIndexparameter is less than zero or is greater than or equal to the length of the data array. -
The
dataarray parameter is too small.
-
The
- ArgumentNullException
The
dataparameter is null.
SetData<T>(CubeMapFace, int, Rectangle?, T[], int, int)
Copies an array of data to the texture cube.
public void SetData<T>(CubeMapFace face, int level, Rectangle? rect, T[] data, int startIndex, int elementCount) where T : struct
Parameters
faceCubeMapFaceThe Cubemap face.
levelintThe mipmap level where the data will be placed.
rectRectangle?The section of the texture where the data will be placed. null indicates the data will be copied over the entire texture.
dataT[]The array of data to copy.
startIndexintThe index of the element in the array at which to start copying.
elementCountintThe number of elements to copy.
Type Parameters
TThe type of the elements in the array.
Exceptions
- ArgumentException
One of the following conditions is true:
-
The
levelparameter is larger than the number of levels in this texture. -
The
rectis outside the bounds of the texture. -
The
Ttype size is invalid for the format of this texture. -
The
startIndexparameter is less than zero or is greater than or equal to the length of the data array. -
The
dataarray parameter is too small.
-
The
- ArgumentNullException
The
dataparameter is null.
SetData<T>(CubeMapFace, T[])
Copies an array of data to the texture cube.
public void SetData<T>(CubeMapFace face, T[] data) where T : struct
Parameters
faceCubeMapFaceThe Cubemap face.
dataT[]The array of data to copy.
Type Parameters
TThe type of the elements in the array.
Exceptions
- ArgumentException
One of the following conditions is true:
-
The
Ttype size is invalid for the format of this texture. -
The
dataarray parameter is too small.
-
The
- ArgumentNullException
The
dataparameter is null.
SetData<T>(CubeMapFace, T[], int, int)
Copies an array of data to the texture cube.
public void SetData<T>(CubeMapFace face, T[] data, int startIndex, int elementCount) where T : struct
Parameters
faceCubeMapFaceThe Cubemap face.
dataT[]The array of data to copy.
startIndexintThe index of the element in the array at which to start copying.
elementCountintThe number of elements to copy.
Type Parameters
TThe type of the elements in the array.
Exceptions
- ArgumentException
One of the following conditions is true:
-
The
Ttype size is invalid for the format of this texture. -
The
startIndexparameter is less than zero or is greater than or equal to the length of the data array. -
The
dataarray parameter is too small.
-
The
- ArgumentNullException
The
dataparameter is null.