Class: ForwardDiffuseLightPipeline

Phaser.Renderer.WebGL.Pipelines. ForwardDiffuseLightPipeline

ForwardDiffuseLightPipeline implements a forward rendering approach for 2D lights. This pipeline extends TextureTintPipeline so it implements all it's rendering functions and batching system.


new ForwardDiffuseLightPipeline(config)

Parameters:
Name Type Description
config object

The configuration of the pipeline, same as the Phaser.Renderer.WebGL.Pipelines.TextureTintPipeline. The fragment shader will be replaced with the lighting shader.

Since: 3.0.0
Source: src/renderer/webgl/pipelines/ForwardDiffuseLightPipeline.js (Line 14)

Extends

Members


active :boolean

Indicates if the current pipeline is active or not for this frame only. Reset in the onRender method.

Type:
  • boolean
Since: 3.10.0
Inherited From:
Source: src/renderer/webgl/WebGLPipeline.js (Line 230)

attributes :object

Array of objects that describe the vertex attributes

Type:
  • object
Since: 3.0.0
Inherited From:
Source: src/renderer/webgl/WebGLPipeline.js (Line 174)

batches :array

Collection of batch information

Type:
  • array
Since: 3.1.0
Inherited From:
Source: src/renderer/webgl/pipelines/TextureTintPipeline.js (Line 124)

bytes :Uint8Array

Uint8 view to the vertex raw buffer. Used for uploading vertex buffer resources to the GPU.

Type:
  • Uint8Array
Since: 3.0.0
Inherited From:
Source: src/renderer/webgl/WebGLPipeline.js (Line 201)

flushLocked :boolean

Indicates if the current pipeline is flushing the contents to the GPU. When the variable is set the flush function will be locked.

Type:
  • boolean
Since: 3.1.0
Inherited From:
Source: src/renderer/webgl/WebGLPipeline.js (Line 220)

game :Phaser.Game

The Game which owns this WebGL Pipeline.

Type:
Since: 3.0.0
Inherited From:
Source: src/renderer/webgl/WebGLPipeline.js (Line 65)

gl :WebGLRenderingContext

The WebGL context this WebGL Pipeline uses.

Type:
  • WebGLRenderingContext
Since: 3.0.0
Inherited From:
Source: src/renderer/webgl/WebGLPipeline.js (Line 110)

height :number

Height of the current viewport

Type:
  • number
Since: 3.0.0
Inherited From:
Source: src/renderer/webgl/WebGLPipeline.js (Line 101)

maxQuads :integer

Size of the batch.

Type:
  • integer
Since: 3.0.0
Inherited From:
Source: src/renderer/webgl/pipelines/TextureTintPipeline.js (Line 115)

name :string

Name of the Pipeline. Used for identifying

Type:
  • string
Since: 3.0.0
Inherited From:
Source: src/renderer/webgl/WebGLPipeline.js (Line 56)

program :WebGLProgram

The handle to a WebGL program

Type:
  • WebGLProgram
Since: 3.0.0
Inherited From:
Source: src/renderer/webgl/WebGLPipeline.js (Line 165)

renderer :Phaser.Renderer.WebGL.WebGLRenderer

The WebGL Renderer which owns this WebGL Pipeline.

Type:
Since: 3.0.0
Inherited From:
Source: src/renderer/webgl/WebGLPipeline.js (Line 138)

resolution :number

Used to store the current game resolution

Type:
  • number
Since: 3.0.0
Inherited From:
Source: src/renderer/webgl/WebGLPipeline.js (Line 83)

topology :integer

The primitive topology which the pipeline will use to submit draw calls

Type:
  • integer
Since: 3.0.0
Inherited From:
Source: src/renderer/webgl/WebGLPipeline.js (Line 192)

vertexBuffer :WebGLBuffer

The handle to a WebGL vertex buffer object.

Type:
  • WebGLBuffer
Since: 3.0.0
Inherited From:
Source: src/renderer/webgl/WebGLPipeline.js (Line 156)

