Version: 2022.2

Texture3DConstructor

切换到手册
public Texture3D (int width, int height, int depth, TextureFormat textureFormat, bool mipChain, bool createUninitialized= false);
public Texture3D (int width, int height, int depth, TextureFormat textureFormat, bool mipChain, IntPtr nativeTex= IntPtr.Zero);
public Texture3D (int width, int height, int depth, TextureFormat textureFormat, int mipCount, IntPtr nativeTex= IntPtr.Zero);
public Texture3D (int width, int height, int depth, TextureFormat textureFormat, int mipCount, IntPtr nativeTex= IntPtr.Zero, bool createUninitialized= false);

参数

width 纹理宽度(以像素为单位)。
height 纹理高度(以像素为单位)。
depth 纹理深度(以像素为单位)。
textureFormat 纹理数据格式。
mipChain 确定纹理是否具有 Mipmap。值为 1 (true) 表示纹理有 Mipmap,值为 0 (false) 表示纹理没有 Mipmap。
nativeTex External native texture pointer to use. Defaults to generating its own internal native texture.
mipCount Amount of mipmaps to allocate for the texture.
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.

描述

创建一个新的空 3D 纹理。

3D 纹理可视为具有宽度、高度和深度的一盒像素。注意,大纹理会占用大量内存,例如 TextureFormat.ARGB32 格式、没有多级渐进纹理的 1024x512x256 纹理会占用 512MB 内存。

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

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.

另请参阅:SetPixelSetPixelsSetPixels32Apply 函数。