Table of Contents

Class TextureCube

Namespace
Microsoft.Xna.Framework.Graphics
Assembly
MonoGame.Framework.dll

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 GraphicsDevice

The graphics device that will display the cube texture.

size int

The width and height, in pixels, of the cube texture.

mipMap bool

true if mimapping is enabled for this cube texture; otherwise, false.

format SurfaceFormat

The 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 CubeMapFace

The cube map face.

level int

The 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 int

The index of the element in the array at which to start copying.

elementCount int

The 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.
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 CubeMapFace

The 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.
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 CubeMapFace

The cube map face.

data T[]

The array of data to copy.

startIndex int

The index of the element in the array at which to start copying.

elementCount int

The 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.
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 CubeMapFace

The Cubemap face.

level int

The 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 int

The index of the element in the array at which to start copying.

elementCount int

The 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.
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 CubeMapFace

The 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.
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 CubeMapFace

The Cubemap face.

data T[]

The array of data to copy.

startIndex int

The index of the element in the array at which to start copying.

elementCount int

The 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.
ArgumentNullException

The data parameter is null.