class_gltflight.rst 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/4.2/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/4.2/modules/gltf/doc_classes/GLTFLight.xml.
  6. .. _class_GLTFLight:
  7. GLTFLight
  8. =========
  9. **Inherits:** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
  10. Represents a GLTF light.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. Represents a light as defined by the ``KHR_lights_punctual`` GLTF extension.
  15. .. rst-class:: classref-introduction-group
  16. Tutorials
  17. ---------
  18. - :doc:`Runtime file loading and saving <../tutorials/io/runtime_file_loading_and_saving>`
  19. - `KHR_lights_punctual GLTF extension spec <https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Khronos/KHR_lights_punctual>`__
  20. .. rst-class:: classref-reftable-group
  21. Properties
  22. ----------
  23. .. table::
  24. :widths: auto
  25. +-----------------------------+--------------------------------------------------------------------+-----------------------+
  26. | :ref:`Color<class_Color>` | :ref:`color<class_GLTFLight_property_color>` | ``Color(1, 1, 1, 1)`` |
  27. +-----------------------------+--------------------------------------------------------------------+-----------------------+
  28. | :ref:`float<class_float>` | :ref:`inner_cone_angle<class_GLTFLight_property_inner_cone_angle>` | ``0.0`` |
  29. +-----------------------------+--------------------------------------------------------------------+-----------------------+
  30. | :ref:`float<class_float>` | :ref:`intensity<class_GLTFLight_property_intensity>` | ``1.0`` |
  31. +-----------------------------+--------------------------------------------------------------------+-----------------------+
  32. | :ref:`String<class_String>` | :ref:`light_type<class_GLTFLight_property_light_type>` | ``""`` |
  33. +-----------------------------+--------------------------------------------------------------------+-----------------------+
  34. | :ref:`float<class_float>` | :ref:`outer_cone_angle<class_GLTFLight_property_outer_cone_angle>` | ``0.785398`` |
  35. +-----------------------------+--------------------------------------------------------------------+-----------------------+
  36. | :ref:`float<class_float>` | :ref:`range<class_GLTFLight_property_range>` | ``inf`` |
  37. +-----------------------------+--------------------------------------------------------------------+-----------------------+
  38. .. rst-class:: classref-reftable-group
  39. Methods
  40. -------
  41. .. table::
  42. :widths: auto
  43. +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------+
  44. | :ref:`GLTFLight<class_GLTFLight>` | :ref:`from_dictionary<class_GLTFLight_method_from_dictionary>` **(** :ref:`Dictionary<class_Dictionary>` dictionary **)** |static| |
  45. +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------+
  46. | :ref:`GLTFLight<class_GLTFLight>` | :ref:`from_node<class_GLTFLight_method_from_node>` **(** :ref:`Light3D<class_Light3D>` light_node **)** |static| |
  47. +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------+
  48. | :ref:`Dictionary<class_Dictionary>` | :ref:`to_dictionary<class_GLTFLight_method_to_dictionary>` **(** **)** |const| |
  49. +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------+
  50. | :ref:`Light3D<class_Light3D>` | :ref:`to_node<class_GLTFLight_method_to_node>` **(** **)** |const| |
  51. +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------+
  52. .. rst-class:: classref-section-separator
  53. ----
  54. .. rst-class:: classref-descriptions-group
  55. Property Descriptions
  56. ---------------------
  57. .. _class_GLTFLight_property_color:
  58. .. rst-class:: classref-property
  59. :ref:`Color<class_Color>` **color** = ``Color(1, 1, 1, 1)``
  60. .. rst-class:: classref-property-setget
  61. - void **set_color** **(** :ref:`Color<class_Color>` value **)**
  62. - :ref:`Color<class_Color>` **get_color** **(** **)**
  63. The :ref:`Color<class_Color>` of the light. Defaults to white. A black color causes the light to have no effect.
  64. .. rst-class:: classref-item-separator
  65. ----
  66. .. _class_GLTFLight_property_inner_cone_angle:
  67. .. rst-class:: classref-property
  68. :ref:`float<class_float>` **inner_cone_angle** = ``0.0``
  69. .. rst-class:: classref-property-setget
  70. - void **set_inner_cone_angle** **(** :ref:`float<class_float>` value **)**
  71. - :ref:`float<class_float>` **get_inner_cone_angle** **(** **)**
  72. The inner angle of the cone in a spotlight. Must be less than or equal to the outer cone angle.
  73. 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.
  74. .. rst-class:: classref-item-separator
  75. ----
  76. .. _class_GLTFLight_property_intensity:
  77. .. rst-class:: classref-property
  78. :ref:`float<class_float>` **intensity** = ``1.0``
  79. .. rst-class:: classref-property-setget
  80. - void **set_intensity** **(** :ref:`float<class_float>` value **)**
  81. - :ref:`float<class_float>` **get_intensity** **(** **)**
  82. 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.
  83. .. rst-class:: classref-item-separator
  84. ----
  85. .. _class_GLTFLight_property_light_type:
  86. .. rst-class:: classref-property
  87. :ref:`String<class_String>` **light_type** = ``""``
  88. .. rst-class:: classref-property-setget
  89. - void **set_light_type** **(** :ref:`String<class_String>` value **)**
  90. - :ref:`String<class_String>` **get_light_type** **(** **)**
  91. 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.
  92. .. rst-class:: classref-item-separator
  93. ----
  94. .. _class_GLTFLight_property_outer_cone_angle:
  95. .. rst-class:: classref-property
  96. :ref:`float<class_float>` **outer_cone_angle** = ``0.785398``
  97. .. rst-class:: classref-property-setget
  98. - void **set_outer_cone_angle** **(** :ref:`float<class_float>` value **)**
  99. - :ref:`float<class_float>` **get_outer_cone_angle** **(** **)**
  100. The outer angle of the cone in a spotlight. Must be greater than or equal to the inner angle.
  101. 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.
  102. .. rst-class:: classref-item-separator
  103. ----
  104. .. _class_GLTFLight_property_range:
  105. .. rst-class:: classref-property
  106. :ref:`float<class_float>` **range** = ``inf``
  107. .. rst-class:: classref-property-setget
  108. - void **set_range** **(** :ref:`float<class_float>` value **)**
  109. - :ref:`float<class_float>` **get_range** **(** **)**
  110. 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.
  111. .. rst-class:: classref-section-separator
  112. ----
  113. .. rst-class:: classref-descriptions-group
  114. Method Descriptions
  115. -------------------
  116. .. _class_GLTFLight_method_from_dictionary:
  117. .. rst-class:: classref-method
  118. :ref:`GLTFLight<class_GLTFLight>` **from_dictionary** **(** :ref:`Dictionary<class_Dictionary>` dictionary **)** |static|
  119. Creates a new GLTFLight instance by parsing the given :ref:`Dictionary<class_Dictionary>`.
  120. .. rst-class:: classref-item-separator
  121. ----
  122. .. _class_GLTFLight_method_from_node:
  123. .. rst-class:: classref-method
  124. :ref:`GLTFLight<class_GLTFLight>` **from_node** **(** :ref:`Light3D<class_Light3D>` light_node **)** |static|
  125. Create a new GLTFLight instance from the given Godot :ref:`Light3D<class_Light3D>` node.
  126. .. rst-class:: classref-item-separator
  127. ----
  128. .. _class_GLTFLight_method_to_dictionary:
  129. .. rst-class:: classref-method
  130. :ref:`Dictionary<class_Dictionary>` **to_dictionary** **(** **)** |const|
  131. Serializes this GLTFLight instance into a :ref:`Dictionary<class_Dictionary>`.
  132. .. rst-class:: classref-item-separator
  133. ----
  134. .. _class_GLTFLight_method_to_node:
  135. .. rst-class:: classref-method
  136. :ref:`Light3D<class_Light3D>` **to_node** **(** **)** |const|
  137. Converts this GLTFLight instance into a Godot :ref:`Light3D<class_Light3D>` node.
  138. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  139. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  140. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  141. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  142. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  143. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  144. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`