vertexCapacity :integer

The limit of vertices that the pipeline can hold

Type:
  • integer
Since: 3.0.0
Inherited From:
Source: src/renderer/webgl/WebGLPipeline.js (Line 129)

vertexComponentCount :integer

This will store the amount of components of 32 bit length

Type:
  • integer
Since: 3.0.0
Inherited From:
Source: src/renderer/webgl/WebGLPipeline.js (Line 211)

vertexCount :number

How many vertices have been fed to the current pipeline.

Type:
  • number
Since: 3.0.0
Inherited From:
Default Value:
  • 0
Source: src/renderer/webgl/WebGLPipeline.js (Line 119)

vertexData :ArrayBuffer

Raw byte buffer of vertices.

Type:
  • ArrayBuffer
Since: 3.0.0
Inherited From:
Source: src/renderer/webgl/WebGLPipeline.js (Line 147)

vertexSize :integer

The size in bytes of the vertex

Type:
  • integer
Since: 3.0.0
Inherited From:
Source: src/renderer/webgl/WebGLPipeline.js (Line 183)

vertexViewF32 :Float32Array

Float32 view of the array buffer containing the pipeline's vertices.

Type:
  • Float32Array
Since: 3.0.0
Inherited From:
Source: src/renderer/webgl/pipelines/TextureTintPipeline.js (Line 97)

vertexViewU32 :Uint32Array

Uint32 view of the array buffer containing the pipeline's vertices.

Type:
  • Uint32Array
Since: 3.0.0
Inherited From:
Source: src/renderer/webgl/pipelines/TextureTintPipeline.js (Line 106)

view :HTMLCanvasElement

The canvas which this WebGL Pipeline renders to.

Type:
  • HTMLCanvasElement
Since: 3.0.0
Inherited From:
Source: src/renderer/webgl/WebGLPipeline.js (Line 74)

width :number

Width of the current viewport

Type:
  • number
Since: 3.0.0
Inherited From:
Source: src/renderer/webgl/WebGLPipeline.js (Line 92)

Methods


addAttribute(name, size, type, normalized, offset)

Adds a description of vertex attribute to the pipeline

Parameters:
Name Type Description
name string

Name of the vertex attribute

size integer

Vertex component size

type integer

Type of the attribute

normalized boolean

Is the value normalized to a range

offset integer

Byte offset to the beginning of the first element in the vertex

Since: 3.2.0
Inherited From:
Source: src/renderer/webgl/WebGLPipeline.js (Line 254)
Returns:

This WebGLPipeline instance.

Type
Phaser.Renderer.WebGL.Pipelines.ForwardDiffuseLightPipeline

batchFillPath(path, currentMatrix, parentMatrix)

Adds the given path to the vertex batch for rendering.

It works by taking the array of path data and then passing it through Earcut, which creates a list of polygons. Each polygon is then added to the batch.

The path is always automatically closed because it's filled.

Parameters:
Name Type Description
path array

Collection of points that represent the path.

currentMatrix Phaser.GameObjects.Components.TransformMatrix

The current transform.

parentMatrix Phaser.GameObjects.Components.TransformMatrix

The parent transform.

Since: 3.12.0
Inherited From:
Source: src/renderer/webgl/pipelines/TextureTintPipeline.js (Line 1254)

batchFillRect(x, y, width, height, currentMatrix, parentMatrix)

Pushes a filled rectangle into the vertex batch. Rectangle factors in the given transform matrices before adding to the batch.

Parameters:
Name Type Description
x number

Horizontal top left coordinate of the rectangle.

y number

Vertical top left coordinate of the rectangle.

width number

Width of the rectangle.

height number

Height of the rectangle.

currentMatrix Phaser.GameObjects.Components.TransformMatrix

The current transform.

parentMatrix Phaser.GameObjects.Components.TransformMatrix

The parent transform.

Since: 3.12.0
Inherited From:
Source: src/renderer/webgl/pipelines/TextureTintPipeline.js (Line 1115)

