Version: 2022.2

Texture2DArrayConstructor

切换到手册
public Texture2DArray (int width, int height, int depth, TextureFormat textureFormat, bool mipChain, bool linear= false);
public Texture2DArray (int width, int height, int depth, TextureFormat textureFormat, bool mipChain, bool linear= false, bool createUninitialized= false);
public Texture2DArray (int width, int height, int depth, TextureFormat textureFormat, int mipCount, bool linear);
public Texture2DArray (int width, int height, int depth, TextureFormat textureFormat, int mipCount, bool linear, bool createUninitialized);

参数

width 纹理数组的宽度(以像素为单位)。
height 纹理数组的高度(以像素为单位)。
depth 纹理数组元素的数量。
linear 纹理是否包含非颜色数据(即,采样时不进行任何颜色空间转换)?默认为 false。
textureFormat 纹理的格式。
mipChain 是否应该创建多级渐进纹理?
mipCount Amount of mips to allocate for the texture array.
createUninitialized Use this flag to create the texture with uninitialized data. When overriding all texels anyway, this can lead to improved performance and reduced memory usage.

描述

创建一个新的纹理数组。

Enable createUninitialized to make the texture reference uninitialized data (both on the CPU and GPU). When overriding all texels, this can lead to improved performance and reduced memory usage during construction. Note that sampling an uninitialized texture gives unpredictable values.

创建纹理后,通常需要设置其颜色。 使用 SetPixelsSetPixels32Graphics.CopyTexture 函数可进行此设置。

Note that this class does not support Texture2DArray creation with a Crunch compression TextureFormat.