@@ -12,12 +12,14 @@ var Utils = require('../../renderer/webgl/Utils');
1212/**
1313 * @callback LightForEach
1414 *
15- * @param {Phaser.GameObjects.Light } light - [description]
15+ * @param {Phaser.GameObjects.Light } light - The Light.
1616 */
1717
1818/**
1919 * @classdesc
20- * [description]
20+ * Manages Lights for a Scene.
21+ *
22+ * Affects the rendering of Game Objects using the `Light2D` pipeline.
2123 *
2224 * @class LightsManager
2325 * @memberOf Phaser.GameObjects
@@ -31,7 +33,9 @@ var LightsManager = new Class({
3133 function LightsManager ( )
3234 {
3335 /**
34- * [description]
36+ * The pool of Lights.
37+ *
38+ * Used to recycle removed Lights for a more efficient use of memory.
3539 *
3640 * @name Phaser.GameObjects.LightsManager#lightPool
3741 * @type {Phaser.GameObjects.Light[] }
@@ -41,7 +45,7 @@ var LightsManager = new Class({
4145 this . lightPool = [ ] ;
4246
4347 /**
44- * [description]
48+ * The Lights in the Scene.
4549 *
4650 * @name Phaser.GameObjects.LightsManager#lights
4751 * @type {Phaser.GameObjects.Light[] }
@@ -51,7 +55,9 @@ var LightsManager = new Class({
5155 this . lights = [ ] ;
5256
5357 /**
54- * [description]
58+ * Lights that have been culled from a Camera's viewport.
59+ *
60+ * Lights in this list will not be rendered.
5561 *
5662 * @name Phaser.GameObjects.LightsManager#culledLights
5763 * @type {Phaser.GameObjects.Light[] }
@@ -61,7 +67,7 @@ var LightsManager = new Class({
6167 this . culledLights = [ ] ;
6268
6369 /**
64- * [description]
70+ * The ambient color.
6571 *
6672 * @name Phaser.GameObjects.LightsManager#ambientColor
6773 * @type {{ r: float, g: float, b: float } }
@@ -70,7 +76,7 @@ var LightsManager = new Class({
7076 this . ambientColor = { r : 0.1 , g : 0.1 , b : 0.1 } ;
7177
7278 /**
73- * [description]
79+ * Whether the Lights Manager is enabled.
7480 *
7581 * @name Phaser.GameObjects.LightsManager#active
7682 * @type {boolean }
@@ -81,7 +87,7 @@ var LightsManager = new Class({
8187 } ,
8288
8389 /**
84- * [description]
90+ * Enable the Lights Manager.
8591 *
8692 * @method Phaser.GameObjects.LightsManager#enable
8793 * @since 3.0.0
@@ -96,7 +102,7 @@ var LightsManager = new Class({
96102 } ,
97103
98104 /**
99- * [description]
105+ * Disable the Lights Manager.
100106 *
101107 * @method Phaser.GameObjects.LightsManager#disable
102108 * @since 3.0.0
@@ -111,14 +117,16 @@ var LightsManager = new Class({
111117 } ,
112118
113119 /**
114- * [description]
120+ * Cull any Lights that aren't visible to the given Camera.
121+ *
122+ * Culling Lights improves performance by ensuring that only Lights within a Camera's viewport are rendered.
115123 *
116124 * @method Phaser.GameObjects.LightsManager#cull
117125 * @since 3.0.0
118126 *
119- * @param {Phaser.Cameras.Scene2D.Camera } camera - [description]
127+ * @param {Phaser.Cameras.Scene2D.Camera } camera - The Camera to cull Lights for.
120128 *
121- * @return {Phaser.GameObjects.Light[] } [description]
129+ * @return {Phaser.GameObjects.Light[] } The culled Lights.
122130 */
123131 cull : function ( camera )
124132 {
@@ -156,12 +164,12 @@ var LightsManager = new Class({
156164 } ,
157165
158166 /**
159- * [description]
167+ * Iterate over each Light with a callback.
160168 *
161169 * @method Phaser.GameObjects.LightsManager#forEachLight
162170 * @since 3.0.0
163171 *
164- * @param {LightForEach } callback - [description]
172+ * @param {LightForEach } callback - The callback that is called with each Light.
165173 *
166174 * @return {Phaser.GameObjects.LightsManager } This Lights Manager object.
167175 */
@@ -184,12 +192,12 @@ var LightsManager = new Class({
184192 } ,
185193
186194 /**
187- * [description]
195+ * Set the ambient light color.
188196 *
189197 * @method Phaser.GameObjects.LightsManager#setAmbientColor
190198 * @since 3.0.0
191199 *
192- * @param {number } rgb - [description]
200+ * @param {number } rgb - The integer RGB color of the ambient light.
193201 *
194202 * @return {Phaser.GameObjects.LightsManager } This Lights Manager object.
195203 */
@@ -210,39 +218,39 @@ var LightsManager = new Class({
210218 * @method Phaser.GameObjects.LightsManager#getMaxVisibleLights
211219 * @since 3.0.0
212220 *
213- * @return {integer } [description]
221+ * @return {integer } The maximum number of Lights allowed to appear at once.
214222 */
215223 getMaxVisibleLights : function ( )
216224 {
217225 return 10 ;
218226 } ,
219227
220228 /**
221- * [description]
229+ * Get the number of Lights managed by this Lights Manager.
222230 *
223231 * @method Phaser.GameObjects.LightsManager#getLightCount
224232 * @since 3.0.0
225233 *
226- * @return {integer } [description]
234+ * @return {integer } The number of Lights managed by this Lights Manager.
227235 */
228236 getLightCount : function ( )
229237 {
230238 return this . lights . length ;
231239 } ,
232240
233241 /**
234- * [description]
242+ * Add a Light.
235243 *
236244 * @method Phaser.GameObjects.LightsManager#addLight
237245 * @since 3.0.0
238246 *
239- * @param {number } x - [description]
240- * @param {number } y - [description]
241- * @param {number } radius - [description]
242- * @param {number } rgb - [description]
243- * @param {number } intensity - [description]
247+ * @param {number } x - The horizontal position of the Light.
248+ * @param {number } y - The vertical position of the Light.
249+ * @param {number } radius - The radius of the Light.
250+ * @param {number } rgb - The integer RGB color of the light.
251+ * @param {number } intensity - The intensity of the Light.
244252 *
245- * @return {Phaser.GameObjects.Light } [description]
253+ * @return {Phaser.GameObjects.Light } The Light that was added.
246254 */
247255 addLight : function ( x , y , radius , rgb , intensity )
248256 {
@@ -274,12 +282,12 @@ var LightsManager = new Class({
274282 } ,
275283
276284 /**
277- * [description]
285+ * Remove a Light.
278286 *
279287 * @method Phaser.GameObjects.LightsManager#removeLight
280288 * @since 3.0.0
281289 *
282- * @param {Phaser.GameObjects.Light } light - [description]
290+ * @param {Phaser.GameObjects.Light } light - The Light to remove.
283291 *
284292 * @return {Phaser.GameObjects.LightsManager } This Lights Manager object.
285293 */
@@ -297,7 +305,10 @@ var LightsManager = new Class({
297305 } ,
298306
299307 /**
300- * [description]
308+ * Shut down the Lights Manager.
309+ *
310+ * Recycles all active Lights into the Light pool, resets ambient light color and clears the lists of Lights and
311+ * culled Lights.
301312 *
302313 * @method Phaser.GameObjects.LightsManager#shutdown
303314 * @since 3.0.0
@@ -315,7 +326,9 @@ var LightsManager = new Class({
315326 } ,
316327
317328 /**
318- * [description]
329+ * Destroy the Lights Manager.
330+ *
331+ * Cleans up all references by calling {@link Phaser.GameObjects.LightsManager#shutdown}.
319332 *
320333 * @method Phaser.GameObjects.LightsManager#destroy
321334 * @since 3.0.0
0 commit comments