batchFillTriangle(x0, y0, x1, y1, x2, y2, currentMatrix, parentMatrix)

Pushes a filled triangle into the vertex batch. Triangle factors in the given transform matrices before adding to the batch.

Parameters:
Name Type Description
x0 number

Point 0 x coordinate.

y0 number

Point 0 y coordinate.

x1 number

Point 1 x coordinate.

y1 number

Point 1 y coordinate.

x2 number

Point 2 x coordinate.

y2 number

Point 2 y coordinate.

currentMatrix Phaser.GameObjects.Components.TransformMatrix

The current transform.

parentMatrix Phaser.GameObjects.Components.TransformMatrix

The parent transform.

Since: 3.12.0
Inherited From:
Source: src/renderer/webgl/pipelines/TextureTintPipeline.js (Line 1166)

batchLine(ax, ay, bx, by, aLineWidth, bLineWidth, currentMatrix)

Creates a quad and adds it to the vertex batch based on the given line values.

Parameters:
Name Type Description
ax number

X coordinate to the start of the line

ay number

Y coordinate to the start of the line

bx number

X coordinate to the end of the line

by number

Y coordinate to the end of the line

aLineWidth number

Width of the start of the line

bLineWidth number

Width of the end of the line

currentMatrix Float32Array

Parent matrix, generally used by containers

Since: 3.12.0
Inherited From:
Source: src/renderer/webgl/pipelines/TextureTintPipeline.js (Line 1383)

batchQuad(x0, y0, x1, y1, x2, y2, x3, y3, u0, v0, u1, v1, tintTL, tintTR, tintBL, tintBR, tintEffect [, texture] [, unit])

Adds the vertices data into the batch and flushes if full.

Assumes 6 vertices in the following arrangement:

0----3
|\  B|
| \  |
|  \ |
| A \|
|    \
1----2

Where tx0/ty0 = 0, tx1/ty1 = 1, tx2/ty2 = 2 and tx3/ty3 = 3

Parameters:
Name Type Argument Default Description
x0 number

The top-left x position.

y0 number

The top-left y position.

x1 number

The bottom-left x position.

y1 number

The bottom-left y position.

x2 number

The bottom-right x position.

y2 number

The bottom-right y position.

x3 number

The top-right x position.

y3 number

The top-right y position.

u0 number

UV u0 value.

v0 number

UV v0 value.

u1 number

UV u1 value.

v1 number

UV v1 value.

tintTL number

The top-left tint color value.

tintTR number

The top-right tint color value.

tintBL number

The bottom-left tint color value.

tintBR number

The bottom-right tint color value.

tintEffect number | boolean

The tint effect for the shader to use.

texture WebGLTexture <optional>

WebGLTexture that will be assigned to the current batch if a flush occurs.

unit integer <optional>
0

Texture unit to which the texture needs to be bound.

Since: 3.12.0
Inherited From:
Source: src/renderer/webgl/pipelines/TextureTintPipeline.js (Line 659)
Returns:

true if this method caused the batch to flush, otherwise false.

Type
boolean

batchSprite(sprite, camera, parentTransformMatrix)

Takes a Sprite Game Object, or any object that extends it, which has a normal texture and adds it to the batch.

Parameters:
Name Type Description
sprite Phaser.GameObjects.Sprite

The texture-based Game Object to add to the batch.

camera Phaser.Cameras.Scene2D.Camera

The Camera to use for the rendering transform.

parentTransformMatrix Phaser.GameObjects.Components.TransformMatrix

The transform matrix of the parent container, if set.

Since: 3.0.0
Overrides:
Source: src/renderer/webgl/pipelines/ForwardDiffuseLightPipeline.js (Line 474)

batchStrokePath(path, lineWidth, pathOpen, currentMatrix, parentMatrix)

Adds the given path to the vertex batch for rendering.

It works by taking the array of path data and calling batchLine for each section of the path.

The path is optionally closed at the end.

Parameters:
Name Type Description
path array

Collection of points that represent the path.

