1-
21var Class = require ( '../../utils/Class' ) ;
3- var GameObject = require ( '../GameObject' ) ;
42var Components = require ( '../components' ) ;
3+ var GameObject = require ( '../GameObject' ) ;
54var MeshRender = require ( './MeshRender' ) ;
65
6+ /**
7+ * A Mesh Game Object.
8+ *
9+ * @class Mesh
10+ * @extends Phaser.GameObjects.GameObject
11+ * @memberOf Phaser.GameObjects
12+ * @constructor
13+ * @webglOnly
14+ * @since 3.0.0
15+ *
16+ * @extends Phaser.GameObjects.Components.Alpha
17+ * @extends Phaser.GameObjects.Components.BlendMode
18+ * @extends Phaser.GameObjects.Components.Depth
19+ * @extends Phaser.GameObjects.Components.Flip
20+ * @extends Phaser.GameObjects.Components.GetBounds
21+ * @extends Phaser.GameObjects.Components.Origin
22+ * @extends Phaser.GameObjects.Components.Pipeline
23+ * @extends Phaser.GameObjects.Components.ScaleMode
24+ * @extends Phaser.GameObjects.Components.Size
25+ * @extends Phaser.GameObjects.Components.Texture
26+ * @extends Phaser.GameObjects.Components.Transform
27+ * @extends Phaser.GameObjects.Components.Visible
28+ * @extends Phaser.GameObjects.Components.ScrollFactor
29+ *
30+ * @param {Phaser.Scene } scene - The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time.
31+ * @param {number } x - The horizontal position of this Game Object in the world.
32+ * @param {number } y - The vertical position of this Game Object in the world.
33+ * @param {array } vertices - [description]
34+ * @param {array } uv - [description]
35+ * @param {array } colors - [description]
36+ * @param {array } alphas - [description]
37+ * @param {string } texture - The key of the Texture this Game Object will use to render with, as stored in the Texture Manager.
38+ * @param {string|integer } [frame] - An optional frame from the Texture this Game Object is rendering with.
39+ */
740var Mesh = new Class ( {
841
942 Extends : GameObject ,
@@ -39,19 +72,19 @@ var Mesh = new Class({
3972
4073 if ( vertices . length !== uv . length )
4174 {
42- throw new Error ( 'Phaser: Vertex count must match UV count' ) ;
75+ throw new Error ( 'Mesh Vertex count must match UV count' ) ;
4376 }
4477
4578 var verticesUB = ( vertices . length / 2 ) | 0 ;
4679
4780 if ( colors . length > 0 && colors . length < verticesUB )
4881 {
49- throw new Error ( 'Phaser: Color count must match Vertex count' ) ;
82+ throw new Error ( 'Mesh Color count must match Vertex count' ) ;
5083 }
5184
5285 if ( alphas . length > 0 && alphas . length < verticesUB )
5386 {
54- throw new Error ( 'Phaser: Alpha count must match Vertex count' ) ;
87+ throw new Error ( 'Mesh Alpha count must match Vertex count' ) ;
5588 }
5689
5790 var i ;
@@ -72,9 +105,40 @@ var Mesh = new Class({
72105 }
73106 }
74107
108+ /**
109+ * [description]
110+ *
111+ * @name Phaser.GameObjects.Mesh#vertices
112+ * @type {Float32Array }
113+ * @since 3.0.0
114+ */
75115 this . vertices = new Float32Array ( vertices ) ;
116+
117+ /**
118+ * [description]
119+ *
120+ * @name Phaser.GameObjects.Mesh#uv
121+ * @type {Float32Array }
122+ * @since 3.0.0
123+ */
76124 this . uv = new Float32Array ( uv ) ;
125+
126+ /**
127+ * [description]
128+ *
129+ * @name Phaser.GameObjects.Mesh#colors
130+ * @type {Uint32Array }
131+ * @since 3.0.0
132+ */
77133 this . colors = new Uint32Array ( colors ) ;
134+
135+ /**
136+ * [description]
137+ *
138+ * @name Phaser.GameObjects.Mesh#alphas
139+ * @type {Float32Array }
140+ * @since 3.0.0
141+ */
78142 this . alphas = new Float32Array ( alphas ) ;
79143 }
80144
0 commit comments