-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathH3DU.Mesh.html
executable file
·566 lines (402 loc) · 24.8 KB
/
H3DU.Mesh.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
<!DOCTYPE html><html><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><title>H3DU.Mesh</title><meta name="viewport" content="width=device-width"><link rel=stylesheet type="text/css" href="/style.css"></head><body> <div class="header">
<p><a href="#navigation">Menu</a> - <a href="#top">Top</a> - <a href="/">Home</a> -
<a href="http://peteroupc.github.io/">Donate to Me</a></p></div>
<div class="mainarea" id="top">
<h1>H3DU.Mesh</h1>
<p><a href="index.html">Back to documentation index.</a></p>
<p><a name='H3DU.Mesh'></a></p>
<h3>H3DU.Mesh([vertices], [indices], [format])</h3>
<p>Specifies the triangles, lines, or points that make up a geometric shape.
Each vertex, that is, each point, each end of a line, and each corner
of a triangle, can also specify the following attributes:</p>
<ul>
<li>A color, which is a set of 3 values each ranging from 0 to 1 (the red, green,
and blue components, respectively.)
<li>A normal vector, which is a set of 3 values.
Normal values are required for lighting to work properly.
<li>A tangent vector, which is a set of 3 values. (This is obsolete.)
<li>A bitangent vector, which is a set of 3 values. (This is obsolete.)
<li>Texture coordinates, which are a set of 2 values each ranging from 0 to
1, where (0, 0) is the lower-right corner of the texture (by default), and (1, 1) is the upper-right corner (by default).
</ul>
<p>Notes:<ul>
<li>Previous versions of this class allowed meshes to contain more than one
primitive type (triangles, lines, and points are the primitive types). This is
no longer the case, to simplify the implementation.</p>
<p><li>The default shader program assumes that all colors specified in this object are in
<a href="H3DU.Math.html#H3DU.Math.colorTosRGB">companded sRGB</a>.
<li>Starting in version 2.0, this class should not be used as a general purpose
class for storing geometric meshes. It should only be used as a convenient
way to build mesh buffers. In the future, some of the functionality in this class
may be reimplemented in the MeshBuffer class and the corresponding methods
in this class may be rewritten by having them convert objects to a MeshBuffer and
call the new H3DU.MeshBuffer method; this may affect performance. Afterward,
or at that point, those methods may be deprecated.</li></ul></p>
<h4>Parameters</h4>
<ul>
<li><code>vertices</code> (Type: Array.<number>) (optional)<br>An array that contains data on each vertex of the mesh. Each vertex is made up of the same number of elements, as defined in format. May be null or omitted, in which case an empty vertex array is used.</li>
<li><code>indices</code> (Type: Array.<number>) (optional)<br>An array of vertex indices. Each trio of indices specifies a separate triangle, or each pair of indices specifies a line segment. If null, undefined, or omitted, creates an initially empty mesh.</li>
<li><code>format</code> (Type: number) (optional)<br>A set of bit flags depending on the kind of data each vertex contains. Each vertex contains 3 elements plus:<ul> <li> 3 more elements if Mesh.NORMALS_BIT is set, plus <li> 3 more elements if Mesh.COLORS_BIT is set, plus <li> 2 more elements if Mesh.TEXCOORDS_BIT is set, plus <li> 3 more elements if Mesh.TANGENTS_BIT is set (deprecated), plus <li> 3 more elements if Mesh.BITANGENTS_BIT is set (deprecated). </ul> If Mesh.LINES_BIT is set, each vertex index specifies a point of a line segment. If Mesh.POINTS_BIT is set, each vertex index specifies an individual point. Both bits can't be set. May be null or omitted, in which case "format" is set to 0.</li>
</ul>
<h3>Members</h3>
<ul>
<li><a href="#H3DU.Mesh.BITANGENTS_BIT">BITANGENTS_BIT</a><br><b>Deprecated: Deprecated because the default shader no longer
uses tangent and bitangent attributes for normal mapping. To define
bitangent vectors for a mesh, use the <a href="H3DU.MeshBuffer.html">H3DU.MeshBuffer</a> class
and create a buffer attribute with the <a href="H3DU.Semantic.html#H3DU.Semantic.BITANGENT">H3DU.Semantic.BITANGENT</a>
semantic.</b></li>
<li><a href="#H3DU.Mesh.COLORS_BIT">COLORS_BIT</a><br>The mesh contains colors for each vertex.</li>
<li><a href="#H3DU.Mesh.LINES">LINES</a><br>Primitive mode for rendering line segments, made up
of 2 vertices each.</li>
<li><a href="#H3DU.Mesh.LINES_BIT">LINES_BIT</a><br>The mesh consists of lines (2 vertices per line) instead
of triangles (3 vertices per line).</li>
<li><a href="#H3DU.Mesh.LINE_STRIP">LINE_STRIP</a><br>Primitive mode for rendering connected line segments.</li>
<li><a href="#H3DU.Mesh.NORMALS_BIT">NORMALS_BIT</a><br>The mesh contains normals for each vertex.</li>
<li><a href="#H3DU.Mesh.POINTS">POINTS</a><br>Primitive mode for rendering points, made up
of 1 vertex each.</li>
<li><a href="#H3DU.Mesh.POINTS_BIT">POINTS_BIT</a><br>The mesh consists of points (1 vertex per line).</li>
<li><a href="#H3DU.Mesh.QUADS">QUADS</a><br>Primitive mode for rendering quadrilaterals, made up
of 4 vertices each.</li>
<li><a href="#H3DU.Mesh.QUAD_STRIP">QUAD_STRIP</a><br>Primitive mode for rendering a strip of quadrilaterals (quads).</li>
<li><a href="#H3DU.Mesh.TANGENTS_BIT">TANGENTS_BIT</a><br><b>Deprecated: Deprecated because the default shader no longer
uses tangent and bitangent attributes for normal mapping. To define
tangent vectors for a mesh, use the <a href="H3DU.MeshBuffer.html">H3DU.MeshBuffer</a> class
and create a buffer attribute with the <a href="H3DU.Semantic.html#H3DU.Semantic.TANGENT">H3DU.Semantic.TANGENT</a>
semantic.</b></li>
<li><a href="#H3DU.Mesh.TEXCOORDS_BIT">TEXCOORDS_BIT</a><br>The mesh contains texture coordinates for each vertex.</li>
<li><a href="#H3DU.Mesh.TRIANGLES">TRIANGLES</a><br>Primitive mode for rendering triangles, made up
of 3 vertices each.</li>
<li><a href="#H3DU.Mesh.TRIANGLE_FAN">TRIANGLE_FAN</a><br>Primitive mode for rendering a triangle fan.</li>
<li><a href="#H3DU.Mesh.TRIANGLE_STRIP">TRIANGLE_STRIP</a><br>Primitive mode for rendering a triangle strip.</li>
</ul>
<h3>Methods</h3>
<ul>
<li><a href="#H3DU.Mesh_color3">color3</a><br>Sets the current color for this mesh.</li>
<li><a href="#H3DU.Mesh_getVertex">getVertex</a><br>Gets the position of the vertex with the specified
index in this mesh.</li>
<li><a href="#H3DU.Mesh_getVertexNormal">getVertexNormal</a><br>Gets the normal of the vertex with the specified
index in this mesh.</li>
<li><a href="#H3DU.Mesh_mode">mode</a><br>Changes the primitive mode for this mesh.</li>
<li><a href="#H3DU.Mesh_normal3">normal3</a><br>Sets the current normal for this mesh.</li>
<li><a href="#H3DU.Mesh_primitiveCount">primitiveCount</a><br>Gets the number of primitives (triangles, lines,
or points) that this mesh contains.</li>
<li><a href="#H3DU.Mesh_setVertex">setVertex</a><br>Sets the x-, y-, and z-coordinates of the vertex with the specified index.</li>
<li><a href="#H3DU.Mesh_setVertexNormal">setVertexNormal</a><br>Sets the normal associated with the vertex with the specified index.</li>
<li><a href="#H3DU.Mesh_texCoord2">texCoord2</a><br>Sets the current texture coordinates for this mesh.</li>
<li><a href="#H3DU.Mesh_toMeshBuffer">toMeshBuffer</a><br>Generates a mesh buffer from the information in this mesh object.</li>
<li><a href="#H3DU.Mesh_vertex2">vertex2</a><br>Adds a new vertex to this mesh.</li>
<li><a href="#H3DU.Mesh_vertex3">vertex3</a><br>Adds a new vertex to this mesh.</li>
<li><a href="#H3DU.Mesh_vertexCount">vertexCount</a><br>Gets the number of vertices included in this mesh.</li>
</ul>
<p><a name='H3DU.Mesh.BITANGENTS_BIT'></a></p>
<h3>H3DU.Mesh.BITANGENTS_BIT (constant)</h3>
<p><b>Deprecated: Deprecated because the default shader no longer
uses tangent and bitangent attributes for normal mapping. To define
bitangent vectors for a mesh, use the <a href="H3DU.MeshBuffer.html">H3DU.MeshBuffer</a> class
and create a buffer attribute with the <a href="H3DU.Semantic.html#H3DU.Semantic.BITANGENT">H3DU.Semantic.BITANGENT</a>
semantic.</b></p>
<p>The mesh contains bitangent vectors for each vertex.</p>
<p>Default Value: <code>16</code></p>
<p><a name='H3DU.Mesh.COLORS_BIT'></a></p>
<h3>H3DU.Mesh.COLORS_BIT (constant)</h3>
<p>The mesh contains colors for each vertex.</p>
<p>Default Value: <code>2</code></p>
<p><a name='H3DU.Mesh.LINES'></a></p>
<h3>H3DU.Mesh.LINES (constant)</h3>
<p>Primitive mode for rendering line segments, made up
of 2 vertices each.</p>
<p><a name='H3DU.Mesh.LINES_BIT'></a></p>
<h3>H3DU.Mesh.LINES_BIT (constant)</h3>
<p>The mesh consists of lines (2 vertices per line) instead
of triangles (3 vertices per line).</p>
<p>Default Value: <code>256</code></p>
<p><a name='H3DU.Mesh.LINE_STRIP'></a></p>
<h3>H3DU.Mesh.LINE_STRIP (constant)</h3>
<p>Primitive mode for rendering connected line segments.
The first 2 vertices make up the first line, and each additional
line is made up of the last vertex and 1 new vertex.</p>
<p>Default Value: <code>3</code></p>
<p><a name='H3DU.Mesh.NORMALS_BIT'></a></p>
<h3>H3DU.Mesh.NORMALS_BIT (constant)</h3>
<p>The mesh contains normals for each vertex.</p>
<p>Default Value: <code>1</code></p>
<p><a name='H3DU.Mesh.POINTS'></a></p>
<h3>H3DU.Mesh.POINTS (constant)</h3>
<p>Primitive mode for rendering points, made up
of 1 vertex each.</p>
<p>Default Value: <code>0</code></p>
<p><a name='H3DU.Mesh.POINTS_BIT'></a></p>
<h3>H3DU.Mesh.POINTS_BIT (constant)</h3>
<p>The mesh consists of points (1 vertex per line).</p>
<p>Default Value: <code>512</code></p>
<p><a name='H3DU.Mesh.QUADS'></a></p>
<h3>H3DU.Mesh.QUADS (constant)</h3>
<p>Primitive mode for rendering quadrilaterals, made up
of 4 vertices each. Each quadrilateral is broken into two triangles: the first
triangle consists of the first, second, and third vertices, in that order,
and the second triangle consists of the first, third, and fourth
vertices, in that order.</p>
<p>Default Value: <code>7</code></p>
<p><a name='H3DU.Mesh.QUAD_STRIP'></a></p>
<h3>H3DU.Mesh.QUAD_STRIP (constant)</h3>
<p>Primitive mode for rendering a strip of quadrilaterals (quads).
The first 4 vertices make up the first quad, and each additional
quad is made up of the last 2 vertices of the previous quad and
2 new vertices. Each quad is broken into two triangles: the first
triangle consists of the first, second, and third vertices, in that order,
and the second triangle consists of the third, second, and fourth
vertices, in that order.</p>
<p>Default Value: <code>8</code></p>
<p><a name='H3DU.Mesh.TANGENTS_BIT'></a></p>
<h3>H3DU.Mesh.TANGENTS_BIT (constant)</h3>
<p><b>Deprecated: Deprecated because the default shader no longer
uses tangent and bitangent attributes for normal mapping. To define
tangent vectors for a mesh, use the <a href="H3DU.MeshBuffer.html">H3DU.MeshBuffer</a> class
and create a buffer attribute with the <a href="H3DU.Semantic.html#H3DU.Semantic.TANGENT">H3DU.Semantic.TANGENT</a>
semantic.</b></p>
<p>The mesh contains tangent vectors for each vertex.</p>
<p>Default Value: <code>8</code></p>
<p><a name='H3DU.Mesh.TEXCOORDS_BIT'></a></p>
<h3>H3DU.Mesh.TEXCOORDS_BIT (constant)</h3>
<p>The mesh contains texture coordinates for each vertex.</p>
<p>Default Value: <code>4</code></p>
<p><a name='H3DU.Mesh.TRIANGLES'></a></p>
<h3>H3DU.Mesh.TRIANGLES (constant)</h3>
<p>Primitive mode for rendering triangles, made up
of 3 vertices each.</p>
<p>Default Value: <code>4</code></p>
<p><a name='H3DU.Mesh.TRIANGLE_FAN'></a></p>
<h3>H3DU.Mesh.TRIANGLE_FAN (constant)</h3>
<p>Primitive mode for rendering a triangle fan. The first 3
vertices make up the first triangle, and each additional
triangle is made up of the first vertex of the first triangle,
the previous vertex, and 1 new vertex.</p>
<p>Default Value: <code>6</code></p>
<p><a name='H3DU.Mesh.TRIANGLE_STRIP'></a></p>
<h3>H3DU.Mesh.TRIANGLE_STRIP (constant)</h3>
<p>Primitive mode for rendering a triangle strip. The first 3
vertices make up the first triangle, and each additional
triangle is made up of the last 2 vertices and 1
new vertex. For the second triangle in the strip, and
every other triangle after that, the first and second
vertices are swapped when generating that triangle.</p>
<p>Default Value: <code>5</code></p>
<p><a name='H3DU.Mesh_color3'></a></p>
<h3>H3DU.Mesh#color3(r, [g], [b])</h3>
<p>Sets the current color for this mesh. Future vertex positions
defined (with vertex3()) will have this color. The new current
color will apply to future vertices even if the current mode
is TRIANGLE_FAN and some vertices were already given for
that mode. Only the red, green, and blue components will be used.</p>
<h4>Parameters</h4>
<ul>
<li><code>r</code> (Type: Array.<number> | number | string)<br>A <a href="H3DU.html#H3DU.toGLColor">color vector or string</a>, or the red color component (0-1).</li>
<li><code>g</code> (Type: number) (optional)<br>Green color component (0-1). May be null or omitted if a string or array is given as the "r" parameter.</li>
<li><code>b</code> (Type: number) (optional)<br>Blue color component (0-1). May be null or omitted if a string or array is given as the "r" parameter.</li>
</ul>
<h4>Return Value</h4>
<p>This object. (Type: <a href="H3DU.Mesh.html">H3DU.Mesh</a>)</p>
<p><a name='H3DU.Mesh_getVertex'></a></p>
<h3>H3DU.Mesh#getVertex(index)</h3>
<p>Gets the position of the vertex with the specified
index in this mesh.</p>
<h4>Parameters</h4>
<ul>
<li><code>index</code> (Type: number)<br>Zero-based index of the vertex to get. The index ranges from 0 to less than the number of vertices in the mesh, not the number of vertex indices.</li>
</ul>
<h4>Return Value</h4>
<p>A 3-element array giving
the x-, y-, and z-coordinates, respectively, of the vertex
position, or null if the index is less than 0 or
equals the number of vertices in this mesh or greater. (Type: Array.<number>)</p>
<p><a name='H3DU.Mesh_getVertexNormal'></a></p>
<h3>H3DU.Mesh#getVertexNormal(index)</h3>
<p>Gets the normal of the vertex with the specified
index in this mesh.</p>
<h4>Parameters</h4>
<ul>
<li><code>index</code> (Type: number)<br>Zero-based index of the vertex normal to get. The index ranges from 0 to less than the number of vertices in the mesh, not the number of vertex indices.</li>
</ul>
<h4>Return Value</h4>
<p>A 3-element array giving
the x-, y-, and z-coordinates, respectively, of the vertex
normal, or null if the index is less than 0 or
equals the number of vertices in this mesh or greater.
Returns (0,0,0) if the specified vertex exists but doesn't define
a normal. (Type: Array.<number>)</p>
<p><a name='H3DU.Mesh_mode'></a></p>
<h3>H3DU.Mesh#mode(m)</h3>
<p>Changes the primitive mode for this mesh.
Future vertices will be drawn as primitives of the new type.
The primitive type can be set to the same mode, in which
case future vertices given will not build upon previous
vertices.</p>
<p>An H3DU.Mesh object can contain primitives of different
types, such as triangles and lines. For example, it's allowed
to have a mesh with triangles, then call this method, say,
with <code>Mesh.LINE_STRIP</code> to add line segments
to that mesh. However, this functionality may be deprecated
in future versions.</p>
<h4>Parameters</h4>
<ul>
<li><code>m</code> (Type: number)<br>A primitive type. One of the following: Mesh.TRIANGLES, Mesh.LINES, Mesh.LINE_STRIP, Mesh.TRIANGLE_STRIP, Mesh.TRIANGLE_FAN, Mesh.QUADS, Mesh.QUAD_STRIP. Throws an error if the primitive type is incompatible with the current primitive type (for example, a triangle type with LINE_STRIP).</li>
</ul>
<h4>Return Value</h4>
<p>This object. (Type: <a href="H3DU.Mesh.html">H3DU.Mesh</a>)</p>
<p><a name='H3DU.Mesh_normal3'></a></p>
<h3>H3DU.Mesh#normal3(x, [y], [z])</h3>
<p>Sets the current normal for this mesh. Future vertex positions
defined (with vertex3()) will have this normal. The new current
normal will apply to future vertices even if the current mode
is TRIANGLE_FAN and some vertices were already given for
that mode. The normal passed to this method will
not automatically be normalized to unit length.</p>
<h4>Parameters</h4>
<ul>
<li><code>x</code> (Type: Array.<number> | number)<br>x-coordinate of the normal. If "y" and "z" are null or omitted, this is instead a 3-element array giving the x-, y-, and z-coordinates, or a single number giving the coordinate for all three dimensions.</li>
<li><code>y</code> (Type: number) (optional)<br>y-coordinate of the normal. If "x" is an array, this parameter may be omitted.</li>
<li><code>z</code> (Type: number) (optional)<br>z-coordinate of the normal. If "x" is an array, this parameter may be omitted.</li>
</ul>
<h4>Return Value</h4>
<p>This object. (Type: <a href="H3DU.Mesh.html">H3DU.Mesh</a>)</p>
<p><a name='H3DU.Mesh_primitiveCount'></a></p>
<h3>H3DU.Mesh#primitiveCount()</h3>
<p>Gets the number of primitives (triangles, lines,
or points) that this mesh contains.</p>
<h4>Return Value</h4>
<p>Return value. (Type: number)</p>
<p><a name='H3DU.Mesh_setVertex'></a></p>
<h3>H3DU.Mesh#setVertex(index, x, y, z)</h3>
<p>Sets the x-, y-, and z-coordinates of the vertex with the specified index. Has no effect if the index is less than 0 or
equals the number of vertices in this mesh or greater.</p>
<h4>Parameters</h4>
<ul>
<li><code>index</code> (Type: number)<br>Zero-based index of the vertex to set. The index ranges from 0 to less than the number of vertices in the mesh, not the number of vertex indices.</li>
<li><code>x</code> (Type: number | Array.<number>)<br>x-coordinate of the vertex position. Can also be a 3-element array giving the x-, y-, and z-coordinates, respectively, of the vertex position.</li>
<li><code>y</code> (Type: number)<br>y-coordinate of the vertex position. May be null or omitted if "x" is an array.</li>
<li><code>z</code> (Type: number)<br>z-coordinate of the vertex position. May be null or omitted if "x" is an array.</li>
</ul>
<h4>Return Value</h4>
<p>This object. (Type: <a href="H3DU.Mesh.html">H3DU.Mesh</a>)</p>
<p><a name='H3DU.Mesh_setVertexNormal'></a></p>
<h3>H3DU.Mesh#setVertexNormal(index, x, y, z)</h3>
<p>Sets the normal associated with the vertex with the specified index. Has no effect if the index is less than 0 or
equals the number of vertices in this mesh or greater.</p>
<h4>Parameters</h4>
<ul>
<li><code>index</code> (Type: number)<br>Zero-based index of the vertex to set. The index ranges from 0 to less than the number of vertices in the mesh, not the number of vertex indices.</li>
<li><code>x</code> (Type: number | Array.<number>)<br>x-coordinate of the vertex normal. Can also be a 3-element array giving the x-, y-, and z-coordinates, respectively, of the vertex normal.</li>
<li><code>y</code> (Type: number)<br>y-coordinate of the vertex normal. May be null or omitted if "x" is an array.</li>
<li><code>z</code> (Type: number)<br>z-coordinate of the vertex normal. May be null or omitted if "x" is an array.</li>
</ul>
<h4>Return Value</h4>
<p>This object. (Type: <a href="H3DU.Mesh.html">H3DU.Mesh</a>)</p>
<p><a name='H3DU.Mesh_texCoord2'></a></p>
<h3>H3DU.Mesh#texCoord2(u, [v])</h3>
<p>Sets the current texture coordinates for this mesh. Future vertex positions
defined (with vertex3()) will have these texture coordinates.
The new current texture coordinates will apply to future vertices
even if the current mode
is TRIANGLE_FAN and some vertices were already given for
that mode.</p>
<p>H3DU.Texture coordinates are a set of 2 values each ranging from 0 to
1, where (0, 0) is the lower-right corner of the texture (by default), and (1, 1) is the upper-right corner (by default).</p>
<h4>Parameters</h4>
<ul>
<li><code>u</code> (Type: Array.<number> | number)<br>x-coordinate of the texture, from 0-1. If "v" are null or omitted, this is instead a 2-element array giving the x- and y-coordinates, or a single number giving the coordinate for all three dimensions.</li>
<li><code>v</code> (Type: number) (optional)<br>y-coordinate of the texture, from 0-1. If "u" is an array, this parameter can be omitted.</li>
</ul>
<h4>Return Value</h4>
<p>This object. (Type: <a href="H3DU.Mesh.html">H3DU.Mesh</a>)</p>
<p><a name='H3DU.Mesh_toMeshBuffer'></a></p>
<h3>H3DU.Mesh#toMeshBuffer()</h3>
<p>Generates a mesh buffer from the information in this mesh object.</p>
<h4>Return Value</h4>
<p>The generated mesh buffer. (Type: <a href="H3DU.MeshBuffer.html">H3DU.MeshBuffer</a>)</p>
<p><a name='H3DU.Mesh_vertex2'></a></p>
<h3>H3DU.Mesh#vertex2(x, y)</h3>
<p>Adds a new vertex to this mesh. The z-coordinate will
be treated as 0.</p>
<h4>Parameters</h4>
<ul>
<li><code>x</code> (Type: Array.<number> | number)<br>The x-coordinate. If "y" is null, undefined, or omitted, this is instead a 3-element array giving the x-, y-, and z-coordinates, or a single number giving the coordinate for all three dimensions.</li>
<li><code>y</code> (Type: number)<br>The y-coordinate. If "x" is an array, this parameter may be omitted.</li>
</ul>
<h4>Return Value</h4>
<p>This object. (Type: <a href="H3DU.Mesh.html">H3DU.Mesh</a>)</p>
<p><a name='H3DU.Mesh_vertex3'></a></p>
<h3>H3DU.Mesh#vertex3(x, [y], [z])</h3>
<p>Adds a new vertex to this mesh. If appropriate, adds an
additional face index according to this mesh's current mode.
The vertex will adopt this mesh's current normal, color,
and texture coordinates if they have been defined.</p>
<h4>Parameters</h4>
<ul>
<li><code>x</code> (Type: Array.<number> | number)<br>The x-coordinate. If "y" and "z" are null or omitted, this is instead a 3-element array giving the x-, y-, and z-coordinates, or a single number giving the coordinate for all three dimensions.</li>
<li><code>y</code> (Type: number) (optional)<br>The y-coordinate. If "x" is an array, this parameter may be omitted.</li>
<li><code>z</code> (Type: number) (optional)<br>The z-coordinate. If "x" is an array, this parameter may be omitted.</li>
</ul>
<h4>Return Value</h4>
<p>This object. (Type: <a href="H3DU.Mesh.html">H3DU.Mesh</a>)</p>
<p><a name='H3DU.Mesh_vertexCount'></a></p>
<h3>H3DU.Mesh#vertexCount()</h3>
<p>Gets the number of vertices included in this mesh.</p>
<h4>Return Value</h4>
<p>Return value. (Type: number)</p>
<p><a href="index.html">Back to documentation index.</a></p>
</div><nav id="navigation"><ul>
<li><a href="/">Back to start site.</a>
<li><a href="https://github.com/peteroupc/peteroupc.github.io">This site's repository (source code)</a>
<li><a href="https://github.com/peteroupc/peteroupc.github.io/issues">Post an issue or comment</a></ul>
<p>
<a href="//twitter.com/share">Share via Twitter</a>, <a href="//www.facebook.com/sharer/sharer.php" id="sharer">Share via Facebook</a>
</p>
</div>
<h3>Navigation</h3>
<ul>
<li><a href="DrawingToy.html">DrawingToy</a></li>
<li><a href="Epitrochoid.html">Epitrochoid</a></li>
<li><a href="H3DU.html">H3DU</a></li>
<li><a href="H3DU.BSplineCurve.html">H3DU.BSplineCurve</a></li>
<li><a href="H3DU.BSplineSurface.html">H3DU.BSplineSurface</a></li>
<li><a href="H3DU.BufferAccessor.html">H3DU.BufferAccessor</a></li>
<li><a href="H3DU.Camera.html">H3DU.Camera</a></li>
<li><a href="H3DU.Curve.html">H3DU.Curve</a></li>
<li><a href="H3DU.CurveBuilder.html">H3DU.CurveBuilder</a></li>
<li><a href="H3DU.CurveTube.html">H3DU.CurveTube</a></li>
<li><a href="H3DU.GraphicsPath.html">H3DU.GraphicsPath</a></li>
<li><a href="H3DU.InputTracker.html">H3DU.InputTracker</a></li>
<li><a href="H3DU.MathUtil.html">H3DU.MathUtil</a></li>
<li><a href="H3DU.MeshBuffer.html">H3DU.MeshBuffer</a></li>
<li><a href="H3DU.Meshes.html">H3DU.Meshes</a></li>
<li><a href="H3DU.PiecewiseCurve.html">H3DU.PiecewiseCurve</a></li>
<li><a href="H3DU.Shape.html">H3DU.Shape</a></li>
<li><a href="H3DU.ShapeGroup.html">H3DU.ShapeGroup</a></li>
<li><a href="H3DU.Surface.html">H3DU.Surface</a></li>
<li><a href="H3DU.SurfaceBuilder.html">H3DU.SurfaceBuilder</a></li>
<li><a href="H3DU.TextFont.html">H3DU.TextFont</a></li>
<li><a href="H3DU.TextureAtlas.html">H3DU.TextureAtlas</a></li>
<li><a href="H3DU.Transform.html">H3DU.Transform</a></li>
<li><a href="Hypotrochoid.html">Hypotrochoid</a></li>
<li><a href="MatrixStack.html">MatrixStack</a></li>
<li><a href="Polyhedra.html">Polyhedra</a></li>
<li><a href="Promise.html">Promise</a></li>
<li><a href="Semantic.html">Semantic</a></li>
<li><a href="StarField.html">StarField</a></li>
<li><a href="Superellipsoid.html">Superellipsoid</a></li>
<li><a href="Supertoroid.html">Supertoroid</a></li>
<li><a href="SurfaceOfRevolution.html">SurfaceOfRevolution</a></li>
<li><a href="Trochoid.html">Trochoid</a></li>
<li><a href="curveCatacaustic.html">curveCatacaustic</a></li>
<li><a href="curveEvolute.html">curveEvolute</a></li>
<li><a href="curveInverse.html">curveInverse</a></li>
<li><a href="curveInvolute.html">curveInvolute</a></li>
<li><a href="curveOrthotomic.html">curveOrthotomic</a></li>
<li><a href="curvePedalCurve.html">curvePedalCurve</a></li>
<li><a href="curveRadialCurve.html">curveRadialCurve</a></li>
<li><a href="polarCurve.html">polarCurve</a></li>
<li><a href="ruledSurface.html">ruledSurface</a></li>
<li><a href="spiralCurve.html">spiralCurve</a></li>
</ul>
</nav>
</body></html>