lineWidth number

The width of the line segments in pixels.

pathOpen boolean

Indicates if the path should be closed or left open.

currentMatrix Phaser.GameObjects.Components.TransformMatrix

The current transform.

parentMatrix Phaser.GameObjects.Components.TransformMatrix

The parent transform.

Since: 3.12.0
Inherited From:
Source: src/renderer/webgl/pipelines/TextureTintPipeline.js (Line 1335)

batchStrokeTriangle(x0, y0, x1, y1, x2, y2, lineWidth, currentMatrix, parentMatrix)

Pushes a stroked triangle into the vertex batch. Triangle factors in the given transform matrices before adding to the batch. The triangle is created from 3 lines and drawn using the batchStrokePath method.

Parameters:
Name Type Description
x0 number

Point 0 x coordinate.

y0 number

Point 0 y coordinate.

x1 number

Point 1 x coordinate.

y1 number

Point 1 y coordinate.

x2 number

Point 2 x coordinate.

y2 number

Point 2 y coordinate.

lineWidth number

The width of the line in pixels.

currentMatrix Phaser.GameObjects.Components.TransformMatrix

The current transform.

parentMatrix Phaser.GameObjects.Components.TransformMatrix

The parent transform.

Since: 3.12.0
Inherited From:
Source: src/renderer/webgl/pipelines/TextureTintPipeline.js (Line 1213)

batchTexture(gameObject, texture, textureWidth, textureHeight, srcX, srcY, srcWidth, srcHeight, scaleX, scaleY, rotation, flipX, flipY, scrollFactorX, scrollFactorY, displayOriginX, displayOriginY, frameX, frameY, frameWidth, frameHeight, tintTL, tintTR, tintBL, tintBR, tintEffect, uOffset, vOffset, camera, parentTransformMatrix)

Generic function for batching a textured quad

Parameters:
Name Type Description
gameObject Phaser.GameObjects.GameObject

Source GameObject

texture WebGLTexture

Raw WebGLTexture associated with the quad

textureWidth integer

Real texture width

textureHeight integer

Real texture height

srcX number

X coordinate of the quad

srcY number

Y coordinate of the quad

srcWidth number

Width of the quad

srcHeight number

Height of the quad

scaleX number

X component of scale

scaleY number

Y component of scale

rotation number

Rotation of the quad

flipX boolean

Indicates if the quad is horizontally flipped

flipY boolean

Indicates if the quad is vertically flipped

scrollFactorX number

By which factor is the quad affected by the camera horizontal scroll

scrollFactorY number

By which factor is the quad effected by the camera vertical scroll

displayOriginX number

Horizontal origin in pixels

displayOriginY number

Vertical origin in pixels

frameX number

X coordinate of the texture frame

frameY number

Y coordinate of the texture frame

frameWidth number

Width of the texture frame

frameHeight number

Height of the texture frame

tintTL integer

Tint for top left

tintTR integer

Tint for top right

tintBL integer

Tint for bottom left

tintBR integer

Tint for bottom right

tintEffect number

The tint effect (0 for additive, 1 for replacement)

uOffset number

Horizontal offset on texture coordinate

vOffset number

Vertical offset on texture coordinate

camera Phaser.Cameras.Scene2D.Camera

Current used camera

parentTransformMatrix Phaser.GameObjects.Components.TransformMatrix

Parent container

Since: 3.0.0
Overrides:
Source: src/renderer/webgl/pipelines/ForwardDiffuseLightPipeline.js (Line 180)

batchTextureFrame(frame, x, y, tint, alpha, transformMatrix [, parentTransformMatrix])

Adds a Texture Frame into the batch for rendering.

Parameters:
Name Type Argument Description
frame Phaser.Textures.Frame

The Texture Frame to be rendered.

x number

The horizontal position to render the texture at.

y number

The vertical position to render the texture at.

tint number

The tint color.

alpha number

The alpha value.

transformMatrix Phaser.GameObjects.Components.TransformMatrix

The Transform Matrix to use for the texture.

