-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathof.mesh-help.pd
401 lines (401 loc) · 12.9 KB
/
of.mesh-help.pd
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
#N canvas 488 52 627 742 12;
#X declare -lib ofelia;
#X obj 20 238 of.draw;
#X msg 232 264 mode \$1;
#X msg 233 352 draw line;
#X msg 233 374 draw fill;
#X msg 233 473 smoothnormals \$1;
#X floatatom 233 446 5 0 0 0 - - -;
#X msg 232 497 get;
#X obj 185 557 unpack 0 0 0 0 0;
#X floatatom 185 580 5 0 0 0 Vertices - -;
#X floatatom 212 614 5 0 0 0 Colors - -;
#X floatatom 239 641 5 0 0 0 Indices - -;
#X floatatom 266 596 5 0 0 0 Normals - -;
#X floatatom 294 662 5 0 0 0 Texcoords - -;
#X msg 233 316 stroke \$1;
#X floatatom 233 291 5 0 0 0 - - -;
#X msg 233 398 draw point;
#X obj 9 0 cnv 15 600 200 empty empty empty 20 12 0 14 -233017 -66577
0;
#X obj 459 170 declare -lib ofelia;
#X text 16 172 https://openframeworks.cc/documentation/3d/ofMesh/,
f 51;
#X text 14 12 An of.mesh represents a set of vertices in 3D spaces
\, and normals at those points \, colors at those points \, and texture
coordinates at those points. Each of these different properties is
stored in a vector. Vertices are passed to your graphics card and your
graphics card fill in the spaces in between them in a processing usually
called the rendering pipeline. The rendering pipeline goes more or
less like this: - Say how you're going to connect all the points. -
Make some points. - Say that you're done making points.;
#X msg 233 423 draw normal;
#X obj 232 238 hradio 15 1 0 11 empty empty empty 0 -8 0 10 -262144
-1 -1 5;
#X msg 38 343 open data/wood.jpg;
#X obj 20 525 of.mesh data/penguin.ply;
#X obj 20 302 of.view, f 10;
#N canvas 492 248 292 249 local_transformation 0;
#X msg 37 49 position 0 100 -100;
#X msg 77 106 scale 1 2 2;
#X text 36 27 transformation;
#X msg 57 79 orientation 45 0 45;
#X msg 87 133 lookat 180 120 60;
#X obj 37 162 s mesh;
#X connect 0 0 5 0;
#X connect 1 0 5 0;
#X connect 3 0 5 0;
#X connect 4 0 5 0;
#X restore 410 385 pd local_transformation;
#X msg 412 441 texture \$1;
#X obj 412 414 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 1
1;
#X obj 87 236 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 1
1;
#X obj 20 270 of.depth 1;
#X text 107 234 depth test;
#N canvas 606 310 407 443 Normals 0;
#X msg 45 265 \; mesh removenormal \$1;
#X floatatom 45 240 5 0 0 0 - - -;
#X msg 45 353 \; mesh clearnormals;
#X obj 44 52 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1
-1;
#X obj 44 26 metro 40;
#X obj 44 5 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 1
;
#N canvas 219 478 597 300 randomlistRGBA 0;
#X obj 72 19 inlet;
#X obj 72 151 outlet;
#X obj 302 73 random 10;
#X obj 182 73 random 10;
#X obj 72 73 random 10;
#X obj 302 100 / 10;
#X obj 184 100 / 10;
#X obj 72 100 / 10;
#X obj 72 46 t b b b, f 33;
#X obj 72 127 pack 0 0 0, f 34;
#X connect 0 0 8 0;
#X connect 2 0 5 0;
#X connect 3 0 6 0;
#X connect 4 0 7 0;
#X connect 5 0 9 2;
#X connect 6 0 9 1;
#X connect 7 0 9 0;
#X connect 8 0 4 0;
#X connect 8 1 3 0;
#X connect 8 2 2 0;
#X connect 9 0 1 0;
#X restore 44 80 pd randomlistRGBA;
#X text 44 330 clear all normals;
#X text 85 237 remove normal by index;
#X msg 44 118 \; mesh addnormal \$1 \$2 \$3;
#X msg 44 184 \; mesh addNormals \$1 \$2 \$3;
#X text 39 161 add an array of normals coordinate (not implemented)
;
#X text 64 51 add new normal one by one;
#X connect 1 0 0 0;
#X connect 3 0 6 0;
#X connect 4 0 3 0;
#X connect 5 0 4 0;
#X connect 6 0 9 0;
#X restore 410 312 pd Normals;
#N canvas 514 118 785 634 Import_Primitives_examples 0;
#X msg 18 205 \; mesh prim ofConePrimitive 10 20 5 4 1 0;
#X text 328 208 radius \, height \, radiusSegments \, heightSegments
\, capSegments \, ofPrimitiveMode mode;
#X text 331 171 width \, height \, depth \, resX \, resY \, resZ;
#X msg 26 534 mode \$1;
#X obj 26 508 hradio 15 1 0 11 empty empty empty 0 -8 0 10 -262144
-1 -1 5;
#X obj 26 558 s mesh;
#X msg 18 165 \; mesh prim ofBoxPrimitive 10 10 10 10 10 10;
#X text 273 133 radius \, res \, ofPrimitiveMode mode;
#X msg 18 125 \; mesh prim ofSpherePrimitive 10 4 0;
#X text 311 90 width \, height \, columns \, rows \, ofPrimitiveMode
mode;
#X msg 18 85 \; mesh prim ofPlanePrimitive 10 10 10 5 0;
#X text 350 252 radius \, height \, radiusSegments \, heightSegments
\, numCapSegments;
#X msg 18 245 \; mesh prim ofCylinderPrimitive 10 10 10 10 1;
#X msg 22 408 \; mesh append ofBoxPrimitive 100 100 100 10 10 10;
#X msg 22 445 \; mesh append ofSpherePrimitive 100 4 0;
#X msg 111 531 clear;
#X text 20 384 append a shape to the current one (bug?);
#X msg 19 15 \; mesh mode 1;
#X text 115 23 -> be sure to turn mode 1 first;
#X text 17 63 Then replace mesh with a prim:;
#X msg 21 322 \; mesh prim ofSpherePrimitive 10 \$1 0;
#X floatatom 21 294 5 0 0 0 - - -;
#X text 64 295 sphere res;
#X text 23 487 Primitive draw mode;
#X connect 3 0 5 0;
#X connect 4 0 3 0;
#X connect 15 0 5 0;
#X connect 21 0 20 0;
#X restore 410 336 pd Import_Primitives_examples;
#N canvas 771 332 460 428 Import_3d_Models_examples 0;
#X msg 20 110 \; mesh open data/penguin.ply;
#X text 17 5 Loads a mesh from a file located at the provided path
into the mesh. This will replace any existing data within the mesh.
It expects that the file will be in the PLY Format. It will only load
meshes saved in the PLY ASCII format \; the binary format is not supported.
Triangle faces.;
#X obj 263 153 openpanel;
#X msg 263 177 open \$1;
#X obj 263 201 s mesh;
#X obj 263 125 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144
-1 -1;
#X msg 20 294 \; mesh open data/circle.ply;
#X msg 20 170 \; mesh open data/teapot.ply;
#X msg 20 230 \; mesh open data/torusknot.ply;
#X msg 20 344 \; mesh open data/cube.ply;
#X text 18 277 circle;
#X text 18 327 cube;
#X text 18 92 penguin;
#X text 18 152 teapot;
#X text 18 212 torusknot;
#X connect 2 0 3 0;
#X connect 3 0 4 0;
#X connect 5 0 2 0;
#X restore 410 361 pd Import_3d_Models_examples;
#X text 40 325 change texture;
#X obj 467 21 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
1;
#X msg 412 494 debug \$1;
#X obj 412 474 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
1;
#X text 229 334 not in all mode:;
#X obj 20 373 of.image data/penguin.jpg;
#N canvas 431 136 849 642 Vertex_creation 0;
#X obj 26 138 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1
-1;
#X msg 26 189 \; mesh addvertex \$1 \$2 \$3;
#N canvas 230 315 450 300 randomlistXYZ 0;
#X obj 72 19 inlet;
#X obj 72 46 t b b b, f 33;
#X obj 72 147 pack 0 0 0, f 33;
#X obj 72 171 outlet;
#X text 131 172 3 values from -10 to 10;
#X obj 72 83 random 40;
#X obj 186 83 random 40;
#X obj 300 83 random 40;
#X obj 72 110 - 20;
#X obj 186 110 - 20;
#X obj 300 110 - 20;
#X connect 0 0 1 0;
#X connect 1 0 5 0;
#X connect 1 1 6 0;
#X connect 1 2 7 0;
#X connect 2 0 3 0;
#X connect 5 0 8 0;
#X connect 6 0 9 0;
#X connect 7 0 10 0;
#X connect 8 0 2 0;
#X connect 9 0 2 1;
#X connect 10 0 2 2;
#X restore 26 160 pd randomlistXYZ;
#X text 430 14 A simple square is made by 2 triangles:;
#X text 428 88 Triangle 1:;
#X text 428 193 Triangle 2:;
#X floatatom 27 242 5 0 0 0 - - -;
#X msg 27 267 \; mesh removevertex \$1;
#X floatatom 28 380 5 0 0 0 - - -;
#X msg 28 405 \; mesh removeindex \$1;
#X msg 27 338 \; mesh addindex \$1;
#X floatatom 27 312 5 0 0 0 - - -;
#X msg 28 465 \; mesh clearvertices;
#X text 30 446 clear all vertices;
#X text 45 91 add new random vertex position one by one;
#X text 24 548 add an array of vertices coordinate (not implemented)
;
#X obj 26 114 metro 40;
#X obj 26 93 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 1
;
#X msg 31 522 setupindicesauto;
#X text 70 240 remove vertex by index;
#X text 69 311 Add an index to the index vector., f 36;
#X msg 424 412 \; mesh addtriangle 1 2 3;
#X msg 424 452 \; mesh addtriangle 4 5 6;
#X msg 424 492 \; mesh addtriangle 7 8 9;
#X msg 424 532 \; mesh addtriangle 10 11 12;
#X text 415 322 add a triangle one by one:;
#X text 417 340 Adding a triangle means using three of the vertices
that have already been added to create a triangle;
#X floatatom 204 435 5 0 0 0 - - -;
#X text 246 434 set index;
#X text 200 491 index \, value;
#X msg 204 460 \; mesh setindex \$1 10;
#X msg 29 571 \; mesh addvertices \$1 \$2 \$3;
#X obj 205 23 hradio 15 1 0 11 empty empty empty 0 -8 0 10 -262144
-1 -1 2;
#X text 298 55 ofPrimitiveMode;
#X msg 205 47 \; mesh mode \$1;
#X msg 432 37 \; mesh clear \; mesh mode 0;
#X text 517 51 clear all;
#X msg 432 106 \; mesh addvertex -10 -10 0 \; mesh addvertex 10 -10
0 \; mesh addvertex -10 10 0 \;;
#X msg 431 215 \; mesh addvertex -10 10 0 \; mesh addvertex 10 10 0
\; mesh addvertex 10 -10 0 \;;
#X msg 424 374 \; mesh addvertex 0 0 0;
#X text 583 384 need at least one vertex?;
#X text 69 378 remove index, f 36;
#X text 204 201 add vertex position x y z;
#X text 26 0 clear all \, draw fill and render mode 4;
#X msg 26 24 \; mesh clear \; mesh draw fill \; mesh mode 4;
#X connect 0 0 2 0;
#X connect 2 0 1 0;
#X connect 6 0 7 0;
#X connect 8 0 9 0;
#X connect 11 0 10 0;
#X connect 16 0 0 0;
#X connect 17 0 16 0;
#X connect 27 0 30 0;
#X connect 32 0 34 0;
#X restore 410 239 pd Vertex_creation;
#N canvas 546 171 432 534 Color_vertex 0;
#X obj 29 141 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1
-1;
#X obj 29 115 metro 40;
#X obj 29 94 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 1
;
#X text 52 92 add new vertex color;
#X text 219 209 r g b a;
#N canvas 370 476 597 300 randomlistRGBA 0;
#X obj 72 19 inlet;
#X obj 72 151 outlet;
#X obj 302 73 random 10;
#X obj 182 73 random 10;
#X obj 72 73 random 10;
#X obj 413 78 random 10;
#X obj 72 46 t b b b b, f 49;
#X obj 72 127 pack 0 0 0 0, f 50;
#X obj 72 100 / 10;
#X obj 184 100 / 10;
#X obj 302 100 / 10;
#X obj 416 102 / 10;
#X connect 0 0 6 0;
#X connect 2 0 10 0;
#X connect 3 0 9 0;
#X connect 4 0 8 0;
#X connect 5 0 11 0;
#X connect 6 0 4 0;
#X connect 6 1 3 0;
#X connect 6 2 2 0;
#X connect 6 3 5 0;
#X connect 7 0 1 0;
#X connect 8 0 7 0;
#X connect 9 0 7 1;
#X connect 10 0 7 2;
#X connect 11 0 7 3;
#X restore 29 169 pd randomlistRGBA;
#X floatatom 28 252 5 0 0 0 - - -;
#X msg 28 284 \; mesh removecolor \$1;
#X msg 28 356 \; mesh clearcolors;
#X text 73 254 remove vertex color by index;
#X text 27 334 remove all vertex colors;
#X floatatom 28 412 5 0 0 0 - - -;
#X msg 29 197 \; mesh addcolor \$1 \$2 \$3 \$4;
#X msg 28 437 \; mesh setcolor \$1 1 0 0 1;
#X text 27 480 index \, r \, g \, b \, a;
#X text 149 364 (careful \, old color remains);
#X text 207 447 (careful \, add color first!);
#X text 21 6 replace with a plane primitive \, mesh mode 0 \, draw
fill;
#X msg 27 26 \; mesh prim ofPlanePrimitive 40 40 8 8 0 \; mesh draw
fill \; mesh mode 0;
#X text 70 411 index of vertex color in red;
#X connect 0 0 5 0;
#X connect 1 0 0 0;
#X connect 2 0 1 0;
#X connect 5 0 12 0;
#X connect 6 0 7 0;
#X connect 11 0 13 0;
#X restore 410 262 pd Color_vertex;
#N canvas 767 50 451 532 Textures_coordinate 0;
#X floatatom 31 303 5 0 0 0 - - -;
#X obj 31 118 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1
-1;
#X obj 31 92 metro 40;
#X obj 31 71 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 1
;
#X msg 31 174 \; mesh addtexcoord \$1 \$2;
#N canvas 178 426 597 300 randomlistTexture 0;
#X obj 72 19 inlet;
#X obj 72 151 outlet;
#X obj 172 73 random 10;
#X obj 72 73 random 10;
#X obj 174 100 / 10;
#X obj 72 100 / 10;
#X obj 72 46 t b b, f 15;
#X obj 72 127 pack 0 0, f 15;
#X connect 0 0 6 0;
#X connect 2 0 4 0;
#X connect 3 0 5 0;
#X connect 4 0 7 1;
#X connect 5 0 7 0;
#X connect 6 0 3 0;
#X connect 6 1 2 0;
#X connect 7 0 1 0;
#X restore 31 142 pd randomlistTexture;
#X msg 33 458 \; mesh cleartexcoords;
#X text 32 438 clear all texture coordinate;
#X msg 31 244 \; mesh addtexcoords \$1 \$2 \$3;
#X text 73 300 remove texture coordinate by index;
#X msg 31 328 \; mesh removetexcoord \$1;
#X text 52 115 add new random texture coordinate;
#X text 26 221 add an array of texture coordinate (not implemented)
;
#X text 26 -31 replace with a plane primitive and mesh mode 0;
#X msg 33 -7 \; mesh prim ofPlanePrimitive 40 40 8 8 0 \; mesh cleartexcoords
\; mesh clearcolors \; mesh mode 0;
#X floatatom 31 373 5 0 0 0 - - -;
#X text 73 370 index of vertex coordinate;
#X text 229 416 index \, x \, y;
#X msg 31 398 \; mesh settexcoord \$1 0 0;
#X text 215 401 (careful \, add coordinates first!);
#X connect 0 0 10 0;
#X connect 1 0 5 0;
#X connect 2 0 1 0;
#X connect 3 0 2 0;
#X connect 5 0 4 0;
#X connect 15 0 18 0;
#X restore 410 286 pd Textures_coordinate;
#X obj 467 44 of.window 1;
#X msg 33 405 clear;
#X text 78 404 clearall;
#X text 261 496 -> get infos;
#X text 198 538 -> get infos as list;
#X text 272 293 strokeweight 0-10;
#X text 229 217 Primitive draw mode;
#X obj 36 443 receive mesh;
#X text 99 302 interactive cam;
#X connect 0 0 29 0;
#X connect 1 0 23 0;
#X connect 2 0 23 0;
#X connect 3 0 23 0;
#X connect 4 0 23 0;
#X connect 5 0 4 0;
#X connect 6 0 23 0;
#X connect 7 0 8 0;
#X connect 7 1 9 0;
#X connect 7 2 10 0;
#X connect 7 3 11 0;
#X connect 7 4 12 0;
#X connect 13 0 23 0;
#X connect 14 0 13 0;
#X connect 15 0 23 0;
#X connect 20 0 23 0;
#X connect 21 0 1 0;
#X connect 22 0 39 0;
#X connect 23 1 7 0;
#X connect 24 0 39 0;
#X connect 26 0 23 0;
#X connect 27 0 26 0;
#X connect 28 0 29 1;
#X connect 29 0 24 0;
#X connect 35 0 43 0;
#X connect 36 0 23 0;
#X connect 37 0 36 0;
#X connect 39 0 23 0;
#X connect 44 0 23 0;
#X connect 50 0 23 0;