Texture2D.PackTextures 纹理包
function PackTextures (textures : Texture2D[], padding : int, maximumAtlasSize : int = 2048) : Rect[]
Parameters参数
-
texturesArray of textures to pack into atlas.
纹理数组被打包到集合中 -
paddingPadding in pixels between packed textures.
打包纹理的像素间距 -
maximumAtlasSizeMaximum size of the resulting texture.
调整纹理的最大尺寸
Rect[] - An array of rectangles containing the UV coordinates in the atlas for each input texture, or null if packing fails.
返回Rect[]类型,矩形的数组包含每个输入的纹理的UV坐标集合,如果打包失败则值为null
Description描述
Packs multiple textures into a texture atlas.
打包多个纹理到纹理集合中
This function will replace current texture with the texture atlas. Size, format and whether the texture has mipmaps can change after packing.
此函数将使用纹理图集替换当前的纹理。纹理大小、格式和纹理是否有 mipmap 在打包后可以更改。
Resulting texture atlas will be as large as needed to fit all input textures, but only up to maximumAtlasSize in each dimension. If all input textures can't fit into texture atlas of such size, they will be scaled down to fit.
生成纹理图集将根据需要尽可能的大以便适合所有纹理,但是不能超过 maximumAtlasSize 中的最大值。如纹理集合不能容纳所输入的纹理,这些纹理将按比例缩小以适合纹理集合。
Texture atlas will have DXT1 format if all input textures are DXT1 compressed. If all input textures are compressed in DXT1 or DXT5 formats, then atlas will be in DXT5 format. If any input texture is not compressed, then atlas will be in ARGB32 uncompressed format.
如果导入的贴图是DXT1格式的,那么这个纹理集合也是DXT1格式的,如果导入的纹理含有DXT1和DXT5格式的,那么这个纹理集合就是DXT5格式的。如果这些纹理在打包前没有被压缩,这个纹理集合将会是ARGB32位格式的
If none of input textures have mipmaps, then atlas will have no mipmaps as well.
如果输入的纹理没有mipmaps,那么这个集合也不会有mipmsps