Skip to main content
Version: Phaser v3.88.2

Vertex

A Vertex Geometry Object.

This class consists of all the information required for a single vertex within a Face Geometry Object.

Faces, and thus Vertex objects, are used by the Mesh Game Object in order to render objects in WebGL.

Constructor

new Vertex(x, y, z, u, v, [color], [alpha], [nx], [ny], [nz])

Parameters

nametypeoptionaldefaultdescription
xnumberNoThe x position of the vertex.
ynumberNoThe y position of the vertex.
znumberNoThe z position of the vertex.
unumberNoThe UV u coordinate of the vertex.
vnumberNoThe UV v coordinate of the vertex.
colornumberYes"0xffffff"The color value of the vertex.
alphanumberYes1The alpha value of the vertex.
nxnumberYes0The x normal value of the vertex.
nynumberYes0The y normal value of the vertex.
nznumberYes0The z normal value of the vertex.

Scope: static

Extends

Phaser.Math.Vector3

Source: src/geom/mesh/Vertex.js#L11
Since: 3.50.0

Inherited Members

From Phaser.Math.Vector3:


Public Members

alpha

alpha: number

Description:

The alpha value of this vertex.

Source: src/geom/mesh/Vertex.js#L133
Since: 3.50.0


color

color: number

Description:

The color value of this vertex.

Source: src/geom/mesh/Vertex.js#L124
Since: 3.50.0


nx

nx: number

Description:

The normalized projected x coordinate of this vertex.

Source: src/geom/mesh/Vertex.js#L79
Since: 3.50.0


ny

ny: number

Description:

The normalized projected y coordinate of this vertex.

Source: src/geom/mesh/Vertex.js#L88
Since: 3.50.0


nz

nz: number

Description:

The normalized projected z coordinate of this vertex.

Source: src/geom/mesh/Vertex.js#L97
Since: 3.50.0


ta

ta: number

Description:

The translated alpha value of this vertex.

Source: src/geom/mesh/Vertex.js#L160
Since: 3.50.0


tu

tu: number

Description:

The translated uv u coordinate of this vertex.

Source: src/geom/mesh/Vertex.js#L169
Since: 3.60.0


tv

tv: number

Description:

The translated uv v coordinate of this vertex.

Source: src/geom/mesh/Vertex.js#L178
Since: 3.60.0


tx

tx: number

Description:

The translated x coordinate of this vertex.

Source: src/geom/mesh/Vertex.js#L142
Since: 3.50.0


ty

ty: number

Description:

The translated y coordinate of this vertex.

Source: src/geom/mesh/Vertex.js#L151
Since: 3.50.0


u

u: number

Description:

UV u coordinate of this vertex.

Source: src/geom/mesh/Vertex.js#L106
Since: 3.50.0


v

v: number

Description:

UV v coordinate of this vertex.

Source: src/geom/mesh/Vertex.js#L115
Since: 3.50.0


vx

vx: number

Description:

The projected x coordinate of this vertex.

Source: src/geom/mesh/Vertex.js#L52
Since: 3.50.0


vy

vy: number

Description:

The projected y coordinate of this vertex.

Source: src/geom/mesh/Vertex.js#L61
Since: 3.50.0


vz

vz: number

Description:

The projected z coordinate of this vertex.

Source: src/geom/mesh/Vertex.js#L70
Since: 3.50.0


Inherited Methods

From Phaser.Math.Vector3:


Public Methods

load

<instance> load(F32, U32, offset, textureUnit, tintEffect)

Description:

Loads the data from this Vertex into the given Typed Arrays.

Parameters:

nametypeoptionaldescription
F32Float32ArrayNoA Float32 Array to insert the position, UV and unit data in to.
U32Uint32ArrayNoA Uint32 Array to insert the color and alpha data in to.
offsetnumberNoThe index of the array to insert this Vertex to.
textureUnitnumberNoThe texture unit currently in use.
tintEffectnumberNoThe tint effect to use.

Returns: number - The new array offset.

Source: src/geom/mesh/Vertex.js#L379
Since: 3.50.0


resize

<instance> resize(x, y, width, height, originX, originY)

Description:

Resizes this Vertex by setting the x and y coordinates, then transforms this vertex

by an identity matrix and dimensions, storing the results in vx, vy and vz.

Parameters:

nametypeoptionaldescription
xnumberNoThe x position of the vertex.
ynumberNoThe y position of the vertex.
widthnumberNoThe width of the parent Mesh.
heightnumberNoThe height of the parent Mesh.
originXnumberNoThe originX of the parent Mesh.
originYnumberNoThe originY of the parent Mesh.

Returns: Phaser.Geom.Mesh.Vertex - This Vertex.

Source: src/geom/mesh/Vertex.js#L298
Since: 3.60.0


scaleUV

<instance> scaleUV(x, y)

Description:

Scales the original UV values by the given amounts.

The original properties Vertex.u and Vertex.v

remain unchanged, only the translated properties

Vertex.tu and Vertex.tv, as used in rendering,

are updated.

Parameters:

nametypeoptionaldescription
xnumberNoThe amount to scale the UV u coordinate by.
ynumberNoThe amount to scale the UV v coordinate by.

Returns: Phaser.Geom.Mesh.Vertex - This Vertex.

Source: src/geom/mesh/Vertex.js#L237
Since: 3.60.0


scrollUV

<instance> scrollUV(x, y)

Description:

Translates the original UV positions by the given amounts.

The original properties Vertex.u and Vertex.v

remain unchanged, only the translated properties

Vertex.tu and Vertex.tv, as used in rendering,

are updated.

Parameters:

nametypeoptionaldescription
xnumberNoThe amount to scroll the UV u coordinate by.
ynumberNoThe amount to scroll the UV v coordinate by.

Returns: Phaser.Geom.Mesh.Vertex - This Vertex.

Source: src/geom/mesh/Vertex.js#L213
Since: 3.60.0


setUVs

<instance> setUVs(u, v)

Description:

Sets the U and V properties.

Also resets the translated uv properties, undoing any scale

or shift they may have had.

Parameters:

nametypeoptionaldescription
unumberNoThe UV u coordinate of the vertex.
vnumberNoThe UV v coordinate of the vertex.

Returns: Phaser.Geom.Mesh.Vertex - This Vertex.

Source: src/geom/mesh/Vertex.js#L188
Since: 3.50.0


transformCoordinatesLocal

<instance> transformCoordinatesLocal(transformMatrix, width, height, cameraZ)

Description:

Transforms this vertex by the given matrix, storing the results in vx, vy and vz.

Parameters:

nametypeoptionaldescription
transformMatrixPhaser.Math.Matrix4NoThe transform matrix to apply to this vertex.
widthnumberNoThe width of the parent Mesh.
heightnumberNoThe height of the parent Mesh.
cameraZnumberNoThe z position of the MeshCamera.

Source: src/geom/mesh/Vertex.js#L261
Since: 3.50.0


update

<instance> update(a, b, c, d, e, f, roundPixels, alpha)

Description:

Updates this Vertex based on the given transform.

Parameters:

nametypeoptionaldescription
anumberNoThe parent transform matrix data a component.
bnumberNoThe parent transform matrix data b component.
cnumberNoThe parent transform matrix data c component.
dnumberNoThe parent transform matrix data d component.
enumberNoThe parent transform matrix data e component.
fnumberNoThe parent transform matrix data f component.
roundPixelsbooleanNoRound the vertex position or not?
alphanumberNoThe alpha of the parent object.

Returns: Phaser.Geom.Mesh.Vertex - This Vertex.

Source: src/geom/mesh/Vertex.js#L344
Since: 3.50.0