Attention: Here be dragons
This is the latest
(unstable) version of this documentation, which may document features
not available in or compatible with released stable versions of Godot.
Checking the stable version of the documentation...
TextureLayered
继承: Texture < Resource < RefCounted < Object
派生: CompressedTextureLayered, ImageTextureLayered, PlaceholderTextureLayered, TextureLayeredRD
包含多个 Image 的纹理类型的基类。每个图像的大小和格式都是一样的。
描述
ImageTextureLayered 和 CompressedTextureLayered 的基类。不能直接使用,但包含了访问派生资源类型所需的所有函数。另见 Texture3D。
数据是按层设置的。对于 Texture2DArray,层指定的是数组层。
所有图像都需要具有相同的宽度、高度和 mipmap 级别数。
TextureLayered 可以用 ResourceLoader.load() 加载。
在内部,Godot 将这些文件映射到目标渲染驱动程序(Vulkan、OpenGL3)中的对应文件。
方法
_get_format() virtual const |
|
_get_height() virtual const |
|
_get_layer_data(layer_index: int) virtual const |
|
_get_layered_type() virtual const |
|
_get_layers() virtual const |
|
_get_width() virtual const |
|
_has_mipmaps() virtual const |
|
get_format() const |
|
get_height() const |
|
get_layer_data(layer: int) const |
|
get_layered_type() const |
|
get_layers() const |
|
get_width() const |
|
has_mipmaps() const |
枚举
enum LayeredType: 🔗
LayeredType LAYERED_TYPE_2D_ARRAY = 0
纹理为通用的 Texture2DArray。
LayeredType LAYERED_TYPE_CUBEMAP = 1
纹理为 Cubemap,每一面都有自己的层(共 6 层)。
LayeredType LAYERED_TYPE_CUBEMAP_ARRAY = 2
纹理为 CubemapArray,每个立方体贴图都由 6 层组成。
方法说明
Format _get_format() virtual const 🔗
查询该 TextureLayered 的格式时被调用。
int _get_height() virtual const 🔗
查询该 TextureLayered 的高度时被调用。
Image _get_layer_data(layer_index: int) virtual const 🔗
查询该 TextureLayered 中某一层的数据时被调用。
int _get_layered_type() virtual const 🔗
查询该 TextureLayered 的层类型时被调用。
int _get_layers() virtual const 🔗
查询该 TextureLayered 的层数时被调用。
int _get_width() virtual const 🔗
查询该 TextureLayered 的宽度时被调用。
bool _has_mipmaps() virtual const 🔗
查询该 TextureLayered 的 Mipmap 是否存在时被调用。
返回纹理当前使用的格式。详见 Format。
返回该纹理的高度,单位为像素。高度通常由 Y 轴表示。
Image get_layer_data(layer: int) const 🔗
返回带有指定 layer
层数据的 Image 图像资源。
LayeredType get_layered_type() const 🔗
返回该 TextureLayered 的类型。类型决定了数据的访问方式,立方体图有特殊的类型。
返回引用的 Image 数。
返回该纹理的宽度,单位为像素。宽度通常由 X 轴表示。
如果层生成了 mipmap 则返回 true
。