Inherits: Resource < Reference < Object
Inherited By: AnimatedTexture, AtlasTexture, CameraTexture, CurveTexture, ExternalTexture, GradientTexture, ImageTexture, LargeTexture, MeshTexture, NoiseTexture, ProxyTexture, StreamTexture, ViewportTexture
Texture for 2D and 3D.
A texture works by registering an image in the video hardware, which then can be used in 3D models or 2D Sprite or GUI Control.
Textures are often created by loading them from a file. See @GDScript.load.
Texture
is a base for other resources. It cannot be used directly.
int | flags | 4 |
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 |
enum Flags:
This results in better-looking textures when viewed from oblique angles.
Default | 4 |
Setter | set_flags(value) |
Getter | get_flags() |
The texture's Flags. Flags are used to set various properties of the Texture
.
Draws the texture using a CanvasItem with the VisualServer API at the specified position
. Equivalent to VisualServer.canvas_item_add_texture_rect with a rect at position
and the size of this Texture
.
Draws the texture using a CanvasItem with the VisualServer API. Equivalent to VisualServer.canvas_item_add_texture_rect.
Draws a part of the texture using a CanvasItem with the VisualServer API. Equivalent to VisualServer.canvas_item_add_texture_rect_region.
Returns an Image that is a copy of data from this Texture
. Images can be accessed and manipulated directly.
Returns the texture height.
Returns the texture size.
Returns the texture width.
Returns true
if this Texture
has an alpha channel.
© 2014–2020 Juan Linietsky, Ariel Manzur, Godot Engine contributors
Licensed under the MIT License.
https://docs.godotengine.org/en/3.2/classes/class_texture.html