Skip to main content
Version: Phaser v3.88.2

PointLightPipeline

The Point Light Pipeline handles rendering the Point Light Game Objects in WebGL.

The fragment shader it uses can be found in shaders/src/PointLight.frag.

The vertex shader it uses can be found in shaders/src/PointLight.vert.

The default shader attributes for this pipeline are:

inPosition (vec2)

inLightPosition (vec2)

inLightRadius (float)

inLightAttenuation (float)

inLightColor (vec4)

The default shader uniforms for this pipeline are:

uProjectionMatrix (mat4)

uResolution (vec2)

uCameraZoom (sampler2D)

Constructor

new PointLightPipeline(config)

Parameters

nametypeoptionaldescription
configPhaser.Types.Renderer.WebGL.WebGLPipelineConfigNoThe configuration options for this pipeline.

Scope: static

Extends

Phaser.Renderer.WebGL.WebGLPipeline

Source: src/renderer/webgl/pipelines/PointLightPipeline.js#L13
Since: 3.50.0

Inherited Methods

From Phaser.Events.EventEmitter:

From Phaser.Renderer.WebGL.WebGLPipeline:


Public Methods

batchLightVert

<instance> batchLightVert(x, y, lightX, lightY, radius, attenuation, r, g, b, a)

Description:

Adds a single Point Light vertex to the current vertex buffer and increments the

vertexCount property by 1.

This method is called directly by batchPointLight.

Parameters:

nametypeoptionaldescription
xnumberNoThe vertex x position.
ynumberNoThe vertex y position.
lightXnumberNoThe horizontal center of the light.
lightYnumberNoThe vertical center of the light.
radiusnumberNoThe radius of the light.
attenuationnumberNoThe attenuation of the light.
rnumberNoThe red color channel of the light.
gnumberNoThe green color channel of the light.
bnumberNoThe blue color channel of the light.
anumberNoThe alpha color channel of the light.

Source: src/renderer/webgl/pipelines/PointLightPipeline.js#L133
Since: 3.50.0


batchPointLight

<instance> batchPointLight(light, camera, x0, y0, x1, y1, x2, y2, x3, y3, lightX, lightY)

Description:

Adds a Point Light Game Object to the batch, flushing if required.

Parameters:

nametypeoptionaldescription
lightPhaser.GameObjects.PointLightNoThe Point Light Game Object.
cameraPhaser.Cameras.Scene2D.CameraNoThe camera rendering the Point Light.
x0numberNoThe top-left x position.
y0numberNoThe top-left y position.
x1numberNoThe bottom-left x position.
y1numberNoThe bottom-left y position.
x2numberNoThe bottom-right x position.
y2numberNoThe bottom-right y position.
x3numberNoThe top-right x position.
y3numberNoThe top-right y position.
lightXnumberNoThe horizontal center of the light.
lightYnumberNoThe vertical center of the light.

Source: src/renderer/webgl/pipelines/PointLightPipeline.js#L82
Since: 3.50.0


Inherited Members

From Phaser.Renderer.WebGL.WebGLPipeline: