123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- :github_url: hide
- .. DO NOT EDIT THIS FILE!!!
- .. Generated automatically from Godot engine sources.
- .. Generator: https://github.com/godotengine/godot/tree/4.2/doc/tools/make_rst.py.
- .. XML source: https://github.com/godotengine/godot/tree/4.2/doc/classes/DirectionalLight2D.xml.
- .. _class_DirectionalLight2D:
- DirectionalLight2D
- ==================
- **Inherits:** :ref:`Light2D<class_Light2D>` **<** :ref:`Node2D<class_Node2D>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
- Directional 2D light from a distance.
- .. rst-class:: classref-introduction-group
- Description
- -----------
- A directional light is a type of :ref:`Light2D<class_Light2D>` node that models an infinite number of parallel rays covering the entire scene. It is used for lights with strong intensity that are located far away from the scene (for example: to model sunlight or moonlight).
- \ **Note:** **DirectionalLight2D** does not support light cull masks (but it supports shadow cull masks). It will always light up 2D nodes, regardless of the 2D node's :ref:`CanvasItem.light_mask<class_CanvasItem_property_light_mask>`.
- .. rst-class:: classref-introduction-group
- Tutorials
- ---------
- - :doc:`2D lights and shadows <../tutorials/2d/2d_lights_and_shadows>`
- .. rst-class:: classref-reftable-group
- Properties
- ----------
- .. table::
- :widths: auto
- +---------------------------+---------------------------------------------------------------------+-------------+
- | :ref:`float<class_float>` | :ref:`height<class_DirectionalLight2D_property_height>` | ``0.0`` |
- +---------------------------+---------------------------------------------------------------------+-------------+
- | :ref:`float<class_float>` | :ref:`max_distance<class_DirectionalLight2D_property_max_distance>` | ``10000.0`` |
- +---------------------------+---------------------------------------------------------------------+-------------+
- .. rst-class:: classref-section-separator
- ----
- .. rst-class:: classref-descriptions-group
- Property Descriptions
- ---------------------
- .. _class_DirectionalLight2D_property_height:
- .. rst-class:: classref-property
- :ref:`float<class_float>` **height** = ``0.0``
- .. rst-class:: classref-property-setget
- - void **set_height** **(** :ref:`float<class_float>` value **)**
- - :ref:`float<class_float>` **get_height** **(** **)**
- The height of the light. Used with 2D normal mapping. Ranges from 0 (parallel to the plane) to 1 (perpendicular to the plane).
- .. rst-class:: classref-item-separator
- ----
- .. _class_DirectionalLight2D_property_max_distance:
- .. rst-class:: classref-property
- :ref:`float<class_float>` **max_distance** = ``10000.0``
- .. rst-class:: classref-property-setget
- - void **set_max_distance** **(** :ref:`float<class_float>` value **)**
- - :ref:`float<class_float>` **get_max_distance** **(** **)**
- The maximum distance from the camera center objects can be before their shadows are culled (in pixels). Decreasing this value can prevent objects located outside the camera from casting shadows (while also improving performance). :ref:`Camera2D.zoom<class_Camera2D_property_zoom>` is not taken into account by :ref:`max_distance<class_DirectionalLight2D_property_max_distance>`, which means that at higher zoom values, shadows will appear to fade out sooner when zooming onto a given point.
- .. |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.)`
- .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
|