parentTransformMatrix Phaser.GameObjects.Components.TransformMatrix <optional>

A parent Transform Matrix.

Since: 3.12.0
Inherited From:
Source: src/renderer/webgl/pipelines/TextureTintPipeline.js (Line 1030)

batchTri(x1, y1, x2, y2, x3, y3, u0, v0, u1, v1, tintTL, tintTR, tintBL, tintEffect [, texture] [, unit])

Adds the vertices data into the batch and flushes if full.

Assumes 3 vertices in the following arrangement:

0
|\
| \
|  \
|   \
|    \
1-----2
Parameters:
Name Type Argument Default Description
x1 number

The bottom-left x position.

y1 number

The bottom-left y position.

x2 number

The bottom-right x position.

y2 number

The bottom-right y position.

x3 number

The top-right x position.

y3 number

The top-right y position.

u0 number

UV u0 value.

v0 number

UV v0 value.

u1 number

UV u1 value.

v1 number

UV v1 value.

tintTL number

The top-left tint color value.

tintTR number

The top-right tint color value.

tintBL number

The bottom-left tint color value.

tintEffect number | boolean

The tint effect for the shader to use.

texture WebGLTexture <optional>

WebGLTexture that will be assigned to the current batch if a flush occurs.

unit integer <optional>
0

Texture unit to which the texture needs to be bound.

Since: 3.12.0
Inherited From:
Source: src/renderer/webgl/pipelines/TextureTintPipeline.js (Line 766)
Returns:

true if this method caused the batch to flush, otherwise false.

Type
boolean

bind()

Binds the pipeline resources, including programs, vertex buffers and binds attributes

Since: 3.0.0
Inherited From:
Source: src/renderer/webgl/WebGLPipeline.js (Line 319)
Returns:

This WebGLPipeline instance.

Type
Phaser.Renderer.WebGL.Pipelines.ForwardDiffuseLightPipeline

boot()

Called when the Game has fully booted and the Renderer has finished setting up.

By this stage all Game level systems are now in place and you can perform any final tasks that the pipeline may need that relied on game systems such as the Texture Manager.

Since: 3.11.0
Inherited From:
Overrides:
Source: src/renderer/webgl/WebGLPipeline.js (Line 241)

destroy()

Removes all object references in this WebGL Pipeline and removes its program from the WebGL context.

Since: 3.0.0
Inherited From:
Source: src/renderer/webgl/WebGLPipeline.js (Line 454)
Returns:

This WebGLPipeline instance.

Type
Phaser.Renderer.WebGL.Pipelines.ForwardDiffuseLightPipeline

drawFillRect(x, y, width, height, color, alpha)

Pushes a filled rectangle into the vertex batch. Rectangle has no transform values and isn't transformed into the local space. Used for directly batching untransformed rectangles, such as Camera background colors.

Parameters:
Name Type Description
x number

Horizontal top left coordinate of the rectangle.

y number

Vertical top left coordinate of the rectangle.

width number

Width of the rectangle.

height number

Height of the rectangle.

color number

Color of the rectangle to draw.

alpha number

Alpha value of the rectangle to draw.

Since: 3.12.0
Inherited From:
Source: src/renderer/webgl/pipelines/TextureTintPipeline.js (Line 1088)

flush()

Uploads the vertex data and emits a draw call for the current batch of vertices.

Since: 3.0.0
Inherited From:
Source: src/renderer/webgl/pipelines/TextureTintPipeline.js (Line 392)
Returns:

This WebGLPipeline instance.

Type
Phaser.Renderer.WebGL.Pipelines.ForwardDiffuseLightPipeline

onBind()

Called every time the pipeline needs to be used. It binds all necessary resources.

Since: 3.0.0
Inherited From:
Overrides:
Source: src/renderer/webgl/pipelines/TextureTintPipeline.js (Line 266)
Returns:

This WebGLPipeline instance.

Type
Phaser.Renderer.WebGL.Pipelines.ForwardDiffuseLightPipeline

