Texture
Inherited By: , AtlasTexture, , GradientTexture, , LargeTexture, , ProxyTexture, , ViewportTexture
Category: Core
Texture for 2D and 3D.
Properties
Enumerations
- FLAG_MIPMAPS = 1 — Generate mipmaps, which are smaller versions of the same texture to use when zoomed out, keeping the aspect ratio.
- FLAG_REPEAT = 2 — Repeats texture (instead of clamp to edge).
- FLAG_FILTER = 4 — Magnifying filter, to enable smooth zooming in of the texture.
- FLAG_ANISOTROPIC_FILTER = 8 — Anisotropic mipmap filtering. Generates smaller versions of the same texture with different aspect ratios.
More effective on planes often shown going to the horrizon as those textures (Walls or Ground for example) get squashed in the viewport to different aspect ratios and regular mipmaps keep the aspect ratio so they don’t optimize storage that well in those cases.
- FLAG_CONVERT_TO_LINEAR = 16 — Converts texture to SRGB color space.
- FLAG_MIRRORED_REPEAT = 32 — Repeats texture with alternate sections mirrored.
- FLAG_VIDEO_SURFACE = 2048 — Texture is a video surface.
A texture works by registering an image in the video hardware, which then can be used in 3D models or 2D or GUI Control.
Textures are often created by loading them from a file. See .
Property Descriptions
- void draw ( RID canvas_item, position, Color modulate=Color( 1, 1, 1, 1 ), transpose=false, Texture normal_map=null ) const
- void draw_rect ( canvas_item, Rect2 rect, tile, Color modulate=Color( 1, 1, 1, 1 ), transpose=false, Texture normal_map=null ) const
- void draw_rect_region ( canvas_item, Rect2 rect, src_rect, Color modulate=Color( 1, 1, 1, 1 ), transpose=false, Texture normal_map=null, clip_uv=true ) const
- Image get_data ( ) const
- get_height ( ) const
Returns the texture height.
- Vector2 get_size ( ) const
Returns the texture size.
- get_width ( ) const
Returns the texture width.