virtualx-engine-docs/_sources/classes/class_spritebase3d.rst.txt

531 lines
21 KiB
Text
Raw Permalink Normal View History

2024-10-23 18:41:33 +02:00
:github_url: hide
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/3.6/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/3.6/doc/classes/SpriteBase3D.xml.
.. _class_SpriteBase3D:
SpriteBase3D
============
**Inherits:** :ref:`GeometryInstance<class_GeometryInstance>` **<** :ref:`VisualInstance<class_VisualInstance>` **<** :ref:`CullInstance<class_CullInstance>` **<** :ref:`Spatial<class_Spatial>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
**Inherited By:** :ref:`AnimatedSprite3D<class_AnimatedSprite3D>`, :ref:`Sprite3D<class_Sprite3D>`
2D sprite node in 3D environment.
.. rst-class:: classref-introduction-group
Description
-----------
A node that displays 2D texture information in a 3D environment.
.. rst-class:: classref-reftable-group
Properties
----------
.. table::
:widths: auto
+-----------------------------------------------------+---------------------------------------------------------------------+-------------------------+
| :ref:`AlphaCutMode<enum_SpriteBase3D_AlphaCutMode>` | :ref:`alpha_cut<class_SpriteBase3D_property_alpha_cut>` | ``0`` |
+-----------------------------------------------------+---------------------------------------------------------------------+-------------------------+
| Vector3.Axis | :ref:`axis<class_SpriteBase3D_property_axis>` | ``2`` |
+-----------------------------------------------------+---------------------------------------------------------------------+-------------------------+
| :ref:`BillboardMode<enum_Material3D_BillboardMode>` | :ref:`billboard<class_SpriteBase3D_property_billboard>` | ``0`` |
+-----------------------------------------------------+---------------------------------------------------------------------+-------------------------+
| :ref:`bool<class_bool>` | :ref:`centered<class_SpriteBase3D_property_centered>` | ``true`` |
+-----------------------------------------------------+---------------------------------------------------------------------+-------------------------+
| :ref:`bool<class_bool>` | :ref:`double_sided<class_SpriteBase3D_property_double_sided>` | ``true`` |
+-----------------------------------------------------+---------------------------------------------------------------------+-------------------------+
| :ref:`bool<class_bool>` | :ref:`fixed_size<class_SpriteBase3D_property_fixed_size>` | ``false`` |
+-----------------------------------------------------+---------------------------------------------------------------------+-------------------------+
| :ref:`bool<class_bool>` | :ref:`flip_h<class_SpriteBase3D_property_flip_h>` | ``false`` |
+-----------------------------------------------------+---------------------------------------------------------------------+-------------------------+
| :ref:`bool<class_bool>` | :ref:`flip_v<class_SpriteBase3D_property_flip_v>` | ``false`` |
+-----------------------------------------------------+---------------------------------------------------------------------+-------------------------+
| :ref:`Color<class_Color>` | :ref:`modulate<class_SpriteBase3D_property_modulate>` | ``Color( 1, 1, 1, 1 )`` |
+-----------------------------------------------------+---------------------------------------------------------------------+-------------------------+
| :ref:`bool<class_bool>` | :ref:`no_depth_test<class_SpriteBase3D_property_no_depth_test>` | ``false`` |
+-----------------------------------------------------+---------------------------------------------------------------------+-------------------------+
| :ref:`Vector2<class_Vector2>` | :ref:`offset<class_SpriteBase3D_property_offset>` | ``Vector2( 0, 0 )`` |
+-----------------------------------------------------+---------------------------------------------------------------------+-------------------------+
| :ref:`float<class_float>` | :ref:`opacity<class_SpriteBase3D_property_opacity>` | ``1.0`` |
+-----------------------------------------------------+---------------------------------------------------------------------+-------------------------+
| :ref:`float<class_float>` | :ref:`pixel_size<class_SpriteBase3D_property_pixel_size>` | ``0.01`` |
+-----------------------------------------------------+---------------------------------------------------------------------+-------------------------+
| :ref:`int<class_int>` | :ref:`render_priority<class_SpriteBase3D_property_render_priority>` | ``0`` |
+-----------------------------------------------------+---------------------------------------------------------------------+-------------------------+
| :ref:`bool<class_bool>` | :ref:`shaded<class_SpriteBase3D_property_shaded>` | ``false`` |
+-----------------------------------------------------+---------------------------------------------------------------------+-------------------------+
| :ref:`bool<class_bool>` | :ref:`transparent<class_SpriteBase3D_property_transparent>` | ``true`` |
+-----------------------------------------------------+---------------------------------------------------------------------+-------------------------+
.. rst-class:: classref-reftable-group
Methods
-------
.. table::
:widths: auto
+-----------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`TriangleMesh<class_TriangleMesh>` | :ref:`generate_triangle_mesh<class_SpriteBase3D_method_generate_triangle_mesh>` **(** **)** |const| |
+-----------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`get_draw_flag<class_SpriteBase3D_method_get_draw_flag>` **(** :ref:`DrawFlags<enum_SpriteBase3D_DrawFlags>` flag **)** |const| |
+-----------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Rect2<class_Rect2>` | :ref:`get_item_rect<class_SpriteBase3D_method_get_item_rect>` **(** **)** |const| |
+-----------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`set_draw_flag<class_SpriteBase3D_method_set_draw_flag>` **(** :ref:`DrawFlags<enum_SpriteBase3D_DrawFlags>` flag, :ref:`bool<class_bool>` enabled **)** |
+-----------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
Enumerations
------------
.. _enum_SpriteBase3D_DrawFlags:
.. rst-class:: classref-enumeration
enum **DrawFlags**:
.. _class_SpriteBase3D_constant_FLAG_TRANSPARENT:
.. rst-class:: classref-enumeration-constant
:ref:`DrawFlags<enum_SpriteBase3D_DrawFlags>` **FLAG_TRANSPARENT** = ``0``
If set, the texture's transparency and the opacity are used to make those parts of the sprite invisible.
.. _class_SpriteBase3D_constant_FLAG_SHADED:
.. rst-class:: classref-enumeration-constant
:ref:`DrawFlags<enum_SpriteBase3D_DrawFlags>` **FLAG_SHADED** = ``1``
If set, lights in the environment affect the sprite.
.. _class_SpriteBase3D_constant_FLAG_DOUBLE_SIDED:
.. rst-class:: classref-enumeration-constant
:ref:`DrawFlags<enum_SpriteBase3D_DrawFlags>` **FLAG_DOUBLE_SIDED** = ``2``
If set, texture can be seen from the back as well, if not, it is invisible when looking at it from behind.
.. _class_SpriteBase3D_constant_FLAG_DISABLE_DEPTH_TEST:
.. rst-class:: classref-enumeration-constant
:ref:`DrawFlags<enum_SpriteBase3D_DrawFlags>` **FLAG_DISABLE_DEPTH_TEST** = ``3``
Disables the depth test, so this object is drawn on top of all others. However, objects drawn after it in the draw order may cover it.
.. _class_SpriteBase3D_constant_FLAG_FIXED_SIZE:
.. rst-class:: classref-enumeration-constant
:ref:`DrawFlags<enum_SpriteBase3D_DrawFlags>` **FLAG_FIXED_SIZE** = ``4``
Sprite is scaled by depth so that it always appears the same size on screen.
.. _class_SpriteBase3D_constant_FLAG_MAX:
.. rst-class:: classref-enumeration-constant
:ref:`DrawFlags<enum_SpriteBase3D_DrawFlags>` **FLAG_MAX** = ``5``
Represents the size of the :ref:`DrawFlags<enum_SpriteBase3D_DrawFlags>` enum.
.. rst-class:: classref-item-separator
----
.. _enum_SpriteBase3D_AlphaCutMode:
.. rst-class:: classref-enumeration
enum **AlphaCutMode**:
.. _class_SpriteBase3D_constant_ALPHA_CUT_DISABLED:
.. rst-class:: classref-enumeration-constant
:ref:`AlphaCutMode<enum_SpriteBase3D_AlphaCutMode>` **ALPHA_CUT_DISABLED** = ``0``
.. _class_SpriteBase3D_constant_ALPHA_CUT_DISCARD:
.. rst-class:: classref-enumeration-constant
:ref:`AlphaCutMode<enum_SpriteBase3D_AlphaCutMode>` **ALPHA_CUT_DISCARD** = ``1``
.. _class_SpriteBase3D_constant_ALPHA_CUT_OPAQUE_PREPASS:
.. rst-class:: classref-enumeration-constant
:ref:`AlphaCutMode<enum_SpriteBase3D_AlphaCutMode>` **ALPHA_CUT_OPAQUE_PREPASS** = ``2``
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
Property Descriptions
---------------------
.. _class_SpriteBase3D_property_alpha_cut:
.. rst-class:: classref-property
:ref:`AlphaCutMode<enum_SpriteBase3D_AlphaCutMode>` **alpha_cut** = ``0``
.. rst-class:: classref-property-setget
- void **set_alpha_cut_mode** **(** :ref:`AlphaCutMode<enum_SpriteBase3D_AlphaCutMode>` value **)**
- :ref:`AlphaCutMode<enum_SpriteBase3D_AlphaCutMode>` **get_alpha_cut_mode** **(** **)**
.. container:: contribute
There is currently no description for this property. Please help us by :ref:`contributing one <doc_updating_the_class_reference>`!
.. rst-class:: classref-item-separator
----
.. _class_SpriteBase3D_property_axis:
.. rst-class:: classref-property
Vector3.Axis **axis** = ``2``
.. rst-class:: classref-property-setget
- void **set_axis** **(** Vector3.Axis value **)**
- Vector3.Axis **get_axis** **(** **)**
The direction in which the front of the texture faces.
.. rst-class:: classref-item-separator
----
.. _class_SpriteBase3D_property_billboard:
.. rst-class:: classref-property
:ref:`BillboardMode<enum_Material3D_BillboardMode>` **billboard** = ``0``
.. rst-class:: classref-property-setget
- void **set_billboard_mode** **(** :ref:`BillboardMode<enum_Material3D_BillboardMode>` value **)**
- :ref:`BillboardMode<enum_Material3D_BillboardMode>` **get_billboard_mode** **(** **)**
.. container:: contribute
There is currently no description for this property. Please help us by :ref:`contributing one <doc_updating_the_class_reference>`!
.. rst-class:: classref-item-separator
----
.. _class_SpriteBase3D_property_centered:
.. rst-class:: classref-property
:ref:`bool<class_bool>` **centered** = ``true``
.. rst-class:: classref-property-setget
- void **set_centered** **(** :ref:`bool<class_bool>` value **)**
- :ref:`bool<class_bool>` **is_centered** **(** **)**
If ``true``, texture will be centered.
.. rst-class:: classref-item-separator
----
.. _class_SpriteBase3D_property_double_sided:
.. rst-class:: classref-property
:ref:`bool<class_bool>` **double_sided** = ``true``
.. rst-class:: classref-property-setget
- void **set_draw_flag** **(** :ref:`DrawFlags<enum_SpriteBase3D_DrawFlags>` flag, :ref:`bool<class_bool>` enabled **)**
- :ref:`bool<class_bool>` **get_draw_flag** **(** :ref:`DrawFlags<enum_SpriteBase3D_DrawFlags>` flag **)** |const|
If ``true``, texture can be seen from the back as well, if ``false``, it is invisible when looking at it from behind.
.. rst-class:: classref-item-separator
----
.. _class_SpriteBase3D_property_fixed_size:
.. rst-class:: classref-property
:ref:`bool<class_bool>` **fixed_size** = ``false``
.. rst-class:: classref-property-setget
- void **set_draw_flag** **(** :ref:`DrawFlags<enum_SpriteBase3D_DrawFlags>` flag, :ref:`bool<class_bool>` enabled **)**
- :ref:`bool<class_bool>` **get_draw_flag** **(** :ref:`DrawFlags<enum_SpriteBase3D_DrawFlags>` flag **)** |const|
If ``true``, the label is rendered at the same size regardless of distance.
.. rst-class:: classref-item-separator
----
.. _class_SpriteBase3D_property_flip_h:
.. rst-class:: classref-property
:ref:`bool<class_bool>` **flip_h** = ``false``
.. rst-class:: classref-property-setget
- void **set_flip_h** **(** :ref:`bool<class_bool>` value **)**
- :ref:`bool<class_bool>` **is_flipped_h** **(** **)**
If ``true``, texture is flipped horizontally.
.. rst-class:: classref-item-separator
----
.. _class_SpriteBase3D_property_flip_v:
.. rst-class:: classref-property
:ref:`bool<class_bool>` **flip_v** = ``false``
.. rst-class:: classref-property-setget
- void **set_flip_v** **(** :ref:`bool<class_bool>` value **)**
- :ref:`bool<class_bool>` **is_flipped_v** **(** **)**
If ``true``, texture is flipped vertically.
.. rst-class:: classref-item-separator
----
.. _class_SpriteBase3D_property_modulate:
.. rst-class:: classref-property
:ref:`Color<class_Color>` **modulate** = ``Color( 1, 1, 1, 1 )``
.. rst-class:: classref-property-setget
- void **set_modulate** **(** :ref:`Color<class_Color>` value **)**
- :ref:`Color<class_Color>` **get_modulate** **(** **)**
A color value used to *multiply* the texture's colors. Can be used for mood-coloring or to simulate the color of light.
\ **Note:** If a :ref:`GeometryInstance.material_override<class_GeometryInstance_property_material_override>` is defined on the **SpriteBase3D**, the material override must be configured to take vertex colors into account for albedo. Otherwise, the color defined in :ref:`modulate<class_SpriteBase3D_property_modulate>` will be ignored. For a :ref:`SpatialMaterial<class_SpatialMaterial>`, :ref:`Material3D.vertex_color_use_as_albedo<class_Material3D_property_vertex_color_use_as_albedo>` must be ``true``. For a :ref:`ShaderMaterial<class_ShaderMaterial>`, ``ALBEDO *= COLOR.rgb;`` must be inserted in the shader's ``fragment()`` function.
.. rst-class:: classref-item-separator
----
.. _class_SpriteBase3D_property_no_depth_test:
.. rst-class:: classref-property
:ref:`bool<class_bool>` **no_depth_test** = ``false``
.. rst-class:: classref-property-setget
- void **set_draw_flag** **(** :ref:`DrawFlags<enum_SpriteBase3D_DrawFlags>` flag, :ref:`bool<class_bool>` enabled **)**
- :ref:`bool<class_bool>` **get_draw_flag** **(** :ref:`DrawFlags<enum_SpriteBase3D_DrawFlags>` flag **)** |const|
If ``true``, depth testing is disabled and the object will be drawn in render order.
.. rst-class:: classref-item-separator
----
.. _class_SpriteBase3D_property_offset:
.. rst-class:: classref-property
:ref:`Vector2<class_Vector2>` **offset** = ``Vector2( 0, 0 )``
.. rst-class:: classref-property-setget
- void **set_offset** **(** :ref:`Vector2<class_Vector2>` value **)**
- :ref:`Vector2<class_Vector2>` **get_offset** **(** **)**
The texture's drawing offset.
.. rst-class:: classref-item-separator
----
.. _class_SpriteBase3D_property_opacity:
.. rst-class:: classref-property
:ref:`float<class_float>` **opacity** = ``1.0``
.. rst-class:: classref-property-setget
- void **set_opacity** **(** :ref:`float<class_float>` value **)**
- :ref:`float<class_float>` **get_opacity** **(** **)**
The texture's visibility on a scale from ``0`` (fully invisible) to ``1`` (fully visible). :ref:`opacity<class_SpriteBase3D_property_opacity>` is a multiplier for the :ref:`modulate<class_SpriteBase3D_property_modulate>` color's alpha channel.
\ **Note:** If a :ref:`GeometryInstance.material_override<class_GeometryInstance_property_material_override>` is defined on the **SpriteBase3D**, the material override must be configured to take vertex colors into account for albedo. Otherwise, the opacity defined in :ref:`opacity<class_SpriteBase3D_property_opacity>` will be ignored. For a :ref:`SpatialMaterial<class_SpatialMaterial>`, :ref:`Material3D.vertex_color_use_as_albedo<class_Material3D_property_vertex_color_use_as_albedo>` must be ``true``. For a :ref:`ShaderMaterial<class_ShaderMaterial>`, ``ALPHA *= COLOR.a;`` must be inserted in the shader's ``fragment()`` function.
.. rst-class:: classref-item-separator
----
.. _class_SpriteBase3D_property_pixel_size:
.. rst-class:: classref-property
:ref:`float<class_float>` **pixel_size** = ``0.01``
.. rst-class:: classref-property-setget
- void **set_pixel_size** **(** :ref:`float<class_float>` value **)**
- :ref:`float<class_float>` **get_pixel_size** **(** **)**
The size of one pixel's width on the sprite to scale it in 3D.
.. rst-class:: classref-item-separator
----
.. _class_SpriteBase3D_property_render_priority:
.. rst-class:: classref-property
:ref:`int<class_int>` **render_priority** = ``0``
.. rst-class:: classref-property-setget
- void **set_render_priority** **(** :ref:`int<class_int>` value **)**
- :ref:`int<class_int>` **get_render_priority** **(** **)**
Sets the render priority for the sprite. Higher priority objects will be sorted in front of lower priority objects.
\ **Note:** This only applies if :ref:`alpha_cut<class_SpriteBase3D_property_alpha_cut>` is set to :ref:`ALPHA_CUT_DISABLED<class_SpriteBase3D_constant_ALPHA_CUT_DISABLED>` (default value).
\ **Note:** This only applies to sorting of transparent objects. This will not impact how transparent objects are sorted relative to opaque objects. This is because opaque objects are not sorted, while transparent objects are sorted from back to front (subject to priority).
.. rst-class:: classref-item-separator
----
.. _class_SpriteBase3D_property_shaded:
.. rst-class:: classref-property
:ref:`bool<class_bool>` **shaded** = ``false``
.. rst-class:: classref-property-setget
- void **set_draw_flag** **(** :ref:`DrawFlags<enum_SpriteBase3D_DrawFlags>` flag, :ref:`bool<class_bool>` enabled **)**
- :ref:`bool<class_bool>` **get_draw_flag** **(** :ref:`DrawFlags<enum_SpriteBase3D_DrawFlags>` flag **)** |const|
If ``true``, the :ref:`Light<class_Light>` in the :ref:`Environment<class_Environment>` has effects on the sprite.
.. rst-class:: classref-item-separator
----
.. _class_SpriteBase3D_property_transparent:
.. rst-class:: classref-property
:ref:`bool<class_bool>` **transparent** = ``true``
.. rst-class:: classref-property-setget
- void **set_draw_flag** **(** :ref:`DrawFlags<enum_SpriteBase3D_DrawFlags>` flag, :ref:`bool<class_bool>` enabled **)**
- :ref:`bool<class_bool>` **get_draw_flag** **(** :ref:`DrawFlags<enum_SpriteBase3D_DrawFlags>` flag **)** |const|
If ``true``, the texture's transparency and the opacity are used to make those parts of the sprite invisible.
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
Method Descriptions
-------------------
.. _class_SpriteBase3D_method_generate_triangle_mesh:
.. rst-class:: classref-method
:ref:`TriangleMesh<class_TriangleMesh>` **generate_triangle_mesh** **(** **)** |const|
.. container:: contribute
There is currently no description for this method. Please help us by :ref:`contributing one <doc_updating_the_class_reference>`!
.. rst-class:: classref-item-separator
----
.. _class_SpriteBase3D_method_get_draw_flag:
.. rst-class:: classref-method
:ref:`bool<class_bool>` **get_draw_flag** **(** :ref:`DrawFlags<enum_SpriteBase3D_DrawFlags>` flag **)** |const|
Returns the value of the specified flag.
.. rst-class:: classref-item-separator
----
.. _class_SpriteBase3D_method_get_item_rect:
.. rst-class:: classref-method
:ref:`Rect2<class_Rect2>` **get_item_rect** **(** **)** |const|
Returns the rectangle representing this sprite.
.. rst-class:: classref-item-separator
----
.. _class_SpriteBase3D_method_set_draw_flag:
.. rst-class:: classref-method
void **set_draw_flag** **(** :ref:`DrawFlags<enum_SpriteBase3D_DrawFlags>` flag, :ref:`bool<class_bool>` enabled **)**
If ``true``, the specified flag will be enabled.
.. |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.)`
.. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`