Skip to content

Commit 8fc9690

Browse files
committed
GameObject.Vertex is a new micro class that encapsulates all of the data required for a single vertex, such as position, uv, color and alpha. This class is now created internally by the Mesh Game Object.
1 parent 3fa0070 commit 8fc9690

1 file changed

Lines changed: 91 additions & 0 deletions

File tree

src/gameobjects/mesh/Vertex.js

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
/**
2+
* @author Richard Davey <rich@photonstorm.com>
3+
* @copyright 2020 Photon Storm Ltd.
4+
* @license {@link https://opensource.org/licenses/MIT|MIT License}
5+
*/
6+
7+
var Class = require('../../utils/Class');
8+
9+
/**
10+
* @classdesc
11+
* A Vertex Game Object.
12+
*
13+
* This tiny class consists of all the information for a single vertex within a Mesh
14+
* Game Object.
15+
*
16+
* @class Vertex
17+
* @memberof Phaser.GameObjects
18+
* @constructor
19+
* @since 3.50.0
20+
*
21+
* @param {number} x - The x coordinate of this vertex.
22+
* @param {number} y - The y coordinate of this vertex.
23+
* @param {number} u - The UV u coordinate of this vertex.
24+
* @param {number} v - The UV v coordinate of this vertex.
25+
* @param {number} color - The color value of this vertex.
26+
* @param {number} alpha - The alpha value of this vertex.
27+
*/
28+
var Vertex = new Class({
29+
30+
initialize:
31+
32+
function Vertex (x, y, u, v, color, alpha)
33+
{
34+
/**
35+
* The x coordinate of this vertex.
36+
*
37+
* @name Phaser.GameObjects.Vertex#x
38+
* @type {number}
39+
* @since 3.50.0
40+
*/
41+
this.x = x;
42+
43+
/**
44+
* The y coordinate of this vertex.
45+
*
46+
* @name Phaser.GameObjects.Vertex#y
47+
* @type {number}
48+
* @since 3.50.0
49+
*/
50+
this.y = y;
51+
52+
/**
53+
* UV u coordinate of this vertex.
54+
*
55+
* @name Phaser.GameObjects.Vertex#u
56+
* @type {number}
57+
* @since 3.50.0
58+
*/
59+
this.u = u;
60+
61+
/**
62+
* UV v coordinate of this vertex.
63+
*
64+
* @name Phaser.GameObjects.Vertex#v
65+
* @type {number}
66+
* @since 3.50.0
67+
*/
68+
this.v = v;
69+
70+
/**
71+
* The color value of this vertex.
72+
*
73+
* @name Phaser.GameObjects.Vertex#color
74+
* @type {number}
75+
* @since 3.50.0
76+
*/
77+
this.color = color;
78+
79+
/**
80+
* The alpha value of this vertex.
81+
*
82+
* @name Phaser.GameObjects.Vertex#alpha
83+
* @type {number}
84+
* @since 3.50.0
85+
*/
86+
this.alpha = alpha;
87+
}
88+
89+
});
90+
91+
module.exports = Vertex;

0 commit comments

Comments
 (0)