BatchHandlerPointLight
A batch handler RenderNode that renders PointLight Game Objects using WebGL.
Each PointLight is submitted as a textured quad (4 vertices, 6 indices) into a shared vertex buffer. The dedicated point-light shader computes the radial light falloff per fragment, using the light's world position, radius, attenuation factor, colour, and intensity. Multiple lights are batched together and flushed in a single draw call when the batch is full or when the renderer needs to switch context.
This handler uses no textures; it passes an empty texture array to the draw call because the lighting is calculated entirely in the fragment shader.
Constructor
new BatchHandlerPointLight(manager, [config])
Parameters
| name | type | optional | description |
|---|---|---|---|
| manager | Phaser.Renderer.WebGL.RenderNodes.RenderNodeManager | No | The manager that owns this RenderNode. |
| config | Phaser.Types.Renderer.WebGL.RenderNodes.BatchHandlerConfig | Yes | The configuration object for this handler. |
Scope: static
Extends
Source: src/renderer/webgl/renderNodes/BatchHandlerPointLight.js#L12
Since: 4.0.0
Inherited Members
From Phaser.Renderer.WebGL.RenderNodes.BatchHandler:
- batchEntries
- bytesPerIndexPerInstance
- bytesPerInstance
- currentBatchEntry
- floatsPerInstance
- indexBuffer
- indicesPerInstance
- instanceCount
- instancesPerBatch
- maxTexturesPerBatch
- programManager
- vertexBufferLayout
- verticesPerInstance
From Phaser.Renderer.WebGL.RenderNodes.RenderNode:
Public Members
defaultConfig
defaultConfig: Phaser.Types.Renderer.WebGL.RenderNodes.BatchHandlerConfig
Description:
The default configuration for this handler.
Source: src/renderer/webgl/renderNodes/BatchHandlerPointLight.js#L55
Since: 4.0.0
Inherited Methods
From Phaser.Renderer.WebGL.RenderNodes.BatchHandler:
From Phaser.Renderer.WebGL.RenderNodes.RenderNode:
Public Methods
batch
<instance> batch(drawingContext, light, xTL, yTL, xBL, yBL, xTR, yTR, xBR, yBR, lightX, lightY)
Description:
Add a light to the batch.
Parameters:
| name | type | optional | description |
|---|---|---|---|
| drawingContext | Phaser.Renderer.WebGL.DrawingContext | No | The current drawing context. |
| light | Phaser.GameObjects.PointLight | No | The light to add to the batch. |
| xTL | number | No | The top-left x-coordinate of the light. |
| yTL | number | No | The top-left y-coordinate of the light. |
| xBL | number | No | The bottom-left x-coordinate of the light. |
| yBL | number | No | The bottom-left y-coordinate of the light. |
| xTR | number | No | The top-right x-coordinate of the light. |
| yTR | number | No | The top-right y-coordinate of the light. |
| xBR | number | No | The bottom-right x-coordinate of the light. |
| yBR | number | No | The bottom-right y-coordinate of the light. |
| lightX | number | No | The world x-coordinate of the light's centre, used by the shader to calculate radial falloff. |
| lightY | number | No | The world y-coordinate of the light's centre, used by the shader to calculate radial falloff. |
Overrides: Phaser.Renderer.WebGL.RenderNodes.BatchHandler#batch
Source: src/renderer/webgl/renderNodes/BatchHandlerPointLight.js#L213
Since: 4.0.0
run
<instance> run(drawingContext)
Description:
Draw then empty the current batch.
This method is called automatically, by either this node or the manager, when the batch is full, or when something else needs to be rendered.
Parameters:
| name | type | optional | description |
|---|---|---|---|
| drawingContext | Phaser.Renderer.WebGL.DrawingContext | No | The current drawing context. |
Overrides: Phaser.Renderer.WebGL.RenderNodes.BatchHandler#run
Source: src/renderer/webgl/renderNodes/BatchHandlerPointLight.js#L163
Since: 4.0.0
setupUniforms
<instance> setupUniforms(drawingContext)
Description:
Update the uniforms for the current shader program.
This method is called automatically when the batch is run.
Parameters:
| name | type | optional | description |
|---|---|---|---|
| drawingContext | Phaser.Renderer.WebGL.DrawingContext | No | The current drawing context. |
Source: src/renderer/webgl/renderNodes/BatchHandlerPointLight.js#L131
Since: 4.0.0