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.

TextureLayered

繼承: Texture < Resource < RefCounted < Object

被繼承: CompressedTextureLayered, ImageTextureLayered, PlaceholderTextureLayered, TextureLayeredRD

包含多個 Image 的紋理型別的基底類別。每個圖像的大小和格式都是一樣的。

說明

ImageTextureLayeredCompressedTextureLayered 的基底類別。不能直接使用,但包含了存取衍生資源型別所需的所有函式。另見 Texture3D

資料是按層設定的。對於 Texture2DArray,層指定的是陣列層。

所有圖像都需要具有相同的寬度、高度和 mipmap 級別數。

TextureLayered 可以用 ResourceLoader.load() 載入。

在內部,Godot 將這些檔對應到目標算繪驅動程式(Vulkan、OpenGL3)中的對應文件。

方法

Format

_get_format() virtual required const

int

_get_height() virtual required const

Image

_get_layer_data(layer_index: int) virtual required const

int

_get_layered_type() virtual required const

int

_get_layers() virtual required const

int

_get_width() virtual required const

bool

_has_mipmaps() virtual required const

Format

get_format() const

int

get_height() const

Image

get_layer_data(layer: int) const

LayeredType

get_layered_type() const

int

get_layers() const

int

get_width() const

bool

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 required const 🔗

查詢該 TextureLayered 的格式時被呼叫。


int _get_height() virtual required const 🔗

查詢該 TextureLayered 的高度時被呼叫。


Image _get_layer_data(layer_index: int) virtual required const 🔗

查詢該 TextureLayered 中某一層的資料時被呼叫。


int _get_layered_type() virtual required const 🔗

查詢該 TextureLayered 的層型別時被呼叫。


int _get_layers() virtual required const 🔗

查詢該 TextureLayered 的層數時被呼叫。


int _get_width() virtual required const 🔗

查詢該 TextureLayered 的寬度時被呼叫。


bool _has_mipmaps() virtual required const 🔗

查詢該 TextureLayered 的 Mipmap 是否存在時被呼叫。


Format get_format() const 🔗

Returns the current format being used by this texture.


int get_height() const 🔗

返回該紋理的高度,單位為圖元。高度通常由 Y 軸表示。


Image get_layer_data(layer: int) const 🔗

返回帶有指定 layer 層資料的 Image 圖像資源。


LayeredType get_layered_type() const 🔗

返回該 TextureLayered 的型別。型別決定了資料的存取方式,立方體圖有特殊的類型。


int get_layers() const 🔗

返回引用的 Image 數。


int get_width() const 🔗

返回該紋理的寬度,單位為圖元。寬度通常由 X 軸表示。


bool has_mipmaps() const 🔗

如果層生成了 mipmap 則返回 true