class_texture.rst 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  2. .. DO NOT EDIT THIS FILE, but the Texture.xml source instead.
  3. .. The source is found in doc/classes or modules/<name>/doc_classes.
  4. .. _class_Texture:
  5. Texture
  6. =======
  7. **Inherits:** :ref:`Resource<class_resource>` **<** :ref:`Reference<class_reference>` **<** :ref:`Object<class_object>`
  8. **Inherited By:** :ref:`CurveTexture<class_curvetexture>`, :ref:`AtlasTexture<class_atlastexture>`, :ref:`ProxyTexture<class_proxytexture>`, :ref:`GradientTexture<class_gradienttexture>`, :ref:`ViewportTexture<class_viewporttexture>`, :ref:`StreamTexture<class_streamtexture>`, :ref:`ImageTexture<class_imagetexture>`, :ref:`LargeTexture<class_largetexture>`
  9. **Category:** Core
  10. Brief Description
  11. -----------------
  12. Texture for 2D and 3D.
  13. Member Functions
  14. ----------------
  15. +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  16. | void | :ref:`draw<class_Texture_draw>` **(** :ref:`RID<class_rid>` canvas_item, :ref:`Vector2<class_vector2>` position, :ref:`Color<class_color>` modulate=Color( 1, 1, 1, 1 ), :ref:`bool<class_bool>` transpose=false, :ref:`Texture<class_texture>` normal_map=null **)** const |
  17. +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  18. | void | :ref:`draw_rect<class_Texture_draw_rect>` **(** :ref:`RID<class_rid>` canvas_item, :ref:`Rect2<class_rect2>` rect, :ref:`bool<class_bool>` tile, :ref:`Color<class_color>` modulate=Color( 1, 1, 1, 1 ), :ref:`bool<class_bool>` transpose=false, :ref:`Texture<class_texture>` normal_map=null **)** const |
  19. +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  20. | void | :ref:`draw_rect_region<class_Texture_draw_rect_region>` **(** :ref:`RID<class_rid>` canvas_item, :ref:`Rect2<class_rect2>` rect, :ref:`Rect2<class_rect2>` src_rect, :ref:`Color<class_color>` modulate=Color( 1, 1, 1, 1 ), :ref:`bool<class_bool>` transpose=false, :ref:`Texture<class_texture>` normal_map=null, :ref:`bool<class_bool>` clip_uv=true **)** const |
  21. +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  22. | :ref:`Image<class_image>` | :ref:`get_data<class_Texture_get_data>` **(** **)** const |
  23. +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  24. | :ref:`int<class_int>` | :ref:`get_height<class_Texture_get_height>` **(** **)** const |
  25. +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  26. | :ref:`Vector2<class_vector2>` | :ref:`get_size<class_Texture_get_size>` **(** **)** const |
  27. +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  28. | :ref:`int<class_int>` | :ref:`get_width<class_Texture_get_width>` **(** **)** const |
  29. +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  30. | :ref:`bool<class_bool>` | :ref:`has_alpha<class_Texture_has_alpha>` **(** **)** const |
  31. +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  32. Member Variables
  33. ----------------
  34. .. _class_Texture_flags:
  35. - :ref:`int<class_int>` **flags** - The texture's flags.
  36. Enums
  37. -----
  38. .. _enum_Texture_Flags:
  39. enum **Flags**
  40. - **FLAGS_DEFAULT** = **7** --- Default flags. Generate mipmaps, repeat, and filter are enabled.
  41. - **FLAG_MIPMAPS** = **1** --- Generate mipmaps, which are smaller versions of the same texture to use when zoomed out, keeping the aspect ratio.
  42. - **FLAG_REPEAT** = **2** --- Repeats texture (instead of clamp to edge).
  43. - **FLAG_FILTER** = **4** --- Magnifying filter, to enable smooth zooming in of the texture.
  44. - **FLAG_ANISOTROPIC_FILTER** = **8** --- Anisotropic mipmap filtering. Generates smaller versions of the same texture with different aspect ratios.
  45. 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.
  46. - **FLAG_CONVERT_TO_LINEAR** = **16** --- Converts texture to SRGB color space.
  47. - **FLAG_MIRRORED_REPEAT** = **32** --- Repeats texture with alternate sections mirrored.
  48. - **FLAG_VIDEO_SURFACE** = **4096** --- Texture is a video surface.
  49. Description
  50. -----------
  51. A texture works by registering an image in the video hardware, which then can be used in 3D models or 2D :ref:`Sprite<class_sprite>` or GUI :ref:`Control<class_control>`.
  52. Member Function Description
  53. ---------------------------
  54. .. _class_Texture_draw:
  55. - void **draw** **(** :ref:`RID<class_rid>` canvas_item, :ref:`Vector2<class_vector2>` position, :ref:`Color<class_color>` modulate=Color( 1, 1, 1, 1 ), :ref:`bool<class_bool>` transpose=false, :ref:`Texture<class_texture>` normal_map=null **)** const
  56. .. _class_Texture_draw_rect:
  57. - void **draw_rect** **(** :ref:`RID<class_rid>` canvas_item, :ref:`Rect2<class_rect2>` rect, :ref:`bool<class_bool>` tile, :ref:`Color<class_color>` modulate=Color( 1, 1, 1, 1 ), :ref:`bool<class_bool>` transpose=false, :ref:`Texture<class_texture>` normal_map=null **)** const
  58. .. _class_Texture_draw_rect_region:
  59. - void **draw_rect_region** **(** :ref:`RID<class_rid>` canvas_item, :ref:`Rect2<class_rect2>` rect, :ref:`Rect2<class_rect2>` src_rect, :ref:`Color<class_color>` modulate=Color( 1, 1, 1, 1 ), :ref:`bool<class_bool>` transpose=false, :ref:`Texture<class_texture>` normal_map=null, :ref:`bool<class_bool>` clip_uv=true **)** const
  60. .. _class_Texture_get_data:
  61. - :ref:`Image<class_image>` **get_data** **(** **)** const
  62. .. _class_Texture_get_height:
  63. - :ref:`int<class_int>` **get_height** **(** **)** const
  64. Return the texture height.
  65. .. _class_Texture_get_size:
  66. - :ref:`Vector2<class_vector2>` **get_size** **(** **)** const
  67. Return the texture size.
  68. .. _class_Texture_get_width:
  69. - :ref:`int<class_int>` **get_width** **(** **)** const
  70. Return the texture width.
  71. .. _class_Texture_has_alpha:
  72. - :ref:`bool<class_bool>` **has_alpha** **(** **)** const