onPostRender()

Called after each frame has been completely rendered and snapshots have been taken.

Since: 3.0.0
Inherited From:
Source: src/renderer/webgl/WebGLPipeline.js (Line 405)
Returns:

This WebGLPipeline instance.

Type
Phaser.Renderer.WebGL.Pipelines.ForwardDiffuseLightPipeline

onPreRender()

Called before each frame is rendered, but after the canvas has been cleared.

Since: 3.0.0
Inherited From:
Source: src/renderer/webgl/WebGLPipeline.js (Line 374)
Returns:

This WebGLPipeline instance.

Type
Phaser.Renderer.WebGL.Pipelines.ForwardDiffuseLightPipeline

onRender(scene, camera)

This function sets all the needed resources for each camera pass.

Parameters:
Name Type Description
scene Phaser.Scene

The Scene being rendered.

camera Phaser.Cameras.Scene2D.Camera

The Scene Camera being rendered with.

Since: 3.0.0
Overrides:
Source: src/renderer/webgl/pipelines/ForwardDiffuseLightPipeline.js (Line 113)
Returns:

This WebGLPipeline instance.

Type
Phaser.Renderer.WebGL.Pipelines.ForwardDiffuseLightPipeline

pushBatch(texture, unit)

Creates a new batch object and pushes it to a batch array. The batch object contains information relevant to the current vertex batch like the offset in the vertex buffer, vertex count and the textures used by that batch.

Parameters:
Name Type Description
texture WebGLTexture

Optional WebGLTexture that will be assigned to the created batch.

unit integer

Texture unit to which the texture needs to be bound.

Since: 3.1.0
Inherited From:
Source: src/renderer/webgl/pipelines/TextureTintPipeline.js (Line 356)

requireTextureBatch(texture, unit)

Checks if the current batch has the same texture and texture unit, or if we need to create a new batch.

Parameters:
Name Type Description
texture WebGLTexture

WebGLTexture that will be assigned to the current batch. If not given uses blankTexture.

unit integer

Texture unit to which the texture needs to be bound.

Since: 3.16.0
Inherited From:
Source: src/renderer/webgl/pipelines/TextureTintPipeline.js (Line 329)
Returns:

true if the pipeline needs to create a new batch, otherwise false.

Type
boolean

resize(width, height, resolution)

Resizes this pipeline and updates the projection.

Parameters:
Name Type Description
width number

The new width.

height number

The new height.

resolution number

The resolution.

Since: 3.0.0
Inherited From:
Source: src/renderer/webgl/pipelines/TextureTintPipeline.js (Line 284)
Returns:

This WebGLPipeline instance.

Type
Phaser.Renderer.WebGL.Pipelines.ForwardDiffuseLightPipeline

setFloat1(name, x)

Set a uniform value of the current pipeline program.

Parameters:
Name Type Description
name string

The name of the uniform to look-up and modify.

x number

The new value of the float uniform.

Since: 3.2.0
Inherited From:
Source: src/renderer/webgl/WebGLPipeline.js (Line 476)
Returns:

This WebGLPipeline instance.

Type
Phaser.Renderer.WebGL.Pipelines.ForwardDiffuseLightPipeline

setFloat1v(name, arr)

Set a uniform value of the current pipeline program.

Parameters:
Name Type Description
name string

The name of the uniform to look-up and modify.

arr Float32Array

The new value to be used for the uniform variable.

Since: 3.13.0
Inherited From:
Source: src/renderer/webgl/WebGLPipeline.js (Line 554)
Returns:

This WebGLPipeline instance.

Type
Phaser.Renderer.WebGL.Pipelines.ForwardDiffuseLightPipeline

setFloat2(name, x, y)

Set a uniform value of the current pipeline program.

Parameters:
Name Type Description
name string

The name of the uniform to look-up and modify.

x number

The new X component of the vec2 uniform.

y number

The new Y component of the vec2 uniform.

Since: 3.2.0
Inherited From:
Source: src/renderer/webgl/WebGLPipeline.js (Line 494)
Returns:

