Skip to content

Commit 38958d0

Browse files
committed
We need the z axis
1 parent 8ca1730 commit 38958d0

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

src/geom/mesh/Vertex.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,15 @@ var Vertex = new Class({
6060
*/
6161
this.vy = 0;
6262

63+
/**
64+
* The projected z coordinate of this vertex.
65+
*
66+
* @name Phaser.Geom.Mesh.Vertex#vz
67+
* @type {number}
68+
* @since 3.50.0
69+
*/
70+
this.vz = 0;
71+
6372
/**
6473
* UV u coordinate of this vertex.
6574
*
@@ -98,7 +107,7 @@ var Vertex = new Class({
98107
},
99108

100109
/**
101-
* Transforms this vertex by the given matrix, storing the results in `vx` and `vy`.
110+
* Transforms this vertex by the given matrix, storing the results in `vx`, `vy` and `vz`.
102111
*
103112
* @method Phaser.Geom.Mesh.Model#transformCoordinatesLocal
104113
* @since 3.50.0
@@ -117,10 +126,12 @@ var Vertex = new Class({
117126

118127
var tx = (x * m[0]) + (y * m[4]) + (z * m[8]) + m[12];
119128
var ty = (x * m[1]) + (y * m[5]) + (z * m[9]) + m[13];
129+
var tz = (x * m[2]) + (y * m[6]) + (z * m[10]) + m[14];
120130
var tw = (x * m[3]) + (y * m[7]) + (z * m[11]) + m[15];
121131

122132
this.vx = (tx / tw) * width;
123133
this.vy = -(ty / tw) * height;
134+
this.vz = (tz / tw);
124135
},
125136

126137
/**

0 commit comments

Comments
 (0)