@@ -88,9 +88,50 @@ var LightsManager = new Class({
8888 this . visibleLights = 0 ;
8989 } ,
9090
91- addPointLight : function ( x , y , color , radius , intensity )
91+ /**
92+ * Creates a new Point Light Game Object and adds it to the Scene.
93+ *
94+ * Note: This method will only be available if the Point Light Game Object has been built into Phaser.
95+ *
96+ * The Point Light Game Object provides a way to add a point light effect into your game,
97+ * without the expensive shader processing requirements of the traditional Light Game Object.
98+ *
99+ * The difference is that the Point Light renders using a custom shader, designed to give the
100+ * impression of a point light source, of variable radius, intensity and color, in your game.
101+ * However, unlike the Light Game Object, it does not impact any other Game Objects, or use their
102+ * normal maps for calcuations. This makes them extremely fast to render compared to Lights
103+ * and perfect for special effects, such as flickering torches or muzzle flashes.
104+ *
105+ * For maximum performance you should batch Point Light Game Objects together. This means
106+ * ensuring they follow each other consecutively on the display list. Ideally, use a Layer
107+ * Game Object and then add just Point Lights to it, so that it can batch together the rendering
108+ * of the lights. You don't _have_ to do this, and if you've only a handful of Point Lights in
109+ * your game then it's perfectly safe to mix them into the dislay list as normal. However, if
110+ * you're using a large number of them, please consider how they are mixed into the display list.
111+ *
112+ * The renderer will automatically cull Point Lights. Those with a radius that does not intersect
113+ * with the Camera will be skipped in the rendering list. This happens automatically and the
114+ * culled state is refreshed every frame, for every camera.
115+ *
116+ * The origin of a Point Light is always 0.5 and it cannot be changed.
117+ *
118+ * Point Lights are a WebGL only feature and do not have a Canvas counterpart.
119+ *
120+ * @method Phaser.GameObjects.LightsManager#addPointlight
121+ * @since 3.50.0
122+ *
123+ * @param {number } x - The horizontal position of this Point Light in the world.
124+ * @param {number } y - The vertical position of this Point Light in the world.
125+ * @param {number } [color=0xffffff] - The color of the Point Light, given as a hex value.
126+ * @param {number } [radius=128] - The radius of the Point Light.
127+ * @param {number } [intensity=1] - The intensity, or colr blend, of the Point Light.
128+ * @param {number } [attenuation=0.1] - The attenuation of the Point Light. This is the reduction of light from the center point.
129+ *
130+ * @return {Phaser.GameObjects.PointLight } The Game Object that was created.
131+ */
132+ addPointLight : function ( x , y , color , radius , intensity , attenuation )
92133 {
93- return this . systems . displayList . add ( new PointLight ( this . scene , x , y , color , radius , intensity ) ) ;
134+ return this . systems . displayList . add ( new PointLight ( this . scene , x , y , color , radius , intensity , attenuation ) ) ;
94135 } ,
95136
96137 /**
0 commit comments