This WebGLPipeline instance.

Type
Phaser.Renderer.WebGL.Pipelines.ForwardDiffuseLightPipeline

setFloat2v(name, arr)

Set a uniform value of the current pipeline program.

Parameters:
Name Type Description
name string

The name of the uniform to look-up and modify.

arr Float32Array

The new value to be used for the uniform variable.

Since: 3.13.0
Inherited From:
Source: src/renderer/webgl/WebGLPipeline.js (Line 572)
Returns:

This WebGLPipeline instance.

Type
Phaser.Renderer.WebGL.Pipelines.ForwardDiffuseLightPipeline

setFloat3(name, x, y, z)

Set a uniform value of the current pipeline program.

Parameters:
Name Type Description
name string

The name of the uniform to look-up and modify.

x number

The new X component of the vec3 uniform.

y number

The new Y component of the vec3 uniform.

z number

The new Z component of the vec3 uniform.

Since: 3.2.0
Inherited From:
Source: src/renderer/webgl/WebGLPipeline.js (Line 513)
Returns:

This WebGLPipeline instance.

Type
Phaser.Renderer.WebGL.Pipelines.ForwardDiffuseLightPipeline

setFloat3v(name, arr)

Set a uniform value of the current pipeline program.

Parameters:
Name Type Description
name string

The name of the uniform to look-up and modify.

arr Float32Array

The new value to be used for the uniform variable.

Since: 3.13.0
Inherited From:
Source: src/renderer/webgl/WebGLPipeline.js (Line 590)
Returns:

This WebGLPipeline instance.

Type
Phaser.Renderer.WebGL.Pipelines.ForwardDiffuseLightPipeline

setFloat4(name, x, y, z, w)

Set a uniform value of the current pipeline program.

Parameters:
Name Type Description
name string

The name of the uniform to look-up and modify.

x number

X component of the uniform

y number

Y component of the uniform

z number

Z component of the uniform

w number

W component of the uniform

Since: 3.2.0
Inherited From:
Source: src/renderer/webgl/WebGLPipeline.js (Line 533)
Returns:

This WebGLPipeline instance.

Type
Phaser.Renderer.WebGL.Pipelines.ForwardDiffuseLightPipeline

setFloat4v(name, arr)

Set a uniform value of the current pipeline program.

Parameters:
Name Type Description
name string

The name of the uniform to look-up and modify.

arr Float32Array

The new value to be used for the uniform variable.

Since: 3.13.0
Inherited From:
Source: src/renderer/webgl/WebGLPipeline.js (Line 608)
Returns:

This WebGLPipeline instance.

Type
Phaser.Renderer.WebGL.Pipelines.ForwardDiffuseLightPipeline

setInt1(name, x)

Set a uniform value of the current pipeline program.

Parameters:
Name Type Description
name string

The name of the uniform to look-up and modify.

x integer

The new value of the int uniform.

Since: 3.2.0
Inherited From:
Source: src/renderer/webgl/WebGLPipeline.js (Line 626)
Returns:

This WebGLPipeline instance.

Type
Phaser.Renderer.WebGL.Pipelines.ForwardDiffuseLightPipeline

setInt2(name, x, y)

Set a uniform value of the current pipeline program.

Parameters:
Name Type Description
name string

The name of the uniform to look-up and modify.

x integer

The new X component of the ivec2 uniform.

y integer

The new Y component of the ivec2 uniform.

Since: 3.2.0
Inherited From:
Source: src/renderer/webgl/WebGLPipeline.js (Line 644)
Returns:

This WebGLPipeline instance.

Type
Phaser.Renderer.WebGL.Pipelines.ForwardDiffuseLightPipeline

setInt3(name, x, y, z)

Set a uniform value of the current pipeline program.

Parameters:
Name Type Description
name string

The name of the uniform to look-up and modify.

x integer

The new X component of the ivec3 uniform.

y integer

The new Y component of the ivec3 uniform.

z integer

