@@ -13,7 +13,7 @@ var Utils = require('../../renderer/webgl/Utils');
1313 * A Vertex Object.
1414 *
1515 * This class consists of all the information needed for a single vertex within
16- * a Model Game Object.
16+ * a Model Object.
1717 *
1818 * @class Vertex
1919 * @memberof Phaser.Geom.Mesh
@@ -37,15 +37,15 @@ var Vertex = new Class({
3737
3838 function Vertex ( x , y , z , u , v , color , alpha )
3939 {
40- Vector3 . call ( this , x , y , z ) ;
41-
4240 if ( color === undefined ) { color = 0xffffff ; }
4341 if ( alpha === undefined ) { alpha = 1 ; }
4442
43+ Vector3 . call ( this , x , y , z ) ;
44+
4545 /**
4646 * The projected x coordinate of this vertex.
4747 *
48- * @name Phaser.GameObjects .Vertex#vx
48+ * @name Phaser.Geom.Mesh .Vertex#vx
4949 * @type {number }
5050 * @since 3.50.0
5151 */
@@ -54,7 +54,7 @@ var Vertex = new Class({
5454 /**
5555 * The projected y coordinate of this vertex.
5656 *
57- * @name Phaser.GameObjects .Vertex#vy
57+ * @name Phaser.Geom.Mesh .Vertex#vy
5858 * @type {number }
5959 * @since 3.50.0
6060 */
@@ -63,7 +63,7 @@ var Vertex = new Class({
6363 /**
6464 * UV u coordinate of this vertex.
6565 *
66- * @name Phaser.GameObjects .Vertex#u
66+ * @name Phaser.Geom.Mesh .Vertex#u
6767 * @type {number }
6868 * @since 3.50.0
6969 */
@@ -72,7 +72,7 @@ var Vertex = new Class({
7272 /**
7373 * UV v coordinate of this vertex.
7474 *
75- * @name Phaser.GameObjects .Vertex#v
75+ * @name Phaser.Geom.Mesh .Vertex#v
7676 * @type {number }
7777 * @since 3.50.0
7878 */
@@ -81,7 +81,7 @@ var Vertex = new Class({
8181 /**
8282 * The color value of this vertex.
8383 *
84- * @name Phaser.GameObjects .Vertex#color
84+ * @name Phaser.Geom.Mesh .Vertex#color
8585 * @type {number }
8686 * @since 3.50.0
8787 */
@@ -90,13 +90,23 @@ var Vertex = new Class({
9090 /**
9191 * The alpha value of this vertex.
9292 *
93- * @name Phaser.GameObjects .Vertex#alpha
93+ * @name Phaser.Geom.Mesh .Vertex#alpha
9494 * @type {number }
9595 * @since 3.50.0
9696 */
9797 this . alpha = alpha ;
9898 } ,
9999
100+ /**
101+ * Transforms this vertex by the given matrix, storing the results in `vx` and `vy`.
102+ *
103+ * @method Phaser.Geom.Mesh.Model#transformCoordinatesLocal
104+ * @since 3.50.0
105+ *
106+ * @param {Phaser.Math.Matrix4 } transformMatrix - The transform matrix to apply to this vertex.
107+ * @param {number } width - The width of the parent Mesh.
108+ * @param {number } height - The height of the parent Mesh.
109+ */
100110 transformCoordinatesLocal : function ( transformMatrix , width , height )
101111 {
102112 var x = this . x ;
@@ -109,10 +119,30 @@ var Vertex = new Class({
109119 var ty = ( x * m [ 1 ] ) + ( y * m [ 5 ] ) + ( z * m [ 9 ] ) + m [ 13 ] ;
110120 var tw = ( x * m [ 3 ] ) + ( y * m [ 7 ] ) + ( z * m [ 11 ] ) + m [ 15 ] ;
111121
112- this . vx = ( tx / tw ) * width + width / 2 ;
113- this . vy = - ( ty / tw ) * height + height / 2 ;
122+ this . vx = ( tx / tw ) * width ;
123+ this . vy = - ( ty / tw ) * height ;
114124 } ,
115125
126+ /**
127+ * Loads this vertex into the given Typed Arrays.
128+ *
129+ * @method Phaser.Geom.Mesh.Model#load
130+ * @since 3.50.0
131+ *
132+ * @param {Float32Array } F32 - The Float32 Array to put the position data in.
133+ * @param {Uint32Array } U32 - The Uint32 Array to put the color data in.
134+ * @param {number } offset - The vertex offset to place the data at.
135+ * @param {number } textureUnit - The currently bound texture unit.
136+ * @param {number } alpha - The alpha value.
137+ * @param {number } a - The transform matrix a value.
138+ * @param {number } b - The transform matrix b value.
139+ * @param {number } c - The transform matrix c value.
140+ * @param {number } d - The transform matrix d value.
141+ * @param {number } e - The transform matrix e value.
142+ * @param {number } f - The transform matrix f value.
143+ *
144+ * @return {number } The new vertex offset.
145+ */
116146 load : function ( F32 , U32 , offset , textureUnit , tintEffect , alpha , a , b , c , d , e , f )
117147 {
118148 F32 [ ++ offset ] = this . vx * a + this . vy * c + e ;
0 commit comments