:github_url: hide .. DO NOT EDIT THIS FILE!!! .. Generated automatically from Godot engine sources. .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py. .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/DrawableTexture2D.xml. .. _class_DrawableTexture2D: DrawableTexture2D ================= **Inherits:** :ref:`Texture2D` **<** :ref:`Texture` **<** :ref:`Resource` **<** :ref:`RefCounted` **<** :ref:`Object` A 2D texture that supports drawing to itself via Blit calls. .. rst-class:: classref-introduction-group Description ----------- A 2D texture that can be modified via blit calls, copying from a target texture to itself. Primarily intended to be managed in code, a user must call :ref:`setup()` to initialize the state before drawing. Each :ref:`blit_rect()` call takes at least a rectangle, the area to draw to, and another texture, what to be drawn. The draw calls use a Texture_Blit Shader to process and calculate the result, pixel by pixel. Users can supply their own ShaderMaterial with custom Texture_Blit shaders for more complex behaviors. .. rst-class:: classref-reftable-group Properties ---------- .. table:: :widths: auto +-------------------------+-------------------------+----------------------------------------------------------------------------------------+ | :ref:`bool` | resource_local_to_scene | ``false`` (overrides :ref:`Resource`) | +-------------------------+-------------------------+----------------------------------------------------------------------------------------+ .. rst-class:: classref-reftable-group Methods ------- .. table:: :widths: auto +-------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | |void| | :ref:`blit_rect`\ (\ rect\: :ref:`Rect2i`, source\: :ref:`Texture2D`, modulate\: :ref:`Color` = Color(1, 1, 1, 1), mipmap\: :ref:`int` = 0, material\: :ref:`Material` = null\ ) | +-------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | |void| | :ref:`blit_rect_multi`\ (\ rect\: :ref:`Rect2i`, sources\: :ref:`Array`\[:ref:`Texture2D`\], extra_targets\: :ref:`Array`\[:ref:`DrawableTexture2D`\], modulate\: :ref:`Color` = Color(1, 1, 1, 1), mipmap\: :ref:`int` = 0, material\: :ref:`Material` = null\ ) | +-------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | |void| | :ref:`generate_mipmaps`\ (\ ) | +-------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`get_use_mipmaps`\ (\ ) |const| | +-------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | |void| | :ref:`set_format`\ (\ format\: :ref:`DrawableFormat`\ ) | +-------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | |void| | :ref:`set_use_mipmaps`\ (\ mipmaps\: :ref:`bool`\ ) | +-------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | |void| | :ref:`setup`\ (\ width\: :ref:`int`, height\: :ref:`int`, format\: :ref:`DrawableFormat`, color\: :ref:`Color` = Color(1, 1, 1, 1), use_mipmaps\: :ref:`bool` = false\ ) | +-------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Enumerations ------------ .. _enum_DrawableTexture2D_DrawableFormat: .. rst-class:: classref-enumeration enum **DrawableFormat**: :ref:`🔗` .. _class_DrawableTexture2D_constant_DRAWABLE_FORMAT_RGBA8: .. rst-class:: classref-enumeration-constant :ref:`DrawableFormat` **DRAWABLE_FORMAT_RGBA8** = ``0`` OpenGL texture format RGBA with four components, each with a bitdepth of 8. .. _class_DrawableTexture2D_constant_DRAWABLE_FORMAT_RGBA8_SRGB: .. rst-class:: classref-enumeration-constant :ref:`DrawableFormat` **DRAWABLE_FORMAT_RGBA8_SRGB** = ``1`` OpenGL texture format RGBA with four components, each with a bitdepth of 8. When drawn to, an sRGB to linear color space conversion is performed. .. _class_DrawableTexture2D_constant_DRAWABLE_FORMAT_RGBAH: .. rst-class:: classref-enumeration-constant :ref:`DrawableFormat` **DRAWABLE_FORMAT_RGBAH** = ``2`` OpenGL texture format GL_RGBA16F where there are four components, each a 16-bit "half-precision" floating-point value. .. _class_DrawableTexture2D_constant_DRAWABLE_FORMAT_RGBAF: .. rst-class:: classref-enumeration-constant :ref:`DrawableFormat` **DRAWABLE_FORMAT_RGBAF** = ``3`` OpenGL texture format GL_RGBA32F where there are four components, each a 32-bit floating-point value. .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Method Descriptions ------------------- .. _class_DrawableTexture2D_method_blit_rect: .. rst-class:: classref-method |void| **blit_rect**\ (\ rect\: :ref:`Rect2i`, source\: :ref:`Texture2D`, modulate\: :ref:`Color` = Color(1, 1, 1, 1), mipmap\: :ref:`int` = 0, material\: :ref:`Material` = null\ ) :ref:`🔗` **Experimental:** This method may be changed or removed in future versions. Draws to given ``rect`` on this texture by copying from the given ``source``. A ``modulate`` color can be passed in for the shader to use, but defaults to White. The ``mipmap`` value can specify a draw to a lower mipmap level. The ``material`` parameter can take a ShaderMaterial with a TextureBlit Shader for custom drawing behavior. .. rst-class:: classref-item-separator ---- .. _class_DrawableTexture2D_method_blit_rect_multi: .. rst-class:: classref-method |void| **blit_rect_multi**\ (\ rect\: :ref:`Rect2i`, sources\: :ref:`Array`\[:ref:`Texture2D`\], extra_targets\: :ref:`Array`\[:ref:`DrawableTexture2D`\], modulate\: :ref:`Color` = Color(1, 1, 1, 1), mipmap\: :ref:`int` = 0, material\: :ref:`Material` = null\ ) :ref:`🔗` **Experimental:** This method may be changed or removed in future versions. Draws to the given ``rect`` on this texture, as well as on up to 3 DrawableTexture ``extra_targets``. All ``extra_targets`` must be the same size and DrawableFormat as the original target, otherwise the Shader may fail. Expects up to 4 Texture ``sources``, but will replace missing ``sources`` with default Black Textures. .. rst-class:: classref-item-separator ---- .. _class_DrawableTexture2D_method_generate_mipmaps: .. rst-class:: classref-method |void| **generate_mipmaps**\ (\ ) :ref:`🔗` Re-calculates the mipmaps for this texture on demand. .. rst-class:: classref-item-separator ---- .. _class_DrawableTexture2D_method_get_use_mipmaps: .. rst-class:: classref-method :ref:`bool` **get_use_mipmaps**\ (\ ) |const| :ref:`🔗` Returns ``true`` if mipmaps are set to be used on this DrawableTexture. .. rst-class:: classref-item-separator ---- .. _class_DrawableTexture2D_method_set_format: .. rst-class:: classref-method |void| **set_format**\ (\ format\: :ref:`DrawableFormat`\ ) :ref:`🔗` Sets the format of this DrawableTexture. .. rst-class:: classref-item-separator ---- .. _class_DrawableTexture2D_method_set_use_mipmaps: .. rst-class:: classref-method |void| **set_use_mipmaps**\ (\ mipmaps\: :ref:`bool`\ ) :ref:`🔗` Sets if mipmaps should be used on this DrawableTexture. .. rst-class:: classref-item-separator ---- .. _class_DrawableTexture2D_method_setup: .. rst-class:: classref-method |void| **setup**\ (\ width\: :ref:`int`, height\: :ref:`int`, format\: :ref:`DrawableFormat`, color\: :ref:`Color` = Color(1, 1, 1, 1), use_mipmaps\: :ref:`bool` = false\ ) :ref:`🔗` **Experimental:** This method may be changed or removed in future versions. Initializes the DrawableTexture to a White texture of the given ``width``, ``height``, and ``format``. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)` .. |required| replace:: :abbr:`required (This method is required to be overridden when extending its base class.)` .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)` .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)` .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)` .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)` .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)` .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)` .. |void| replace:: :abbr:`void (No return value.)`