summaryrefslogtreecommitdiff
path: root/doc/classes/Light2D.xml
blob: cc1882c7a4e494574b1b4f203f686c024d4dd967 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
<?xml version="1.0" encoding="UTF-8" ?>
<class name="Light2D" inherits="Node2D" category="Core" version="3.0.alpha.custom_build">
	<brief_description>
		Node that casts light in a 2D environment.
	</brief_description>
	<description>
		Node that 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). Note that Light2D can be used as a mask.
	</description>
	<tutorials>
	</tutorials>
	<demos>
	</demos>
	<methods>
		<method name="get_color" qualifiers="const">
			<return type="Color">
			</return>
			<description>
				Return the color of the Light2D.
			</description>
		</method>
		<method name="get_energy" qualifiers="const">
			<return type="float">
			</return>
			<description>
				Return the energy value of the Light2D.
			</description>
		</method>
		<method name="get_height" qualifiers="const">
			<return type="float">
			</return>
			<description>
				Return the height of the Light2D. Used with 2D normalmapping.
			</description>
		</method>
		<method name="get_item_cull_mask" qualifiers="const">
			<return type="int">
			</return>
			<description>
			</description>
		</method>
		<method name="get_item_shadow_cull_mask" qualifiers="const">
			<return type="int">
			</return>
			<description>
			</description>
		</method>
		<method name="get_layer_range_max" qualifiers="const">
			<return type="int">
			</return>
			<description>
				Set the maximum layer value of objects of the scene that are affected by the Light2D.
			</description>
		</method>
		<method name="get_layer_range_min" qualifiers="const">
			<return type="int">
			</return>
			<description>
				Get the minimum layer value of objects of the scene that are affected by the Light2D.
			</description>
		</method>
		<method name="get_mode" qualifiers="const">
			<return type="int" enum="Light2D.Mode">
			</return>
			<description>
				Return the current mode set to the Light2D.
			</description>
		</method>
		<method name="get_shadow_buffer_size" qualifiers="const">
			<return type="int">
			</return>
			<description>
				Return the shadow buffer size.
			</description>
		</method>
		<method name="get_shadow_color" qualifiers="const">
			<return type="Color">
			</return>
			<description>
				Return the color of casted shadows for this Light2D.
			</description>
		</method>
		<method name="get_shadow_filter" qualifiers="const">
			<return type="int" enum="Light2D.ShadowFilter">
			</return>
			<description>
			</description>
		</method>
		<method name="get_shadow_gradient_length" qualifiers="const">
			<return type="float">
			</return>
			<description>
			</description>
		</method>
		<method name="get_shadow_smooth" qualifiers="const">
			<return type="float">
			</return>
			<description>
			</description>
		</method>
		<method name="get_texture" qualifiers="const">
			<return type="Texture">
			</return>
			<description>
				Return the texture of the Light2D.
			</description>
		</method>
		<method name="get_texture_offset" qualifiers="const">
			<return type="Vector2">
			</return>
			<description>
				Return the offset of the light texture.
			</description>
		</method>
		<method name="get_texture_scale" qualifiers="const">
			<return type="float">
			</return>
			<description>
				Return the scale value of the light texture.
			</description>
		</method>
		<method name="get_z_range_max" qualifiers="const">
			<return type="int">
			</return>
			<description>
				Get the maximum Z value that objects of the scene can be in order to be affected by the Light2D.
			</description>
		</method>
		<method name="get_z_range_min" qualifiers="const">
			<return type="int">
			</return>
			<description>
				Get the minimum Z value that objects of the scene have to be in order to be affected by the Light2D.
			</description>
		</method>
		<method name="is_editor_only" qualifiers="const">
			<return type="bool">
			</return>
			<description>
			</description>
		</method>
		<method name="is_enabled" qualifiers="const">
			<return type="bool">
			</return>
			<description>
				Return true if the Light2D is enabled, false if it is not.
			</description>
		</method>
		<method name="is_shadow_enabled" qualifiers="const">
			<return type="bool">
			</return>
			<description>
				Return true if shadow casting is enabled for this Light2D, else return false.
			</description>
		</method>
		<method name="set_color">
			<return type="void">
			</return>
			<argument index="0" name="color" type="Color">
			</argument>
			<description>
				Set the color of the Light2D.
			</description>
		</method>
		<method name="set_editor_only">
			<return type="void">
			</return>
			<argument index="0" name="editor_only" type="bool">
			</argument>
			<description>
			</description>
		</method>
		<method name="set_enabled">
			<return type="void">
			</return>
			<argument index="0" name="enabled" type="bool">
			</argument>
			<description>
				Switches the Light2D on or off, depending on the 'enabled' parameter.
			</description>
		</method>
		<method name="set_energy">
			<return type="void">
			</return>
			<argument index="0" name="energy" type="float">
			</argument>
			<description>
				Set the energy value of the Light2D. The bigger the value, the stronger the light.
			</description>
		</method>
		<method name="set_height">
			<return type="void">
			</return>
			<argument index="0" name="height" type="float">
			</argument>
			<description>
				Set the height of the Light2D. Used with 2D normalmapping.
			</description>
		</method>
		<method name="set_item_cull_mask">
			<return type="void">
			</return>
			<argument index="0" name="item_cull_mask" type="int">
			</argument>
			<description>
				Set the item mask of the Light2D to 'item_mask' value.
			</description>
		</method>
		<method name="set_item_shadow_cull_mask">
			<return type="void">
			</return>
			<argument index="0" name="item_shadow_cull_mask" type="int">
			</argument>
			<description>
				Set the item shadow mask to 'item_shadow_mask' value.
			</description>
		</method>
		<method name="set_layer_range_max">
			<return type="void">
			</return>
			<argument index="0" name="layer" type="int">
			</argument>
			<description>
				Set the maximum layer value of objects of the scene that are affected by the Light2D.
			</description>
		</method>
		<method name="set_layer_range_min">
			<return type="void">
			</return>
			<argument index="0" name="layer" type="int">
			</argument>
			<description>
				Set the minimum layer value of objects of the scene that are affected by the Light2D.
			</description>
		</method>
		<method name="set_mode">
			<return type="void">
			</return>
			<argument index="0" name="mode" type="int" enum="Light2D.Mode">
			</argument>
			<description>
				Set the behaviour mode of the Light2D. Use constants defined in the constants section.
			</description>
		</method>
		<method name="set_shadow_buffer_size">
			<return type="void">
			</return>
			<argument index="0" name="size" type="int">
			</argument>
			<description>
				Set the shadow buffer size.
			</description>
		</method>
		<method name="set_shadow_color">
			<return type="void">
			</return>
			<argument index="0" name="shadow_color" type="Color">
			</argument>
			<description>
				Set the color of casted shadows for this Light2D.
			</description>
		</method>
		<method name="set_shadow_enabled">
			<return type="void">
			</return>
			<argument index="0" name="enabled" type="bool">
			</argument>
			<description>
				Enable or disable shadows casting from this Light2D according to the 'enabled' parameter.
			</description>
		</method>
		<method name="set_shadow_filter">
			<return type="void">
			</return>
			<argument index="0" name="filter" type="int" enum="Light2D.ShadowFilter">
			</argument>
			<description>
			</description>
		</method>
		<method name="set_shadow_gradient_length">
			<return type="void">
			</return>
			<argument index="0" name="multiplier" type="float">
			</argument>
			<description>
			</description>
		</method>
		<method name="set_shadow_smooth">
			<return type="void">
			</return>
			<argument index="0" name="smooth" type="float">
			</argument>
			<description>
			</description>
		</method>
		<method name="set_texture">
			<return type="void">
			</return>
			<argument index="0" name="texture" type="Texture">
			</argument>
			<description>
				Set the texture of the Light2D.
			</description>
		</method>
		<method name="set_texture_offset">
			<return type="void">
			</return>
			<argument index="0" name="texture_offset" type="Vector2">
			</argument>
			<description>
				Set the offset of the light texture.
			</description>
		</method>
		<method name="set_texture_scale">
			<return type="void">
			</return>
			<argument index="0" name="texture_scale" type="float">
			</argument>
			<description>
				Set the scale value of the light texture.
			</description>
		</method>
		<method name="set_z_range_max">
			<return type="void">
			</return>
			<argument index="0" name="z" type="int">
			</argument>
			<description>
				Set the maximum Z value that objects of the scene can be in order to be affected by the Light2D.
			</description>
		</method>
		<method name="set_z_range_min">
			<return type="void">
			</return>
			<argument index="0" name="z" type="int">
			</argument>
			<description>
				Set the minimum Z value that objects of the scene have to be in order to be affected by the Light2D.
			</description>
		</method>
	</methods>
	<members>
		<member name="color" type="Color" setter="set_color" getter="get_color">
			The Light2D's [Color].
		</member>
		<member name="editor_only" type="bool" setter="set_editor_only" getter="is_editor_only">
			If [code]true[/code] Light2D will only appear when editing the scene. Default value: [code]false[/code].
		</member>
		<member name="enabled" type="bool" setter="set_enabled" getter="is_enabled">
			If [code]true[/code] Light2D will emit light. Default value: [code]true[/code].
		</member>
		<member name="energy" type="float" setter="set_energy" getter="get_energy">
			The Light2D's energy value. The larger the value, the stronger the light.
		</member>
		<member name="mode" type="int" setter="set_mode" getter="get_mode" enum="Light2D.Mode">
			The Light2D's mode. See MODE_* constants for values.
		</member>
		<member name="offset" type="Vector2" setter="set_texture_offset" getter="get_texture_offset">
			The offset of the Light2D's [code]texture[/code].
		</member>
		<member name="range_height" type="float" setter="set_height" getter="get_height">
			The height of the Light2D. Used with 2D normal mapping.
		</member>
		<member name="range_item_cull_mask" type="int" setter="set_item_cull_mask" getter="get_item_cull_mask">
			The layer mask. Only objects with a matching mask will be affected by the Light2D.
		</member>
		<member name="range_layer_max" type="int" setter="set_layer_range_max" getter="get_layer_range_max">
			Maximum layer value of objects that are affected by the Light2D. Default value: [code]0[/code].
		</member>
		<member name="range_layer_min" type="int" setter="set_layer_range_min" getter="get_layer_range_min">
			Minimum layer value of objects that are affected by the Light2D. Default value: [code]0[/code].
		</member>
		<member name="range_z_max" type="int" setter="set_z_range_max" getter="get_z_range_max">
			Maximum [code]Z[/code] value of objects that are affected by the Light2D. Default value: [code]1024[/code].
		</member>
		<member name="range_z_min" type="int" setter="set_z_range_min" getter="get_z_range_min">
			Minimum [code]z[/code] value of objects that are affected by the Light2D. Default value: [code]-1024[/code].
		</member>
		<member name="shadow_buffer_size" type="int" setter="set_shadow_buffer_size" getter="get_shadow_buffer_size">
			Shadow buffer size. Default value: [code]2048[/code].
		</member>
		<member name="shadow_color" type="Color" setter="set_shadow_color" getter="get_shadow_color">
			[Color] of shadows cast by the Light2D.
		</member>
		<member name="shadow_enabled" type="bool" setter="set_shadow_enabled" getter="is_shadow_enabled">
			If [code]true[/code] the Light2D will cast shadows. Default value: [code]false[/code].
		</member>
		<member name="shadow_filter" type="int" setter="set_shadow_filter" getter="get_shadow_filter" enum="Light2D.ShadowFilter">
			Shadow filter type. May be one of [code][None, PCF5, PCF9, PCF13][/code]. Default value: [code]None[/code].
		</member>
		<member name="shadow_filter_smooth" type="float" setter="set_shadow_smooth" getter="get_shadow_smooth">
			Smoothing value for shadows. 
		</member>
		<member name="shadow_gradient_length" type="float" setter="set_shadow_gradient_length" getter="get_shadow_gradient_length">
			Smooth shadow gradient length.
		</member>
		<member name="shadow_item_cull_mask" type="int" setter="set_item_shadow_cull_mask" getter="get_item_shadow_cull_mask">
			The shadow mask. Used with [LightOccluder2D] to cast shadows. Only occluders with a matching shadow mask will cast shadows.
		</member>
		<member name="texture" type="Texture" setter="set_texture" getter="get_texture">
			[Texture] used for the Light2D's appearance.
		</member>
		<member name="texture_scale" type="float" setter="set_texture_scale" getter="get_texture_scale">
			The [code]texture[/code]'s scale factor.
		</member>
	</members>
	<constants>
		<constant name="MODE_ADD" value="0">
			Adds the value of pixels corresponding to the Light2D to the values of pixels under it. This is the common behaviour of a light.
		</constant>
		<constant name="MODE_SUB" value="1">
			Subtract the value of pixels corresponding to the Light2D to the values of pixels under it, resulting in inversed light effect.
		</constant>
		<constant name="MODE_MIX" value="2">
			Mix the value of pixels corresponding to the Light2D to the values of pixels under it by linear interpolation.
		</constant>
		<constant name="MODE_MASK" value="3">
			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>
		<constant name="SHADOW_FILTER_NONE" value="0">
		</constant>
		<constant name="SHADOW_FILTER_PCF3" value="1">
		</constant>
		<constant name="SHADOW_FILTER_PCF5" value="2">
		</constant>
		<constant name="SHADOW_FILTER_PCF7" value="3">
		</constant>
		<constant name="SHADOW_FILTER_PCF9" value="4">
		</constant>
		<constant name="SHADOW_FILTER_PCF13" value="5">
		</constant>
	</constants>
</class>