Skip to main content
Version: Phaser v4.0.0

FillRect

A RenderNode which renders a solid, flat-colored rectangle into the WebGL render pipeline. It transforms four corner vertices using a provided transform matrix, submits them as two triangles to a BatchHandlerTriFlat node, and supports per-corner tint colors and optional lighting. This node is used for full-screen color fills, background overlays, camera effects, and any rectangle-shaped geometry that does not require a texture.

Constructor

new FillRect(manager)

Parameters

nametypeoptionaldescription
managerPhaser.Renderer.WebGL.RenderNodes.RenderNodeManagerNoThe manager that owns this RenderNode.

Scope: static

Extends

Phaser.Renderer.WebGL.RenderNodes.RenderNode

Source: src/renderer/webgl/renderNodes/FillRect.js#L11
Since: 4.0.0

Inherited Members

From Phaser.Renderer.WebGL.RenderNodes.RenderNode:


Inherited Methods

From Phaser.Renderer.WebGL.RenderNodes.RenderNode:


Public Methods

run

<instance> run(drawingContext, currentMatrix, submitterNode, x, y, width, height, tintTL, tintTR, tintBL, tintBR, lighting)

Description:

Transforms a rectangle's four corner vertices using the given matrix, then submits them as two indexed triangles to the batch handler, along with per-corner tint colors. Call this once per frame for each rectangle you wish to draw; it delegates the actual draw call to the submitter node.

Parameters:

nametypeoptionaldescription
drawingContextPhaser.Renderer.WebGL.DrawingContextNoThe context currently in use.
currentMatrixPhaser.GameObjects.Components.TransformMatrixNoA transform matrix to apply to the vertices. If not defined, the identity matrix is used.
submitterNodePhaser.Renderer.WebGL.RenderNodes.BatchHandlerTriFlatNoThe Submitter node to use. If not defined, BatchHandlerTriFlat is used.
xnumberNoThe x-coordinate of the top-left corner of the rectangle, in pixels.
ynumberNoThe y-coordinate of the top-left corner of the rectangle, in pixels.
widthnumberNoThe width of the rectangle, in pixels.
heightnumberNoThe height of the rectangle, in pixels.
tintTLnumberNoThe top-left tint color.
tintTRnumberNoThe top-right tint color.
tintBLnumberNoThe bottom-left tint color.
tintBRnumberNoThe bottom-right tint color.
lightingbooleanNoWhether to apply lighting effects to the rectangle.

Overrides: Phaser.Renderer.WebGL.RenderNodes.RenderNode#run

Source: src/renderer/webgl/renderNodes/FillRect.js#L71
Since: 4.0.0