2020-02-12 09:59:06 +01:00
|
|
|
<?xml version="1.0" encoding="UTF-8" ?>
|
2020-02-16 18:17:22 +01:00
|
|
|
<class name="Texture2D" inherits="Texture" version="4.0">
|
2020-02-12 09:59:06 +01:00
|
|
|
<brief_description>
|
|
|
|
Texture for 2D and 3D.
|
|
|
|
</brief_description>
|
|
|
|
<description>
|
2020-03-30 18:22:57 +02:00
|
|
|
A texture works by registering an image in the video hardware, which then can be used in 3D models or 2D [Sprite2D] or GUI [Control].
|
2020-02-12 09:59:06 +01:00
|
|
|
Textures are often created by loading them from a file. See [method @GDScript.load].
|
|
|
|
[Texture2D] is a base for other resources. It cannot be used directly.
|
|
|
|
</description>
|
|
|
|
<tutorials>
|
|
|
|
</tutorials>
|
|
|
|
<methods>
|
|
|
|
<method name="draw" qualifiers="const">
|
|
|
|
<return type="void">
|
|
|
|
</return>
|
|
|
|
<argument index="0" name="canvas_item" type="RID">
|
|
|
|
</argument>
|
|
|
|
<argument index="1" name="position" type="Vector2">
|
|
|
|
</argument>
|
|
|
|
<argument index="2" name="modulate" type="Color" default="Color( 1, 1, 1, 1 )">
|
|
|
|
</argument>
|
|
|
|
<argument index="3" name="transpose" type="bool" default="false">
|
|
|
|
</argument>
|
|
|
|
<argument index="4" name="normal_map" type="Texture2D" default="null">
|
|
|
|
</argument>
|
|
|
|
<argument index="5" name="specular_map" type="Texture2D" default="null">
|
|
|
|
</argument>
|
|
|
|
<argument index="6" name="specular_color_shininess" type="Color" default="Color( 1, 1, 1, 1 )">
|
|
|
|
</argument>
|
2020-03-30 18:22:57 +02:00
|
|
|
<argument index="7" name="texture_filter" type="int" enum="RenderingServer.CanvasItemTextureFilter" default="0">
|
2020-02-12 09:59:06 +01:00
|
|
|
</argument>
|
2020-03-30 18:22:57 +02:00
|
|
|
<argument index="8" name="texture_repeat" type="int" enum="RenderingServer.CanvasItemTextureRepeat" default="0">
|
2020-02-12 09:59:06 +01:00
|
|
|
</argument>
|
|
|
|
<description>
|
2020-03-30 18:22:57 +02:00
|
|
|
Draws the texture using a [CanvasItem] with the [RenderingServer] API at the specified [code]position[/code].
|
2020-02-12 09:59:06 +01:00
|
|
|
</description>
|
|
|
|
</method>
|
|
|
|
<method name="draw_rect" qualifiers="const">
|
|
|
|
<return type="void">
|
|
|
|
</return>
|
|
|
|
<argument index="0" name="canvas_item" type="RID">
|
|
|
|
</argument>
|
|
|
|
<argument index="1" name="rect" type="Rect2">
|
|
|
|
</argument>
|
|
|
|
<argument index="2" name="tile" type="bool">
|
|
|
|
</argument>
|
|
|
|
<argument index="3" name="modulate" type="Color" default="Color( 1, 1, 1, 1 )">
|
|
|
|
</argument>
|
|
|
|
<argument index="4" name="transpose" type="bool" default="false">
|
|
|
|
</argument>
|
|
|
|
<argument index="5" name="normal_map" type="Texture2D" default="null">
|
|
|
|
</argument>
|
|
|
|
<argument index="6" name="specular_map" type="Texture2D" default="null">
|
|
|
|
</argument>
|
|
|
|
<argument index="7" name="specular_color_shininess" type="Color" default="Color( 1, 1, 1, 1 )">
|
|
|
|
</argument>
|
2020-03-30 18:22:57 +02:00
|
|
|
<argument index="8" name="texture_filter" type="int" enum="RenderingServer.CanvasItemTextureFilter" default="0">
|
2020-02-12 09:59:06 +01:00
|
|
|
</argument>
|
2020-03-30 18:22:57 +02:00
|
|
|
<argument index="9" name="texture_repeat" type="int" enum="RenderingServer.CanvasItemTextureRepeat" default="0">
|
2020-02-12 09:59:06 +01:00
|
|
|
</argument>
|
|
|
|
<description>
|
2020-03-30 18:22:57 +02:00
|
|
|
Draws the texture using a [CanvasItem] with the [RenderingServer] API.
|
2020-02-12 09:59:06 +01:00
|
|
|
</description>
|
|
|
|
</method>
|
|
|
|
<method name="draw_rect_region" qualifiers="const">
|
|
|
|
<return type="void">
|
|
|
|
</return>
|
|
|
|
<argument index="0" name="canvas_item" type="RID">
|
|
|
|
</argument>
|
|
|
|
<argument index="1" name="rect" type="Rect2">
|
|
|
|
</argument>
|
|
|
|
<argument index="2" name="src_rect" type="Rect2">
|
|
|
|
</argument>
|
|
|
|
<argument index="3" name="modulate" type="Color" default="Color( 1, 1, 1, 1 )">
|
|
|
|
</argument>
|
|
|
|
<argument index="4" name="transpose" type="bool" default="false">
|
|
|
|
</argument>
|
|
|
|
<argument index="5" name="normal_map" type="Texture2D" default="null">
|
|
|
|
</argument>
|
|
|
|
<argument index="6" name="specular_map" type="Texture2D" default="null">
|
|
|
|
</argument>
|
|
|
|
<argument index="7" name="specular_color_shininess" type="Color" default="Color( 1, 1, 1, 1 )">
|
|
|
|
</argument>
|
2020-03-30 18:22:57 +02:00
|
|
|
<argument index="8" name="texture_filter" type="int" enum="RenderingServer.CanvasItemTextureFilter" default="0">
|
2020-02-12 09:59:06 +01:00
|
|
|
</argument>
|
2020-03-30 18:22:57 +02:00
|
|
|
<argument index="9" name="texture_repeat" type="int" enum="RenderingServer.CanvasItemTextureRepeat" default="0">
|
2020-02-12 09:59:06 +01:00
|
|
|
</argument>
|
|
|
|
<argument index="10" name="clip_uv" type="bool" default="true">
|
|
|
|
</argument>
|
|
|
|
<description>
|
2020-03-30 18:22:57 +02:00
|
|
|
Draws a part of the texture using a [CanvasItem] with the [RenderingServer] API.
|
2020-02-12 09:59:06 +01:00
|
|
|
</description>
|
|
|
|
</method>
|
|
|
|
<method name="get_data" qualifiers="const">
|
|
|
|
<return type="Image">
|
|
|
|
</return>
|
|
|
|
<description>
|
|
|
|
Returns an [Image] with the data from this [Texture2D]. [Image]s can be accessed and manipulated directly.
|
|
|
|
</description>
|
|
|
|
</method>
|
|
|
|
<method name="get_height" qualifiers="const">
|
|
|
|
<return type="int">
|
|
|
|
</return>
|
|
|
|
<description>
|
|
|
|
Returns the texture height.
|
|
|
|
</description>
|
|
|
|
</method>
|
|
|
|
<method name="get_size" qualifiers="const">
|
|
|
|
<return type="Vector2">
|
|
|
|
</return>
|
|
|
|
<description>
|
|
|
|
Returns the texture size.
|
|
|
|
</description>
|
|
|
|
</method>
|
|
|
|
<method name="get_width" qualifiers="const">
|
|
|
|
<return type="int">
|
|
|
|
</return>
|
|
|
|
<description>
|
|
|
|
Returns the texture width.
|
|
|
|
</description>
|
|
|
|
</method>
|
|
|
|
<method name="has_alpha" qualifiers="const">
|
|
|
|
<return type="bool">
|
|
|
|
</return>
|
|
|
|
<description>
|
|
|
|
Returns [code]true[/code] if this [Texture2D] has an alpha channel.
|
|
|
|
</description>
|
|
|
|
</method>
|
|
|
|
</methods>
|
|
|
|
<constants>
|
|
|
|
</constants>
|
|
|
|
</class>
|