The new Z component of the ivec3 uniform.

Since: 3.2.0
Inherited From:
Source: src/renderer/webgl/WebGLPipeline.js (Line 663)
Returns:

This WebGLPipeline instance.

Type
Phaser.Renderer.WebGL.Pipelines.ForwardDiffuseLightPipeline

setInt4(name, x, y, z, w)

Set a uniform value of the current pipeline program.

Parameters:
Name Type Description
name string

The name of the uniform to look-up and modify.

x integer

X component of the uniform

y integer

Y component of the uniform

z integer

Z component of the uniform

w integer

W component of the uniform

Since: 3.2.0
Inherited From:
Source: src/renderer/webgl/WebGLPipeline.js (Line 683)
Returns:

This WebGLPipeline instance.

Type
Phaser.Renderer.WebGL.Pipelines.ForwardDiffuseLightPipeline

setMatrix2(name, transpose, matrix)

Set a uniform value of the current pipeline program.

Parameters:
Name Type Description
name string

The name of the uniform to look-up and modify.

transpose boolean

Whether to transpose the matrix. Should be false.

matrix Float32Array

The new values for the mat2 uniform.

Since: 3.2.0
Inherited From:
Source: src/renderer/webgl/WebGLPipeline.js (Line 704)
Returns:

This WebGLPipeline instance.

Type
Phaser.Renderer.WebGL.Pipelines.ForwardDiffuseLightPipeline

setMatrix3(name, transpose, matrix)

Set a uniform value of the current pipeline program.

Parameters:
Name Type Description
name string

The name of the uniform to look-up and modify.

transpose boolean

Whether to transpose the matrix. Should be false.

matrix Float32Array

The new values for the mat3 uniform.

Since: 3.2.0
Inherited From:
Source: src/renderer/webgl/WebGLPipeline.js (Line 723)
Returns:

This WebGLPipeline instance.

Type
Phaser.Renderer.WebGL.Pipelines.ForwardDiffuseLightPipeline

setMatrix4(name, transpose, matrix)

Set a uniform value of the current pipeline program.

Parameters:
Name Type Description
name string

The name of the uniform to look-up and modify.

transpose boolean

Should the matrix be transpose

matrix Float32Array

Matrix data

Since: 3.2.0
Inherited From:
Source: src/renderer/webgl/WebGLPipeline.js (Line 742)
Returns:

This WebGLPipeline instance.

Type
Phaser.Renderer.WebGL.Pipelines.ForwardDiffuseLightPipeline

setNormalMap(gameObject)

Sets the Game Objects normal map as the active texture.

Parameters:
Name Type Description
gameObject Phaser.GameObjects.GameObject

The Game Object to update.

Since: 3.11.0
Source: src/renderer/webgl/pipelines/ForwardDiffuseLightPipeline.js (Line 400)

setNormalMapRotation(rotation)

Rotates the normal map vectors inversely by the given angle. Only works in 2D space.

Parameters:
Name Type Description
rotation number

The angle of rotation in radians.

Since: 3.16.0
Source: src/renderer/webgl/pipelines/ForwardDiffuseLightPipeline.js (Line 432)

setTexture2D( [texture] [, unit])

Assigns a texture to the current batch. If a different texture is already set it creates a new batch object.

Parameters:
Name Type Argument Default Description
texture WebGLTexture <optional>

WebGLTexture that will be assigned to the current batch. If not given uses blankTexture.

unit integer <optional>
0

Texture unit to which the texture needs to be bound.

Since: 3.1.0
Inherited From:
Source: src/renderer/webgl/pipelines/TextureTintPipeline.js (Line 305)
Returns:

This pipeline instance.

Type
Phaser.Renderer.WebGL.Pipelines.TextureTintPipeline

shouldFlush()

Check if the current batch of vertices is full.

Since: 3.0.0
Inherited From:
Source: src/renderer/webgl/WebGLPipeline.js (Line 285)
Returns:

true if the current batch should be flushed, otherwise false.

Type
boolean