纹理¶
Inherits: Resource < Reference < Object
继承人: AnimatedTexture , AtlasTexture , CameraTexture , CurveTexture , GradientTexture , ImageTexture , LargeTexture , MeshTexture , NoiseTexture , ProxyTexture , StreamTexture , ViewportTexture
类别: 核心
简要说明¶
二维和三维纹理。
方法¶
无效 |
draw ( RID canvas_item, Vector2 position, Color modulate=Color( 1, 1, 1, 1 ), bool transpose=false, Texture normal_map=null ) const |
无效 |
draw_rect ( RID canvas_item, Rect2 rect, bool tile, Color modulate=Color( 1, 1, 1, 1 ), bool transpose=false, Texture normal_map=null ) const |
无效 |
draw_rect_region ( RID canvas_item, Rect2 rect, Rect2 src_rect, Color modulate=Color( 1, 1, 1, 1 ), bool transpose=false, Texture normal_map=null, bool clip_uv=true ) const |
get_data ( ) const |
|
get_height ( ) const |
|
get_size ( ) const |
|
get_width ( ) const |
|
has_alpha ( ) const |
枚举¶
枚举 旗帜 :
FLAGS_DEFAULT = 7 ---默认标志。 FLAG_MIPMAPS , FLAG_REPEAT 和 FLAG_FILTER 已启用。
FLAG_MIPMAPS = 1 ---生成mipmap,这是缩小时要使用的相同纹理的较小版本,保持纵横比。
FLAG_REPEAT = 2 ---重复纹理(而不是夹到边缘)。
FLAG_FILTER = 4 ---使用放大滤镜,使纹理平滑放大。
FLAG_ANISOTROPIC_FILTER = 8 ---使用各向异性mipmap过滤。生成具有不同纵横比的相同纹理的较小版本。
当从倾斜角度观看时,这会产生更好的纹理。
FLAG_CONVERT_TO_LINEAR = 16 ---将纹理转换为sRGB颜色空间。
FLAG_MIRRORED_REPEAT = 32 ---使用镜像的替换部分重复纹理。
FLAG_VIDEO_SURFACE = 2048 ——纹理是一个视频表面。
描述¶
纹理的工作原理是在视频硬件中注册图像,然后可以在3D模型或2D中使用。 Sprite 或图形用户界面 Control .
纹理通常是通过从文件中加载来创建的。见 @GDScript.load .
方法说明¶
void draw ( RID canvas_item, Vector2 position, Color modulate=Color( 1, 1, 1, 1 ), bool transpose=false, Texture normal_map=null ) const
void draw_rect ( RID canvas_item, Rect2 rect, bool tile, Color modulate=Color( 1, 1, 1, 1 ), bool transpose=false, Texture normal_map=null ) const
void draw_rect_region ( RID canvas_item, Rect2 rect, Rect2 src_rect, Color modulate=Color( 1, 1, 1, 1 ), bool transpose=false, Texture normal_map=null, bool clip_uv=true ) const
Image get_data ( ) const
int get_height ( ) const
返回纹理高度。
Vector2 get_size ( ) const
返回纹理大小。
int get_width ( ) const
返回纹理宽度。
bool has_alpha ( ) const