2017-09-13 04:42:36 +08:00
<?xml version="1.0" encoding="UTF-8" ?>
2020-02-01 09:03:48 +08:00
<class name= "Light2D" inherits= "Node2D" version= "4.0" >
2017-09-13 04:42:36 +08:00
<brief_description >
2017-10-09 18:49:12 +08:00
Casts light in a 2D environment.
2017-09-13 04:42:36 +08:00
</brief_description>
<description >
2019-06-22 07:04:47 +08:00
Casts light in a 2D environment. Light is defined by a (usually grayscale) texture, a color, an energy value, a mode (see constants), and various other parameters (range and shadows-related).
[b]Note:[/b] Light2D can also be used as a mask.
2017-09-13 04:42:36 +08:00
</description>
<tutorials >
2020-01-29 09:48:10 +08:00
<link > https://docs.godotengine.org/en/latest/tutorials/2d/2d_lights_and_shadows.html</link>
2017-09-13 04:42:36 +08:00
</tutorials>
<methods >
</methods>
<members >
2019-06-29 18:38:01 +08:00
<member name= "color" type= "Color" setter= "set_color" getter= "get_color" default= "Color( 1, 1, 1, 1 )" >
2017-09-17 11:42:59 +08:00
The Light2D's [Color].
2017-09-13 04:42:36 +08:00
</member>
2019-06-29 18:38:01 +08:00
<member name= "editor_only" type= "bool" setter= "set_editor_only" getter= "is_editor_only" default= "false" >
2019-06-29 21:24:23 +08:00
If [code]true[/code], Light2D will only appear when editing the scene.
2017-09-13 04:42:36 +08:00
</member>
2019-06-29 18:38:01 +08:00
<member name= "enabled" type= "bool" setter= "set_enabled" getter= "is_enabled" default= "true" >
2019-06-29 21:24:23 +08:00
If [code]true[/code], Light2D will emit light.
2017-09-13 04:42:36 +08:00
</member>
2019-06-29 18:38:01 +08:00
<member name= "energy" type= "float" setter= "set_energy" getter= "get_energy" default= "1.0" >
2017-09-17 11:42:59 +08:00
The Light2D's energy value. The larger the value, the stronger the light.
2017-09-13 04:42:36 +08:00
</member>
2019-06-29 18:38:01 +08:00
<member name= "mode" type= "int" setter= "set_mode" getter= "get_mode" enum= "Light2D.Mode" default= "0" >
2019-12-07 06:09:20 +08:00
The Light2D's mode. See [enum Mode] constants for values.
2017-09-13 04:42:36 +08:00
</member>
2019-06-29 18:38:01 +08:00
<member name= "offset" type= "Vector2" setter= "set_texture_offset" getter= "get_texture_offset" default= "Vector2( 0, 0 )" >
2017-09-17 11:42:59 +08:00
The offset of the Light2D's [code]texture[/code].
2017-09-13 04:42:36 +08:00
</member>
2019-06-29 18:38:01 +08:00
<member name= "range_height" type= "float" setter= "set_height" getter= "get_height" default= "0.0" >
2017-09-17 11:42:59 +08:00
The height of the Light2D. Used with 2D normal mapping.
2017-09-13 04:42:36 +08:00
</member>
2019-06-29 18:38:01 +08:00
<member name= "range_item_cull_mask" type= "int" setter= "set_item_cull_mask" getter= "get_item_cull_mask" default= "1" >
2017-09-17 11:42:59 +08:00
The layer mask. Only objects with a matching mask will be affected by the Light2D.
2017-09-13 04:42:36 +08:00
</member>
2019-06-29 18:38:01 +08:00
<member name= "range_layer_max" type= "int" setter= "set_layer_range_max" getter= "get_layer_range_max" default= "0" >
2019-06-29 21:24:23 +08:00
Maximum layer value of objects that are affected by the Light2D.
2017-09-13 04:42:36 +08:00
</member>
2019-06-29 18:38:01 +08:00
<member name= "range_layer_min" type= "int" setter= "set_layer_range_min" getter= "get_layer_range_min" default= "0" >
2019-06-29 21:24:23 +08:00
Minimum layer value of objects that are affected by the Light2D.
2017-09-13 04:42:36 +08:00
</member>
2019-06-29 18:38:01 +08:00
<member name= "range_z_max" type= "int" setter= "set_z_range_max" getter= "get_z_range_max" default= "1024" >
2019-06-29 21:24:23 +08:00
Maximum [code]z[/code] value of objects that are affected by the Light2D.
2017-09-13 04:42:36 +08:00
</member>
2019-06-29 18:38:01 +08:00
<member name= "range_z_min" type= "int" setter= "set_z_range_min" getter= "get_z_range_min" default= "-1024" >
2019-06-29 21:24:23 +08:00
Minimum [code]z[/code] value of objects that are affected by the Light2D.
2017-09-13 04:42:36 +08:00
</member>
2019-06-29 18:38:01 +08:00
<member name= "shadow_buffer_size" type= "int" setter= "set_shadow_buffer_size" getter= "get_shadow_buffer_size" default= "2048" >
2019-06-29 21:24:23 +08:00
Shadow buffer size.
2017-09-13 04:42:36 +08:00
</member>
2019-06-29 18:38:01 +08:00
<member name= "shadow_color" type= "Color" setter= "set_shadow_color" getter= "get_shadow_color" default= "Color( 0, 0, 0, 0 )" >
2017-09-17 11:42:59 +08:00
[Color] of shadows cast by the Light2D.
2017-09-13 04:42:36 +08:00
</member>
2019-06-29 18:38:01 +08:00
<member name= "shadow_enabled" type= "bool" setter= "set_shadow_enabled" getter= "is_shadow_enabled" default= "false" >
2019-06-29 21:24:23 +08:00
If [code]true[/code], the Light2D will cast shadows.
2017-09-13 04:42:36 +08:00
</member>
2019-06-29 18:38:01 +08:00
<member name= "shadow_filter" type= "int" setter= "set_shadow_filter" getter= "get_shadow_filter" enum= "Light2D.ShadowFilter" default= "0" >
2019-06-29 21:24:23 +08:00
Shadow filter type. See [enum ShadowFilter] for possible values.
2017-09-13 04:42:36 +08:00
</member>
2019-06-29 18:38:01 +08:00
<member name= "shadow_filter_smooth" type= "float" setter= "set_shadow_smooth" getter= "get_shadow_smooth" default= "0.0" >
2017-09-18 00:57:13 +08:00
Smoothing value for shadows.
2017-09-13 04:42:36 +08:00
</member>
2019-06-29 18:38:01 +08:00
<member name= "shadow_gradient_length" type= "float" setter= "set_shadow_gradient_length" getter= "get_shadow_gradient_length" default= "0.0" >
2017-09-17 11:42:59 +08:00
Smooth shadow gradient length.
2017-09-13 04:42:36 +08:00
</member>
2019-06-29 18:38:01 +08:00
<member name= "shadow_item_cull_mask" type= "int" setter= "set_item_shadow_cull_mask" getter= "get_item_shadow_cull_mask" default= "1" >
2019-12-30 02:06:18 +08:00
The shadow mask. Used with [LightOccluder2D] to cast shadows. Only occluders with a matching light mask will cast shadows.
2017-09-13 04:42:36 +08:00
</member>
2019-07-16 02:42:47 +08:00
<member name= "texture" type= "Texture" setter= "set_texture" getter= "get_texture" >
2017-09-17 11:42:59 +08:00
[Texture] used for the Light2D's appearance.
2017-09-13 04:42:36 +08:00
</member>
2019-06-29 18:38:01 +08:00
<member name= "texture_scale" type= "float" setter= "set_texture_scale" getter= "get_texture_scale" default= "1.0" >
2017-09-17 11:42:59 +08:00
The [code]texture[/code]'s scale factor.
2017-09-13 04:42:36 +08:00
</member>
</members>
<constants >
2017-11-25 06:16:30 +08:00
<constant name= "MODE_ADD" value= "0" enum= "Mode" >
2019-06-26 21:57:13 +08:00
Adds the value of pixels corresponding to the Light2D to the values of pixels under it. This is the common behavior of a light.
2017-09-13 04:42:36 +08:00
</constant>
2017-11-25 06:16:30 +08:00
<constant name= "MODE_SUB" value= "1" enum= "Mode" >
2017-10-09 18:49:12 +08:00
Subtracts the value of pixels corresponding to the Light2D to the values of pixels under it, resulting in inversed light effect.
2017-09-13 04:42:36 +08:00
</constant>
2017-11-25 06:16:30 +08:00
<constant name= "MODE_MIX" value= "2" enum= "Mode" >
2017-09-13 04:42:36 +08:00
Mix the value of pixels corresponding to the Light2D to the values of pixels under it by linear interpolation.
</constant>
2017-11-25 06:16:30 +08:00
<constant name= "MODE_MASK" value= "3" enum= "Mode" >
2017-09-13 04:42:36 +08:00
The light texture of the Light2D is used as a mask, hiding or revealing parts of the screen underneath depending on the value of each pixel of the light (mask) texture.
</constant>
2017-11-25 06:16:30 +08:00
<constant name= "SHADOW_FILTER_NONE" value= "0" enum= "ShadowFilter" >
2019-01-07 18:46:26 +08:00
No filter applies to the shadow map. See [member shadow_filter].
2017-09-16 07:46:14 +08:00
</constant>
2017-11-25 06:16:30 +08:00
<constant name= "SHADOW_FILTER_PCF3" value= "1" enum= "ShadowFilter" >
2019-01-07 18:46:26 +08:00
Percentage closer filtering (3 samples) applies to the shadow map. See [member shadow_filter].
2017-09-16 07:46:14 +08:00
</constant>
2017-11-25 06:16:30 +08:00
<constant name= "SHADOW_FILTER_PCF5" value= "2" enum= "ShadowFilter" >
2019-01-07 18:46:26 +08:00
Percentage closer filtering (5 samples) applies to the shadow map. See [member shadow_filter].
2017-09-16 07:46:14 +08:00
</constant>
2017-11-25 06:16:30 +08:00
<constant name= "SHADOW_FILTER_PCF7" value= "3" enum= "ShadowFilter" >
2019-01-07 18:46:26 +08:00
Percentage closer filtering (7 samples) applies to the shadow map. See [member shadow_filter].
2017-09-16 07:46:14 +08:00
</constant>
2017-11-25 06:16:30 +08:00
<constant name= "SHADOW_FILTER_PCF9" value= "4" enum= "ShadowFilter" >
2019-01-07 18:46:26 +08:00
Percentage closer filtering (9 samples) applies to the shadow map. See [member shadow_filter].
2017-09-16 07:46:14 +08:00
</constant>
2017-11-25 06:16:30 +08:00
<constant name= "SHADOW_FILTER_PCF13" value= "5" enum= "ShadowFilter" >
2019-01-07 18:46:26 +08:00
Percentage closer filtering (13 samples) applies to the shadow map. See [member shadow_filter].
2017-09-16 07:46:14 +08:00
</constant>
2017-09-13 04:42:36 +08:00
</constants>
</class>