mirror of
https://github.com/godotengine/godot-docs.git
synced 2025-12-31 17:49:03 +03:00
184 lines
10 KiB
ReStructuredText
184 lines
10 KiB
ReStructuredText
:github_url: hide
|
|
|
|
.. DO NOT EDIT THIS FILE!!!
|
|
.. Generated automatically from Godot engine sources.
|
|
.. Generator: https://github.com/godotengine/godot/tree/4.0/doc/tools/make_rst.py.
|
|
.. XML source: https://github.com/godotengine/godot/tree/4.0/doc/classes/CanvasTexture.xml.
|
|
|
|
.. _class_CanvasTexture:
|
|
|
|
CanvasTexture
|
|
=============
|
|
|
|
**Inherits:** :ref:`Texture2D<class_Texture2D>` **<** :ref:`Texture<class_Texture>` **<** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
|
|
|
|
Texture with optional normal and specular maps for use in 2D rendering.
|
|
|
|
.. rst-class:: classref-introduction-group
|
|
|
|
Description
|
|
-----------
|
|
|
|
**CanvasTexture** is an alternative to :ref:`ImageTexture<class_ImageTexture>` for 2D rendering. It allows using normal maps and specular maps in any node that inherits from :ref:`CanvasItem<class_CanvasItem>`. **CanvasTexture** also allows overriding the texture's filter and repeat mode independently of the node's properties (or the project settings).
|
|
|
|
\ **Note:** **CanvasTexture** cannot be used in 3D rendering. For physically-based materials in 3D, use :ref:`BaseMaterial3D<class_BaseMaterial3D>` instead.
|
|
|
|
.. rst-class:: classref-reftable-group
|
|
|
|
Properties
|
|
----------
|
|
|
|
.. table::
|
|
:widths: auto
|
|
|
|
+-----------------------------------------------------+----------------------------------------------------------------------------+----------------------------------------------------------------------------------------+
|
|
| :ref:`Texture2D<class_Texture2D>` | :ref:`diffuse_texture<class_CanvasTexture_property_diffuse_texture>` | |
|
|
+-----------------------------------------------------+----------------------------------------------------------------------------+----------------------------------------------------------------------------------------+
|
|
| :ref:`Texture2D<class_Texture2D>` | :ref:`normal_texture<class_CanvasTexture_property_normal_texture>` | |
|
|
+-----------------------------------------------------+----------------------------------------------------------------------------+----------------------------------------------------------------------------------------+
|
|
| :ref:`bool<class_bool>` | resource_local_to_scene | ``false`` (overrides :ref:`Resource<class_Resource_property_resource_local_to_scene>`) |
|
|
+-----------------------------------------------------+----------------------------------------------------------------------------+----------------------------------------------------------------------------------------+
|
|
| :ref:`Color<class_Color>` | :ref:`specular_color<class_CanvasTexture_property_specular_color>` | ``Color(1, 1, 1, 1)`` |
|
|
+-----------------------------------------------------+----------------------------------------------------------------------------+----------------------------------------------------------------------------------------+
|
|
| :ref:`float<class_float>` | :ref:`specular_shininess<class_CanvasTexture_property_specular_shininess>` | ``1.0`` |
|
|
+-----------------------------------------------------+----------------------------------------------------------------------------+----------------------------------------------------------------------------------------+
|
|
| :ref:`Texture2D<class_Texture2D>` | :ref:`specular_texture<class_CanvasTexture_property_specular_texture>` | |
|
|
+-----------------------------------------------------+----------------------------------------------------------------------------+----------------------------------------------------------------------------------------+
|
|
| :ref:`TextureFilter<enum_CanvasItem_TextureFilter>` | :ref:`texture_filter<class_CanvasTexture_property_texture_filter>` | ``0`` |
|
|
+-----------------------------------------------------+----------------------------------------------------------------------------+----------------------------------------------------------------------------------------+
|
|
| :ref:`TextureRepeat<enum_CanvasItem_TextureRepeat>` | :ref:`texture_repeat<class_CanvasTexture_property_texture_repeat>` | ``0`` |
|
|
+-----------------------------------------------------+----------------------------------------------------------------------------+----------------------------------------------------------------------------------------+
|
|
|
|
.. rst-class:: classref-section-separator
|
|
|
|
----
|
|
|
|
.. rst-class:: classref-descriptions-group
|
|
|
|
Property Descriptions
|
|
---------------------
|
|
|
|
.. _class_CanvasTexture_property_diffuse_texture:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`Texture2D<class_Texture2D>` **diffuse_texture**
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- void **set_diffuse_texture** **(** :ref:`Texture2D<class_Texture2D>` value **)**
|
|
- :ref:`Texture2D<class_Texture2D>` **get_diffuse_texture** **(** **)**
|
|
|
|
The diffuse (color) texture to use. This is the main texture you want to set in most cases.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_CanvasTexture_property_normal_texture:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`Texture2D<class_Texture2D>` **normal_texture**
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- void **set_normal_texture** **(** :ref:`Texture2D<class_Texture2D>` value **)**
|
|
- :ref:`Texture2D<class_Texture2D>` **get_normal_texture** **(** **)**
|
|
|
|
The normal map texture to use. Only has a visible effect if :ref:`Light2D<class_Light2D>`\ s are affecting this **CanvasTexture**.
|
|
|
|
\ **Note:** Godot expects the normal map to use X+, Y+, and Z+ coordinates. See `this page <http://wiki.polycount.com/wiki/Normal_Map_Technical_Details#Common_Swizzle_Coordinates>`__ for a comparison of normal map coordinates expected by popular engines.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_CanvasTexture_property_specular_color:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`Color<class_Color>` **specular_color** = ``Color(1, 1, 1, 1)``
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- void **set_specular_color** **(** :ref:`Color<class_Color>` value **)**
|
|
- :ref:`Color<class_Color>` **get_specular_color** **(** **)**
|
|
|
|
The multiplier for specular reflection colors. The :ref:`Light2D<class_Light2D>`'s color is also taken into account when determining the reflection color. Only has a visible effect if :ref:`Light2D<class_Light2D>`\ s are affecting this **CanvasTexture**.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_CanvasTexture_property_specular_shininess:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`float<class_float>` **specular_shininess** = ``1.0``
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- void **set_specular_shininess** **(** :ref:`float<class_float>` value **)**
|
|
- :ref:`float<class_float>` **get_specular_shininess** **(** **)**
|
|
|
|
The specular exponent for :ref:`Light2D<class_Light2D>` specular reflections. Higher values result in a more glossy/"wet" look, with reflections becoming more localized and less visible overall. The default value of ``1.0`` disables specular reflections entirely. Only has a visible effect if :ref:`Light2D<class_Light2D>`\ s are affecting this **CanvasTexture**.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_CanvasTexture_property_specular_texture:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`Texture2D<class_Texture2D>` **specular_texture**
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- void **set_specular_texture** **(** :ref:`Texture2D<class_Texture2D>` value **)**
|
|
- :ref:`Texture2D<class_Texture2D>` **get_specular_texture** **(** **)**
|
|
|
|
The specular map to use for :ref:`Light2D<class_Light2D>` specular reflections. This should be a grayscale or colored texture, with brighter areas resulting in a higher :ref:`specular_shininess<class_CanvasTexture_property_specular_shininess>` value. Using a colored :ref:`specular_texture<class_CanvasTexture_property_specular_texture>` allows controlling specular shininess on a per-channel basis. Only has a visible effect if :ref:`Light2D<class_Light2D>`\ s are affecting this **CanvasTexture**.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_CanvasTexture_property_texture_filter:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`TextureFilter<enum_CanvasItem_TextureFilter>` **texture_filter** = ``0``
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- void **set_texture_filter** **(** :ref:`TextureFilter<enum_CanvasItem_TextureFilter>` value **)**
|
|
- :ref:`TextureFilter<enum_CanvasItem_TextureFilter>` **get_texture_filter** **(** **)**
|
|
|
|
The texture filtering mode to use when drawing this **CanvasTexture**.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_CanvasTexture_property_texture_repeat:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`TextureRepeat<enum_CanvasItem_TextureRepeat>` **texture_repeat** = ``0``
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- void **set_texture_repeat** **(** :ref:`TextureRepeat<enum_CanvasItem_TextureRepeat>` value **)**
|
|
- :ref:`TextureRepeat<enum_CanvasItem_TextureRepeat>` **get_texture_repeat** **(** **)**
|
|
|
|
The texture repeat mode to use when drawing this **CanvasTexture**.
|
|
|
|
.. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
|
|
.. |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.)`
|