Files
godot-docs/classes/class_gltflight.rst
2024-10-04 02:15:35 +00:00

277 lines
13 KiB
ReStructuredText

:github_url: hide
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/modules/gltf/doc_classes/GLTFLight.xml.
.. _class_GLTFLight:
GLTFLight
=========
**Inherits:** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
Represents a GLTF light.
.. rst-class:: classref-introduction-group
Description
-----------
Represents a light as defined by the ``KHR_lights_punctual`` GLTF extension.
.. rst-class:: classref-introduction-group
Tutorials
---------
- :doc:`Runtime file loading and saving <../tutorials/io/runtime_file_loading_and_saving>`
- `KHR_lights_punctual GLTF extension spec <https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Khronos/KHR_lights_punctual>`__
.. rst-class:: classref-reftable-group
Properties
----------
.. table::
:widths: auto
+-----------------------------+--------------------------------------------------------------------+-----------------------+
| :ref:`Color<class_Color>` | :ref:`color<class_GLTFLight_property_color>` | ``Color(1, 1, 1, 1)`` |
+-----------------------------+--------------------------------------------------------------------+-----------------------+
| :ref:`float<class_float>` | :ref:`inner_cone_angle<class_GLTFLight_property_inner_cone_angle>` | ``0.0`` |
+-----------------------------+--------------------------------------------------------------------+-----------------------+
| :ref:`float<class_float>` | :ref:`intensity<class_GLTFLight_property_intensity>` | ``1.0`` |
+-----------------------------+--------------------------------------------------------------------+-----------------------+
| :ref:`String<class_String>` | :ref:`light_type<class_GLTFLight_property_light_type>` | ``""`` |
+-----------------------------+--------------------------------------------------------------------+-----------------------+
| :ref:`float<class_float>` | :ref:`outer_cone_angle<class_GLTFLight_property_outer_cone_angle>` | ``0.785398`` |
+-----------------------------+--------------------------------------------------------------------+-----------------------+
| :ref:`float<class_float>` | :ref:`range<class_GLTFLight_property_range>` | ``inf`` |
+-----------------------------+--------------------------------------------------------------------+-----------------------+
.. rst-class:: classref-reftable-group
Methods
-------
.. table::
:widths: auto
+-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`GLTFLight<class_GLTFLight>` | :ref:`from_dictionary<class_GLTFLight_method_from_dictionary>`\ (\ dictionary\: :ref:`Dictionary<class_Dictionary>`\ ) |static| |
+-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`GLTFLight<class_GLTFLight>` | :ref:`from_node<class_GLTFLight_method_from_node>`\ (\ light_node\: :ref:`Light3D<class_Light3D>`\ ) |static| |
+-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Variant<class_Variant>` | :ref:`get_additional_data<class_GLTFLight_method_get_additional_data>`\ (\ extension_name\: :ref:`StringName<class_StringName>`\ ) |
+-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`set_additional_data<class_GLTFLight_method_set_additional_data>`\ (\ extension_name\: :ref:`StringName<class_StringName>`, additional_data\: :ref:`Variant<class_Variant>`\ ) |
+-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Dictionary<class_Dictionary>` | :ref:`to_dictionary<class_GLTFLight_method_to_dictionary>`\ (\ ) |const| |
+-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Light3D<class_Light3D>` | :ref:`to_node<class_GLTFLight_method_to_node>`\ (\ ) |const| |
+-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
Property Descriptions
---------------------
.. _class_GLTFLight_property_color:
.. rst-class:: classref-property
:ref:`Color<class_Color>` **color** = ``Color(1, 1, 1, 1)`` :ref:`🔗<class_GLTFLight_property_color>`
.. rst-class:: classref-property-setget
- |void| **set_color**\ (\ value\: :ref:`Color<class_Color>`\ )
- :ref:`Color<class_Color>` **get_color**\ (\ )
The :ref:`Color<class_Color>` of the light. Defaults to white. A black color causes the light to have no effect.
.. rst-class:: classref-item-separator
----
.. _class_GLTFLight_property_inner_cone_angle:
.. rst-class:: classref-property
:ref:`float<class_float>` **inner_cone_angle** = ``0.0`` :ref:`🔗<class_GLTFLight_property_inner_cone_angle>`
.. rst-class:: classref-property-setget
- |void| **set_inner_cone_angle**\ (\ value\: :ref:`float<class_float>`\ )
- :ref:`float<class_float>` **get_inner_cone_angle**\ (\ )
The inner angle of the cone in a spotlight. Must be less than or equal to the outer cone angle.
Within this angle, the light is at full brightness. Between the inner and outer cone angles, there is a transition from full brightness to zero brightness. When creating a Godot :ref:`SpotLight3D<class_SpotLight3D>`, the ratio between the inner and outer cone angles is used to calculate the attenuation of the light.
.. rst-class:: classref-item-separator
----
.. _class_GLTFLight_property_intensity:
.. rst-class:: classref-property
:ref:`float<class_float>` **intensity** = ``1.0`` :ref:`🔗<class_GLTFLight_property_intensity>`
.. rst-class:: classref-property-setget
- |void| **set_intensity**\ (\ value\: :ref:`float<class_float>`\ )
- :ref:`float<class_float>` **get_intensity**\ (\ )
The intensity of the light. This is expressed in candelas (lumens per steradian) for point and spot lights, and lux (lumens per m²) for directional lights. When creating a Godot light, this value is converted to a unitless multiplier.
.. rst-class:: classref-item-separator
----
.. _class_GLTFLight_property_light_type:
.. rst-class:: classref-property
:ref:`String<class_String>` **light_type** = ``""`` :ref:`🔗<class_GLTFLight_property_light_type>`
.. rst-class:: classref-property-setget
- |void| **set_light_type**\ (\ value\: :ref:`String<class_String>`\ )
- :ref:`String<class_String>` **get_light_type**\ (\ )
The type of the light. The values accepted by Godot are "point", "spot", and "directional", which correspond to Godot's :ref:`OmniLight3D<class_OmniLight3D>`, :ref:`SpotLight3D<class_SpotLight3D>`, and :ref:`DirectionalLight3D<class_DirectionalLight3D>` respectively.
.. rst-class:: classref-item-separator
----
.. _class_GLTFLight_property_outer_cone_angle:
.. rst-class:: classref-property
:ref:`float<class_float>` **outer_cone_angle** = ``0.785398`` :ref:`🔗<class_GLTFLight_property_outer_cone_angle>`
.. rst-class:: classref-property-setget
- |void| **set_outer_cone_angle**\ (\ value\: :ref:`float<class_float>`\ )
- :ref:`float<class_float>` **get_outer_cone_angle**\ (\ )
The outer angle of the cone in a spotlight. Must be greater than or equal to the inner angle.
At this angle, the light drops off to zero brightness. Between the inner and outer cone angles, there is a transition from full brightness to zero brightness. If this angle is a half turn, then the spotlight emits in all directions. When creating a Godot :ref:`SpotLight3D<class_SpotLight3D>`, the outer cone angle is used as the angle of the spotlight.
.. rst-class:: classref-item-separator
----
.. _class_GLTFLight_property_range:
.. rst-class:: classref-property
:ref:`float<class_float>` **range** = ``inf`` :ref:`🔗<class_GLTFLight_property_range>`
.. rst-class:: classref-property-setget
- |void| **set_range**\ (\ value\: :ref:`float<class_float>`\ )
- :ref:`float<class_float>` **get_range**\ (\ )
The range of the light, beyond which the light has no effect. GLTF lights with no range defined behave like physical lights (which have infinite range). When creating a Godot light, the range is clamped to 4096.
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
Method Descriptions
-------------------
.. _class_GLTFLight_method_from_dictionary:
.. rst-class:: classref-method
:ref:`GLTFLight<class_GLTFLight>` **from_dictionary**\ (\ dictionary\: :ref:`Dictionary<class_Dictionary>`\ ) |static| :ref:`🔗<class_GLTFLight_method_from_dictionary>`
Creates a new GLTFLight instance by parsing the given :ref:`Dictionary<class_Dictionary>`.
.. rst-class:: classref-item-separator
----
.. _class_GLTFLight_method_from_node:
.. rst-class:: classref-method
:ref:`GLTFLight<class_GLTFLight>` **from_node**\ (\ light_node\: :ref:`Light3D<class_Light3D>`\ ) |static| :ref:`🔗<class_GLTFLight_method_from_node>`
Create a new GLTFLight instance from the given Godot :ref:`Light3D<class_Light3D>` node.
.. rst-class:: classref-item-separator
----
.. _class_GLTFLight_method_get_additional_data:
.. rst-class:: classref-method
:ref:`Variant<class_Variant>` **get_additional_data**\ (\ extension_name\: :ref:`StringName<class_StringName>`\ ) :ref:`🔗<class_GLTFLight_method_get_additional_data>`
.. 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_GLTFLight_method_set_additional_data:
.. rst-class:: classref-method
|void| **set_additional_data**\ (\ extension_name\: :ref:`StringName<class_StringName>`, additional_data\: :ref:`Variant<class_Variant>`\ ) :ref:`🔗<class_GLTFLight_method_set_additional_data>`
.. 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_GLTFLight_method_to_dictionary:
.. rst-class:: classref-method
:ref:`Dictionary<class_Dictionary>` **to_dictionary**\ (\ ) |const| :ref:`🔗<class_GLTFLight_method_to_dictionary>`
Serializes this GLTFLight instance into a :ref:`Dictionary<class_Dictionary>`.
.. rst-class:: classref-item-separator
----
.. _class_GLTFLight_method_to_node:
.. rst-class:: classref-method
:ref:`Light3D<class_Light3D>` **to_node**\ (\ ) |const| :ref:`🔗<class_GLTFLight_method_to_node>`
Converts this GLTFLight instance into a Godot :ref:`Light3D<class_Light3D>` node.
.. |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.)`
.. |void| replace:: :abbr:`void (No return value.)`