class TextureEx

Extension class for Texture, for adding additional functionality for the script version of PixelData.

Public

Methods

staticCreate

static HTexture Create(PixelFormat format, u32 width, u32 height, u32 depth, TextureType texType, TextureUsageFlags usage, u32 numSamples, bool hasMipmaps, bool gammaCorrection)

staticGetPixelFormat

static PixelFormat GetPixelFormat(const HTexture &thisPtr)

staticGetUsage

static TextureUsageFlags GetUsage(const HTexture &thisPtr)

staticGetType

static TextureType GetType(const HTexture &thisPtr)

staticGetWidth

static u32 GetWidth(const HTexture &thisPtr)

staticGetHeight

static u32 GetHeight(const HTexture &thisPtr)

staticGetDepth

static u32 GetDepth(const HTexture &thisPtr)

staticGetGammaCorrection

static bool GetGammaCorrection(const HTexture &thisPtr)

staticGetSampleCount

static u32 GetSampleCount(const HTexture &thisPtr)

staticGetMipmapCount

static u32 GetMipmapCount(const HTexture &thisPtr)

staticGetPixels

static SPtr<PixelData> GetPixels(const HTexture &thisPtr, u32 face = 0, u32 mipLevel = 0)

Returns pixels for the specified mip level & face.

Pixels will be read from system memory, which means the texture has to be created with TextureUsage.CPUCached. If the texture was updated from the GPU the pixels retrieved from this method will not reflect that, and you should use GetGPUPixels instead.

mipLevel
Mip level to retrieve pixels for. Top level (0) is the highest quality.
face
Face to read the pixels from. Cubemap textures have six faces whose face indices are as specified in the CubeFace enum. Array textures can have an arbitrary number of faces (if it's a cubemap array it has to be a multiple of 6).

Returns: A set of pixels for the specified mip level.

staticSetPixels

static void SetPixels(const HTexture &thisPtr, const SPtr<PixelData> &data, u32 face = 0, u32 mipLevel = 0)

Sets pixels for the specified mip level and face.

data
Pixels to assign to the specified mip level. Pixel data must match the mip level size and texture pixel format.
mipLevel
Mip level to set pixels for. Top level (0) is the highest quality.
face
Face to write the pixels to. Cubemap textures have six faces whose face indices are as specified in the CubeFace enum. Array textures can have an arbitrary number of faces (if it's a cubemap array it has to be a multiple of 6).

staticSetPixelsArray

static void SetPixelsArray(const HTexture &thisPtr, const Vector<Color> &colors, u32 face = 0, u32 mipLevel = 0)

Sets pixels for the specified mip level and face.

colors
Pixels to assign to the specified mip level. Size of the array must match the mip level dimensions. Data is expected to be laid out row by row. Pixels will be automatically converted to the valid pixel format.
mipLevel
Mip level to set pixels for. Top level (0) is the highest quality.
face
Face to write the pixels to. Cubemap textures have six faces whose face indices are as specified in the CubeFace enum. Array textures can have an arbitrary number of faces (if it's a cubemap array it has to be a multiple of 6).