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
graphicsDevice
GraphicsDeviceThe graphics device that will display the cube texture.
size
intThe width and height, in pixels, of the cube texture.
mipMap
booltrue if mimapping is enabled for this cube texture; otherwise, false.
format
SurfaceFormatThe surface format used by this cube texture.
Exceptions
- ArgumentNullException
The
graphicsDevice
parameter is null.- ArgumentOutOfRangeException
The
size
parameter 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
cubeMapFace
CubeMapFaceThe cube map face.
level
intThe mipmap level to copy from.
rect
Rectangle?The section of the texture where the data will be placed. null indicates the data will be copied over the entire texture.
data
T[]The array of data to copy.
startIndex
intThe index of the element in the array at which to start copying.
elementCount
intThe number of elements to copy.
Type Parameters
T
The type of the elements in the array.
Exceptions
- ArgumentException
One of the following conditions is true:
-
The
level
parameter is larger than the number of levels in this texture. -
The
rect
is outside the bounds of the texture. -
The
T
type size is invalid for the format of this texture. -
The
startIndex
parameter is less than zero or is greater than or equal to the length of the data array. -
The
data
array parameter is too small.
-
The
- ArgumentNullException
The
data
parameter 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
cubeMapFace
CubeMapFaceThe cube map face.
data
T[]The array of data to copy.
Type Parameters
T
The type of the elements in the array.
Exceptions
- ArgumentException
One of the following conditions is true:
-
The
T
type size is invalid for the format of this texture. -
The
data
array parameter is too small.
-
The
- ArgumentNullException
The
data
parameter 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
cubeMapFace
CubeMapFaceThe cube map face.
data
T[]The array of data to copy.
startIndex
intThe index of the element in the array at which to start copying.
elementCount
intThe number of elements to copy.
Type Parameters
T
The type of the elements in the array.
Exceptions
- ArgumentException
One of the following conditions is true:
-
The
T
type size is invalid for the format of this texture. -
The
startIndex
parameter is less than zero or is greater than or equal to the length of the data array. -
The
data
array parameter is too small.
-
The
- ArgumentNullException
The
data
parameter 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
face
CubeMapFaceThe Cubemap face.
level
intThe mipmap level where the data will be placed.
rect
Rectangle?The section of the texture where the data will be placed. null indicates the data will be copied over the entire texture.
data
T[]The array of data to copy.
startIndex
intThe index of the element in the array at which to start copying.
elementCount
intThe number of elements to copy.
Type Parameters
T
The type of the elements in the array.
Exceptions
- ArgumentException
One of the following conditions is true:
-
The
level
parameter is larger than the number of levels in this texture. -
The
rect
is outside the bounds of the texture. -
The
T
type size is invalid for the format of this texture. -
The
startIndex
parameter is less than zero or is greater than or equal to the length of the data array. -
The
data
array parameter is too small.
-
The
- ArgumentNullException
The
data
parameter 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
face
CubeMapFaceThe Cubemap face.
data
T[]The array of data to copy.
Type Parameters
T
The type of the elements in the array.
Exceptions
- ArgumentException
One of the following conditions is true:
-
The
T
type size is invalid for the format of this texture. -
The
data
array parameter is too small.
-
The
- ArgumentNullException
The
data
parameter 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
face
CubeMapFaceThe Cubemap face.
data
T[]The array of data to copy.
startIndex
intThe index of the element in the array at which to start copying.
elementCount
intThe number of elements to copy.
Type Parameters
T
The type of the elements in the array.
Exceptions
- ArgumentException
One of the following conditions is true:
-
The
T
type size is invalid for the format of this texture. -
The
startIndex
parameter is less than zero or is greater than or equal to the length of the data array. -
The
data
array parameter is too small.
-
The
- ArgumentNullException
The
data
parameter is null.