Up to date

This page is up to date for Godot 4.2. If you still find outdated information, please open an issue.

Texture3D

继承: Texture < Resource < RefCounted < Object

派生: CompressedTexture3D, ImageTexture3D, NoiseTexture3D, PlaceholderTexture3D, Texture3DRD

3D 纹理的基类。

描述

ImageTexture3DCompressedTexture3D 的基类。无法直接使用,但包含所有访问派生资源类型所需的函数。Texture3D 是所有三维纹理类型的基类。另见 TextureLayered

所有图像都需要有相同的宽度、高度和 mipmap 层数。

要自己创建这样的纹理文件,请使用 Godot 编辑器的导入预设重新导入你的图像文件。

方法

Image[]

_get_data ( ) virtual const

int

_get_depth ( ) virtual const

Format

_get_format ( ) virtual const

int

_get_height ( ) virtual const

int

_get_width ( ) virtual const

bool

_has_mipmaps ( ) virtual const

Resource

create_placeholder ( ) const

Image[]

get_data ( ) const

int

get_depth ( ) const

Format

get_format ( ) const

int

get_height ( ) const

int

get_width ( ) const

bool

has_mipmaps ( ) const


方法说明

Image[] _get_data ( ) virtual const

查询该 Texture3D 的数据时被调用。


int _get_depth ( ) virtual const

查询该 Texture3D 的深度时被调用。


Format _get_format ( ) virtual const

查询该 Texture3D 的格式时被调用。


int _get_height ( ) virtual const

查询该 Texture3D 的高度时被调用。


int _get_width ( ) virtual const

查询该 Texture3D 的宽度时被调用。


bool _has_mipmaps ( ) virtual const

查询该 Texture3D 的 Mipmap 是否存在时被调用。


Resource create_placeholder ( ) const

创建该资源的占位符版本(PlaceholderTexture3D)。


Image[] get_data ( ) const

将该 Texture3D 的数据作为 Image 数组返回。每个 Image 代表该 Texture3D 的一个切片,不同的切片映射到不同的深度(Z 轴)级别。


int get_depth ( ) const

返回该 Texture3D 的深度,单位为像素。深度通常由 Z 轴表示(Texture2D 中没有这个维度)。


Format get_format ( ) const

返回纹理当前使用的格式。详情见 Format


int get_height ( ) const

返回该 Texture3D 的高度,单位为像素。宽度通常由 Y 轴表示。


int get_width ( ) const

返回该 Texture3D 的宽度,单位为像素。宽度通常由 X 轴表示。


bool has_mipmaps ( ) const

如果该 Texture3D 已生成 mipmap,则返回 true