TransformerVertex
A RenderNode that computes and stores the screen-space position of a single vertex each time it is run.
During its run call, this node applies the camera view matrix (adjusted for the game object's scroll factors), any parent container matrix, and the game object's own position, rotation, and scale into a single final transform matrix. It then projects the vertex position through that matrix and writes the result back to the vertex position, ready for consumption by the subsequent submitter node.
Constructor
new TransformerVertex(manager, [config])
Parameters
| name | type | optional | description |
|---|---|---|---|
| manager | Phaser.Renderer.WebGL.RenderNodes.RenderNodeManager | No | The manager that owns this RenderNode. |
| config | object | Yes | The configuration object for this RenderNode. |
Scope: static
Extends
Source: src/renderer/webgl/renderNodes/transformer/TransformerVertex.js#L12
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, gameObject, parentMatrix, vertex)
Description:
Computes the final screen-space position of the given vertex for the given GameObject and stores it in the vertex.
The method builds the complete transform by combining the camera view matrix (modified by the game object's scroll factors), an optional parent container matrix, and the game object's own position, rotation, and scale. If vertex rounding is required, the resulting values are snapped to the nearest integer.
Parameters:
| name | type | optional | description |
|---|---|---|---|
| drawingContext | Phaser.Renderer.WebGL.DrawingContext | No | The current drawing context. |
| gameObject | Phaser.GameObjects.GameObject | No | The GameObject being rendered. |
| parentMatrix | Phaser.GameObjects.Components.TransformMatrix | No | This transform matrix is defined if the game object is nested. |
| vertex | Phaser.Math.Vector2 | No | The vertex to transform. |
Overrides: Phaser.Renderer.WebGL.RenderNodes.RenderNode#run
Source: src/renderer/webgl/renderNodes/transformer/TransformerVertex.js#L79
Since: 4.0.0
setupMatrix
<instance> setupMatrix(drawingContext, gameObject, [parentMatrix])
Description:
Builds the final transform matrix for the given GameObject and caches it, along with whether transformed vertices should be rounded. This combines the camera view matrix (modified by the game object's scroll factors), an optional parent container matrix, and the game object's own position, rotation, and scale.
Call this once before transforming a batch of vertices with transformVertex, since the matrix is constant for all vertices of a single GameObject. This avoids rebuilding the matrix for every vertex.
Parameters:
| name | type | optional | description |
|---|---|---|---|
| drawingContext | Phaser.Renderer.WebGL.DrawingContext | No | The current drawing context. |
| gameObject | Phaser.GameObjects.GameObject | No | The GameObject being rendered. |
| parentMatrix | Phaser.GameObjects.Components.TransformMatrix | Yes | This transform matrix is defined if the game object is nested. |
Returns: Phaser.GameObjects.Components.TransformMatrix - The cached transform matrix.
Source: src/renderer/webgl/renderNodes/transformer/TransformerVertex.js#L105
Since: 4.2.0
transformVertex
<instance> transformVertex(vertex)
Description:
Projects a single vertex through the matrix built by the most recent setupMatrix call, writing the result back to the vertex. If vertex rounding is required, the values are snapped to the nearest integer.
Parameters:
| name | type | optional | description |
|---|---|---|---|
| vertex | Phaser.Math.Vector2 | No | The vertex to transform. |
Returns: Phaser.Math.Vector2 - The transformed vertex.
Source: src/renderer/webgl/renderNodes/transformer/TransformerVertex.js#L158
Since: 4.2.0