mirror of
https://github.com/photonstorm/phaser
synced 2025-02-16 22:18:29 +00:00
Updated docs and added load
method
This commit is contained in:
parent
dd28a11c93
commit
229d27dc9e
1 changed files with 45 additions and 8 deletions
|
@ -5,6 +5,7 @@
|
|||
*/
|
||||
|
||||
var Class = require('../../utils/Class');
|
||||
var Utils = require('../../renderer/webgl/Utils');
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
|
@ -18,19 +19,23 @@ var Class = require('../../utils/Class');
|
|||
* @constructor
|
||||
* @since 3.50.0
|
||||
*
|
||||
* @param {number} x - The x coordinate of this vertex.
|
||||
* @param {number} y - The y coordinate of this vertex.
|
||||
* @param {number} u - The UV u coordinate of this vertex.
|
||||
* @param {number} v - The UV v coordinate of this vertex.
|
||||
* @param {number} color - The color value of this vertex.
|
||||
* @param {number} alpha - The alpha value of this vertex.
|
||||
* @param {number} x - The x position of the vertex.
|
||||
* @param {number} y - The y position of the vertex.
|
||||
* @param {number} z - The z position of the vertex.
|
||||
* @param {number} u - The UV u coordinate of the vertex.
|
||||
* @param {number} v - The UV v coordinate of the vertex.
|
||||
* @param {number} [color=0xffffff] - The color value of the vertex.
|
||||
* @param {number} [alpha=1] - The alpha value of the vertex.
|
||||
*/
|
||||
var Vertex = new Class({
|
||||
|
||||
initialize:
|
||||
|
||||
function Vertex (x, y, u, v, color, alpha)
|
||||
function Vertex (x, y, z, u, v, color, alpha)
|
||||
{
|
||||
if (color === undefined) { color = 0xffffff; }
|
||||
if (alpha === undefined) { alpha = 1; }
|
||||
|
||||
/**
|
||||
* The x coordinate of this vertex.
|
||||
*
|
||||
|
@ -49,6 +54,15 @@ var Vertex = new Class({
|
|||
*/
|
||||
this.y = y;
|
||||
|
||||
/**
|
||||
* The z coordinate of this vertex.
|
||||
*
|
||||
* @name Phaser.GameObjects.Vertex#z
|
||||
* @type {number}
|
||||
* @since 3.50.0
|
||||
*/
|
||||
this.z = z;
|
||||
|
||||
/**
|
||||
* UV u coordinate of this vertex.
|
||||
*
|
||||
|
@ -86,10 +100,11 @@ var Vertex = new Class({
|
|||
this.alpha = alpha;
|
||||
},
|
||||
|
||||
setPosition: function (x, y)
|
||||
setPosition: function (x, y, z)
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
|
||||
return this;
|
||||
},
|
||||
|
@ -100,6 +115,28 @@ var Vertex = new Class({
|
|||
|
||||
this.x += x;
|
||||
this.y += y;
|
||||
},
|
||||
|
||||
load: function (F32, U32, offset, textureUnit, tintEffect, alpha, a, b, c, d, e, f, roundPixels)
|
||||
{
|
||||
var tx = this.x * a + this.y * c + e;
|
||||
var ty = this.x * b + this.y * d + f;
|
||||
|
||||
if (roundPixels)
|
||||
{
|
||||
tx = Math.round(tx);
|
||||
ty = Math.round(ty);
|
||||
}
|
||||
|
||||
F32[++offset] = tx;
|
||||
F32[++offset] = ty;
|
||||
F32[++offset] = this.u;
|
||||
F32[++offset] = this.v;
|
||||
F32[++offset] = textureUnit;
|
||||
F32[++offset] = tintEffect;
|
||||
U32[++offset] = Utils.getTintAppendFloatAlpha(this.color, alpha * this.alpha);
|
||||
|
||||
return offset;
|
||||
}
|
||||
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue