picrate 0.5.0-java → 0.6.0-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.mvn/wrapper/maven-wrapper.properties +1 -1
- data/CHANGELOG.md +3 -1
- data/README.md +1 -1
- data/Rakefile +8 -6
- data/docs/_editors/geany.md +5 -4
- data/docs/_editors/vim.md +6 -0
- data/docs/_includes/head.html +1 -0
- data/docs/_libraries/control_panel.md +2 -2
- data/docs/_libraries/gl_video.md +21 -0
- data/docs/_posts/2018-05-06-getting_started.md +10 -9
- data/docs/_posts/2018-05-06-install_jruby.md +19 -2
- data/docs/_posts/2018-06-26-auto_install_picrate.md +19 -4
- data/docs/_posts/2018-11-18-building-gem.md +18 -0
- data/docs/_posts/2018-11-27-getting_started_geany.md +38 -0
- data/docs/about.md +21 -10
- data/docs/assets/android-chrome-192x192.png +0 -0
- data/docs/assets/android-chrome-512x512.png +0 -0
- data/docs/assets/favicon.ico +0 -0
- data/docs/assets/geany.png +0 -0
- data/docs/assets/jwishy_picrate.png +0 -0
- data/docs/assets/picrate.svg +251 -0
- data/docs/index.html +8 -14
- data/lib/picrate/runner.rb +6 -2
- data/lib/picrate/version.rb +1 -1
- data/library/boids/boids.rb +10 -13
- data/mvnw +234 -0
- data/picrate.gemspec +2 -1
- data/pom.rb +1 -1
- data/pom.xml +1 -1
- data/src/main/java/japplemenubar/JAppleMenuBar.java +10 -2
- data/src/main/java/monkstone/ColorUtil.java +11 -1
- data/src/main/java/monkstone/MathToolModule.java +1 -0
- data/src/main/java/monkstone/PicrateLibrary.java +1 -0
- data/src/main/java/monkstone/fastmath/Deglut.java +1 -0
- data/src/main/java/monkstone/noise/SimplexNoise.java +3 -3
- data/src/main/java/monkstone/slider/CustomHorizontalSlider.java +1 -1
- data/src/main/java/monkstone/slider/CustomVerticalSlider.java +1 -1
- data/src/main/java/monkstone/slider/SimpleHorizontalSlider.java +1 -1
- data/src/main/java/monkstone/slider/SimpleSlider.java +8 -8
- data/src/main/java/monkstone/slider/SimpleVerticalSlider.java +1 -1
- data/src/main/java/monkstone/slider/Slider.java +3 -3
- data/src/main/java/monkstone/slider/SliderBar.java +1 -1
- data/src/main/java/monkstone/slider/SliderGroup.java +1 -1
- data/src/main/java/monkstone/vecmath/AppRender.java +1 -0
- data/src/main/java/monkstone/vecmath/JRender.java +1 -0
- data/src/main/java/monkstone/vecmath/ShapeRender.java +1 -0
- data/src/main/java/monkstone/vecmath/vec2/Vec2.java +8 -0
- data/src/main/java/monkstone/vecmath/vec3/Vec3.java +1 -0
- data/src/main/java/processing/awt/PGraphicsJava2D.java +85 -16
- data/src/main/java/processing/awt/PSurfaceAWT.java +1 -1
- data/src/main/java/processing/core/PApplet.java +18 -12
- data/src/main/java/processing/core/PShape.java +1182 -305
- data/src/main/java/processing/core/PStyle.java +1 -1
- data/src/main/java/processing/core/PSurface.java +1 -1
- data/src/main/java/processing/data/FloatDict.java +196 -54
- data/src/main/java/processing/data/FloatList.java +167 -54
- data/src/main/java/processing/data/IntDict.java +211 -56
- data/src/main/java/processing/data/IntList.java +185 -52
- data/src/main/java/processing/data/JSONArray.java +69 -20
- data/src/main/java/processing/data/JSONObject.java +53 -12
- data/src/main/java/processing/data/Sort.java +40 -10
- data/src/main/java/processing/data/StringDict.java +159 -49
- data/src/main/java/processing/data/StringList.java +147 -42
- data/src/main/java/processing/data/Table.java +778 -223
- data/src/main/java/processing/data/TableRow.java +26 -2
- data/src/main/java/processing/data/XML.java +190 -50
- data/src/main/java/processing/event/Event.java +93 -0
- data/src/main/java/processing/event/KeyEvent.java +55 -13
- data/src/main/java/processing/event/MouseEvent.java +77 -1
- data/src/main/java/processing/event/TouchEvent.java +14 -1
- data/src/main/java/processing/javafx/PGraphicsFX2D.java +8 -0
- data/src/main/java/processing/opengl/FrameBuffer.java +228 -66
- data/src/main/java/processing/opengl/LinePath.java +131 -27
- data/src/main/java/processing/opengl/LineStroker.java +30 -5
- data/src/main/java/processing/opengl/PGL.java +4066 -865
- data/src/main/java/processing/opengl/PGraphics2D.java +38 -10
- data/src/main/java/processing/opengl/PGraphics3D.java +38 -6
- data/src/main/java/processing/opengl/PGraphicsOpenGL.java +1980 -474
- data/src/main/java/processing/opengl/PJOGL.java +1460 -248
- data/src/main/java/processing/opengl/PShader.java +904 -217
- data/src/main/java/processing/opengl/PShapeOpenGL.java +1811 -487
- data/src/main/java/processing/opengl/PSurfaceJOGL.java +278 -71
- data/src/main/java/processing/opengl/Texture.java +610 -135
- data/src/main/java/processing/opengl/VertexBuffer.java +45 -9
- data/src/main/resources/icon/icon-1024.png +0 -0
- data/src/main/resources/icon/icon-128.png +0 -0
- data/src/main/resources/icon/icon-16.png +0 -0
- data/src/main/resources/icon/icon-256.png +0 -0
- data/src/main/resources/icon/icon-32.png +0 -0
- data/src/main/resources/icon/icon-48.png +0 -0
- data/src/main/resources/icon/icon-512.png +0 -0
- data/src/main/resources/icon/icon-64.png +0 -0
- data/vendors/Rakefile +1 -1
- metadata +13 -6
- data/docs/assets/circle_collisions.png +0 -0
- data/docs/favicon.ico +0 -0
@@ -64,127 +64,415 @@ import java.util.Stack;
|
|
64
64
|
*/
|
65
65
|
public class PShapeOpenGL extends PShape {
|
66
66
|
// Testing these constants, not use as they might go away...
|
67
|
-
static public final int POSITION = 0;
|
68
|
-
static public final int NORMAL = 1;
|
69
|
-
static public final int TEXCOORD = 2;
|
70
|
-
static public final int DIRECTION = 3;
|
71
|
-
static public final int OFFSET = 4;
|
72
|
-
|
73
|
-
static protected final int TRANSLATE = 0;
|
74
|
-
static protected final int ROTATE = 1;
|
75
|
-
static protected final int SCALE = 2;
|
76
|
-
static protected final int MATRIX = 3;
|
77
67
|
|
78
|
-
|
79
|
-
|
80
|
-
|
68
|
+
/**
|
69
|
+
*
|
70
|
+
*/
|
71
|
+
static public final int POSITION = 0;
|
81
72
|
|
82
|
-
|
73
|
+
/**
|
74
|
+
*
|
75
|
+
*/
|
76
|
+
static public final int NORMAL = 1;
|
77
|
+
|
78
|
+
/**
|
79
|
+
*
|
80
|
+
*/
|
81
|
+
static public final int TEXCOORD = 2;
|
82
|
+
|
83
|
+
/**
|
84
|
+
*
|
85
|
+
*/
|
86
|
+
static public final int DIRECTION = 3;
|
87
|
+
|
88
|
+
/**
|
89
|
+
*
|
90
|
+
*/
|
91
|
+
static public final int OFFSET = 4;
|
92
|
+
|
93
|
+
/**
|
94
|
+
*
|
95
|
+
*/
|
96
|
+
static protected final int TRANSLATE = 0;
|
97
|
+
|
98
|
+
/**
|
99
|
+
*
|
100
|
+
*/
|
101
|
+
static protected final int ROTATE = 1;
|
102
|
+
|
103
|
+
/**
|
104
|
+
*
|
105
|
+
*/
|
106
|
+
static protected final int SCALE = 2;
|
107
|
+
|
108
|
+
/**
|
109
|
+
*
|
110
|
+
*/
|
111
|
+
static protected final int MATRIX = 3;
|
112
|
+
|
113
|
+
/**
|
114
|
+
*
|
115
|
+
*/
|
116
|
+
protected PGraphicsOpenGL pg;
|
117
|
+
|
118
|
+
/**
|
119
|
+
*
|
120
|
+
*/
|
121
|
+
protected PGL pgl;
|
122
|
+
|
123
|
+
/**
|
124
|
+
*
|
125
|
+
*/
|
126
|
+
protected int context; // The context that created this shape.
|
127
|
+
|
128
|
+
/**
|
129
|
+
*
|
130
|
+
*/
|
131
|
+
protected PShapeOpenGL root;
|
83
132
|
|
84
133
|
// ........................................................
|
85
134
|
|
86
135
|
// Input, tessellated geometry
|
87
136
|
|
137
|
+
/**
|
138
|
+
*
|
139
|
+
*/
|
140
|
+
|
88
141
|
protected InGeometry inGeo;
|
89
|
-
protected TessGeometry tessGeo;
|
90
|
-
protected Tessellator tessellator;
|
91
142
|
|
92
|
-
|
143
|
+
/**
|
144
|
+
*
|
145
|
+
*/
|
146
|
+
protected TessGeometry tessGeo;
|
147
|
+
|
148
|
+
/**
|
149
|
+
*
|
150
|
+
*/
|
151
|
+
protected Tessellator tessellator;
|
152
|
+
|
153
|
+
/**
|
154
|
+
*
|
155
|
+
*/
|
156
|
+
protected AttributeMap polyAttribs;
|
93
157
|
|
94
158
|
// ........................................................
|
95
159
|
|
96
160
|
// Texturing
|
97
161
|
|
162
|
+
/**
|
163
|
+
*
|
164
|
+
*/
|
165
|
+
|
98
166
|
protected HashSet<PImage> textures;
|
99
|
-
|
100
|
-
|
167
|
+
|
168
|
+
/**
|
169
|
+
*
|
170
|
+
*/
|
171
|
+
protected boolean strokedTexture;
|
172
|
+
|
173
|
+
/**
|
174
|
+
*
|
175
|
+
*/
|
176
|
+
protected boolean untexChild;
|
101
177
|
|
102
178
|
// ........................................................
|
103
179
|
|
104
180
|
// OpenGL buffers
|
105
181
|
|
182
|
+
/**
|
183
|
+
*
|
184
|
+
*/
|
185
|
+
|
106
186
|
protected VertexBuffer bufPolyVertex;
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
187
|
+
|
188
|
+
/**
|
189
|
+
*
|
190
|
+
*/
|
191
|
+
protected VertexBuffer bufPolyColor;
|
192
|
+
|
193
|
+
/**
|
194
|
+
*
|
195
|
+
*/
|
196
|
+
protected VertexBuffer bufPolyNormal;
|
197
|
+
|
198
|
+
/**
|
199
|
+
*
|
200
|
+
*/
|
201
|
+
protected VertexBuffer bufPolyTexcoord;
|
202
|
+
|
203
|
+
/**
|
204
|
+
*
|
205
|
+
*/
|
206
|
+
protected VertexBuffer bufPolyAmbient;
|
207
|
+
|
208
|
+
/**
|
209
|
+
*
|
210
|
+
*/
|
211
|
+
protected VertexBuffer bufPolySpecular;
|
212
|
+
|
213
|
+
/**
|
214
|
+
*
|
215
|
+
*/
|
216
|
+
protected VertexBuffer bufPolyEmissive;
|
217
|
+
|
218
|
+
/**
|
219
|
+
*
|
220
|
+
*/
|
221
|
+
protected VertexBuffer bufPolyShininess;
|
222
|
+
|
223
|
+
/**
|
224
|
+
*
|
225
|
+
*/
|
226
|
+
protected VertexBuffer bufPolyIndex;
|
227
|
+
|
228
|
+
/**
|
229
|
+
*
|
230
|
+
*/
|
231
|
+
protected VertexBuffer bufLineVertex;
|
232
|
+
|
233
|
+
/**
|
234
|
+
*
|
235
|
+
*/
|
236
|
+
protected VertexBuffer bufLineColor;
|
237
|
+
|
238
|
+
/**
|
239
|
+
*
|
240
|
+
*/
|
241
|
+
protected VertexBuffer bufLineAttrib;
|
242
|
+
|
243
|
+
/**
|
244
|
+
*
|
245
|
+
*/
|
246
|
+
protected VertexBuffer bufLineIndex;
|
247
|
+
|
248
|
+
/**
|
249
|
+
*
|
250
|
+
*/
|
251
|
+
protected VertexBuffer bufPointVertex;
|
252
|
+
|
253
|
+
/**
|
254
|
+
*
|
255
|
+
*/
|
256
|
+
protected VertexBuffer bufPointColor;
|
257
|
+
|
258
|
+
/**
|
259
|
+
*
|
260
|
+
*/
|
261
|
+
protected VertexBuffer bufPointAttrib;
|
262
|
+
|
263
|
+
/**
|
264
|
+
*
|
265
|
+
*/
|
266
|
+
protected VertexBuffer bufPointIndex;
|
125
267
|
|
126
268
|
// Testing this field, not use as it might go away...
|
269
|
+
|
270
|
+
/**
|
271
|
+
*
|
272
|
+
*/
|
127
273
|
public int glUsage = PGL.STATIC_DRAW;
|
128
274
|
|
129
275
|
// ........................................................
|
130
276
|
|
131
277
|
// Offsets for geometry aggregation and update.
|
132
278
|
|
279
|
+
/**
|
280
|
+
*
|
281
|
+
*/
|
282
|
+
|
133
283
|
protected int polyVertCopyOffset;
|
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
|
-
|
284
|
+
|
285
|
+
/**
|
286
|
+
*
|
287
|
+
*/
|
288
|
+
protected int polyIndCopyOffset;
|
289
|
+
|
290
|
+
/**
|
291
|
+
*
|
292
|
+
*/
|
293
|
+
protected int lineVertCopyOffset;
|
294
|
+
|
295
|
+
/**
|
296
|
+
*
|
297
|
+
*/
|
298
|
+
protected int lineIndCopyOffset;
|
299
|
+
|
300
|
+
/**
|
301
|
+
*
|
302
|
+
*/
|
303
|
+
protected int pointVertCopyOffset;
|
304
|
+
|
305
|
+
/**
|
306
|
+
*
|
307
|
+
*/
|
308
|
+
protected int pointIndCopyOffset;
|
309
|
+
|
310
|
+
/**
|
311
|
+
*
|
312
|
+
*/
|
313
|
+
protected int polyIndexOffset;
|
314
|
+
|
315
|
+
/**
|
316
|
+
*
|
317
|
+
*/
|
318
|
+
protected int polyVertexOffset;
|
319
|
+
|
320
|
+
/**
|
321
|
+
*
|
322
|
+
*/
|
323
|
+
protected int polyVertexAbs;
|
324
|
+
|
325
|
+
/**
|
326
|
+
*
|
327
|
+
*/
|
328
|
+
protected int polyVertexRel;
|
329
|
+
|
330
|
+
/**
|
331
|
+
*
|
332
|
+
*/
|
333
|
+
protected int lineIndexOffset;
|
334
|
+
|
335
|
+
/**
|
336
|
+
*
|
337
|
+
*/
|
338
|
+
protected int lineVertexOffset;
|
339
|
+
|
340
|
+
/**
|
341
|
+
*
|
342
|
+
*/
|
343
|
+
protected int lineVertexAbs;
|
344
|
+
|
345
|
+
/**
|
346
|
+
*
|
347
|
+
*/
|
348
|
+
protected int lineVertexRel;
|
349
|
+
|
350
|
+
/**
|
351
|
+
*
|
352
|
+
*/
|
353
|
+
protected int pointIndexOffset;
|
354
|
+
|
355
|
+
/**
|
356
|
+
*
|
357
|
+
*/
|
358
|
+
protected int pointVertexOffset;
|
359
|
+
|
360
|
+
/**
|
361
|
+
*
|
362
|
+
*/
|
363
|
+
protected int pointVertexAbs;
|
364
|
+
|
365
|
+
/**
|
366
|
+
*
|
367
|
+
*/
|
368
|
+
protected int pointVertexRel;
|
369
|
+
|
370
|
+
/**
|
371
|
+
*
|
372
|
+
*/
|
373
|
+
protected int firstPolyIndexCache;
|
374
|
+
|
375
|
+
/**
|
376
|
+
*
|
377
|
+
*/
|
378
|
+
protected int lastPolyIndexCache;
|
379
|
+
|
380
|
+
/**
|
381
|
+
*
|
382
|
+
*/
|
383
|
+
protected int firstLineIndexCache;
|
384
|
+
|
385
|
+
/**
|
386
|
+
*
|
387
|
+
*/
|
388
|
+
protected int lastLineIndexCache;
|
389
|
+
|
390
|
+
/**
|
391
|
+
*
|
392
|
+
*/
|
393
|
+
protected int firstPointIndexCache;
|
394
|
+
|
395
|
+
/**
|
396
|
+
*
|
397
|
+
*/
|
398
|
+
protected int lastPointIndexCache;
|
399
|
+
|
400
|
+
/**
|
401
|
+
*
|
402
|
+
*/
|
403
|
+
protected int firstPolyVertex;
|
404
|
+
|
405
|
+
/**
|
406
|
+
*
|
407
|
+
*/
|
408
|
+
protected int lastPolyVertex;
|
409
|
+
|
410
|
+
/**
|
411
|
+
*
|
412
|
+
*/
|
413
|
+
protected int firstLineVertex;
|
414
|
+
|
415
|
+
/**
|
416
|
+
*
|
417
|
+
*/
|
418
|
+
protected int lastLineVertex;
|
419
|
+
|
420
|
+
/**
|
421
|
+
*
|
422
|
+
*/
|
423
|
+
protected int firstPointVertex;
|
424
|
+
|
425
|
+
/**
|
426
|
+
*
|
427
|
+
*/
|
428
|
+
protected int lastPointVertex;
|
168
429
|
|
169
430
|
// ........................................................
|
170
431
|
|
171
432
|
// Geometric transformations.
|
172
433
|
|
434
|
+
/**
|
435
|
+
*
|
436
|
+
*/
|
437
|
+
|
173
438
|
protected PMatrix transform;
|
174
|
-
|
439
|
+
|
440
|
+
/**
|
441
|
+
*
|
442
|
+
*/
|
443
|
+
protected Stack<PMatrix> transformStack;
|
175
444
|
|
176
445
|
// ........................................................
|
177
446
|
|
178
447
|
// State/rendering flags
|
179
448
|
|
449
|
+
/**
|
450
|
+
*
|
451
|
+
*/
|
452
|
+
|
180
453
|
protected boolean tessellated;
|
181
|
-
|
454
|
+
|
455
|
+
/**
|
456
|
+
*
|
457
|
+
*/
|
458
|
+
protected boolean needBufferInit = false;
|
182
459
|
|
183
460
|
// Flag to indicate if the shape can have holes or not.
|
461
|
+
|
462
|
+
/**
|
463
|
+
*
|
464
|
+
*/
|
184
465
|
protected boolean solid = true;
|
185
466
|
|
186
|
-
|
187
|
-
|
467
|
+
/**
|
468
|
+
*
|
469
|
+
*/
|
470
|
+
protected boolean breakShape = false;
|
471
|
+
|
472
|
+
/**
|
473
|
+
*
|
474
|
+
*/
|
475
|
+
protected boolean shapeCreated = false;
|
188
476
|
|
189
477
|
// These variables indicate if the shape contains
|
190
478
|
// polygon, line and/or point geometry. In the case of
|
@@ -193,122 +481,409 @@ public class PShapeOpenGL extends PShape {
|
|
193
481
|
// However, for 2D shapes the poly geometry contains all of
|
194
482
|
// the three since the same rendering shader applies to
|
195
483
|
// fill, line and point geometry.
|
484
|
+
|
485
|
+
/**
|
486
|
+
*
|
487
|
+
*/
|
196
488
|
protected boolean hasPolys;
|
197
|
-
|
198
|
-
|
489
|
+
|
490
|
+
/**
|
491
|
+
*
|
492
|
+
*/
|
493
|
+
protected boolean hasLines;
|
494
|
+
|
495
|
+
/**
|
496
|
+
*
|
497
|
+
*/
|
498
|
+
protected boolean hasPoints;
|
199
499
|
|
200
500
|
// ........................................................
|
201
501
|
|
202
502
|
// Bezier and Catmull-Rom curves
|
203
503
|
|
504
|
+
/**
|
505
|
+
*
|
506
|
+
*/
|
507
|
+
|
204
508
|
protected int bezierDetail;
|
205
|
-
protected int curveDetail;
|
206
|
-
protected float curveTightness;
|
207
509
|
|
208
|
-
|
209
|
-
|
210
|
-
|
510
|
+
/**
|
511
|
+
*
|
512
|
+
*/
|
513
|
+
protected int curveDetail;
|
514
|
+
|
515
|
+
/**
|
516
|
+
*
|
517
|
+
*/
|
518
|
+
protected float curveTightness;
|
519
|
+
|
520
|
+
/**
|
521
|
+
*
|
522
|
+
*/
|
523
|
+
protected int savedBezierDetail;
|
524
|
+
|
525
|
+
/**
|
526
|
+
*
|
527
|
+
*/
|
528
|
+
protected int savedCurveDetail;
|
529
|
+
|
530
|
+
/**
|
531
|
+
*
|
532
|
+
*/
|
533
|
+
protected float savedCurveTightness;
|
211
534
|
|
212
535
|
// ........................................................
|
213
536
|
|
214
537
|
// Normals
|
215
538
|
|
216
|
-
|
539
|
+
/**
|
540
|
+
*
|
541
|
+
*/
|
542
|
+
|
543
|
+
protected float normalX,
|
544
|
+
|
545
|
+
/**
|
546
|
+
*
|
547
|
+
*/
|
548
|
+
normalY,
|
549
|
+
|
550
|
+
/**
|
551
|
+
*
|
552
|
+
*/
|
553
|
+
normalZ;
|
217
554
|
|
218
555
|
// normal calculated per triangle
|
556
|
+
|
557
|
+
/**
|
558
|
+
*
|
559
|
+
*/
|
219
560
|
static protected final int NORMAL_MODE_AUTO = 0;
|
220
561
|
// one normal manually specified per shape
|
562
|
+
|
563
|
+
/**
|
564
|
+
*
|
565
|
+
*/
|
221
566
|
static protected final int NORMAL_MODE_SHAPE = 1;
|
222
567
|
// normals specified for each shape vertex
|
568
|
+
|
569
|
+
/**
|
570
|
+
*
|
571
|
+
*/
|
223
572
|
static protected final int NORMAL_MODE_VERTEX = 2;
|
224
573
|
|
225
574
|
// Current mode for normals, one of AUTO, SHAPE, or VERTEX
|
575
|
+
|
576
|
+
/**
|
577
|
+
*
|
578
|
+
*/
|
226
579
|
protected int normalMode;
|
227
580
|
|
228
581
|
// ........................................................
|
229
582
|
|
230
583
|
// Modification variables (used only by the root shape)
|
231
584
|
|
585
|
+
/**
|
586
|
+
*
|
587
|
+
*/
|
588
|
+
|
232
589
|
protected boolean modified;
|
233
590
|
|
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
|
-
|
591
|
+
/**
|
592
|
+
*
|
593
|
+
*/
|
594
|
+
protected boolean modifiedPolyVertices;
|
595
|
+
|
596
|
+
/**
|
597
|
+
*
|
598
|
+
*/
|
599
|
+
protected boolean modifiedPolyColors;
|
600
|
+
|
601
|
+
/**
|
602
|
+
*
|
603
|
+
*/
|
604
|
+
protected boolean modifiedPolyNormals;
|
605
|
+
|
606
|
+
/**
|
607
|
+
*
|
608
|
+
*/
|
609
|
+
protected boolean modifiedPolyTexCoords;
|
610
|
+
|
611
|
+
/**
|
612
|
+
*
|
613
|
+
*/
|
614
|
+
protected boolean modifiedPolyAmbient;
|
615
|
+
|
616
|
+
/**
|
617
|
+
*
|
618
|
+
*/
|
619
|
+
protected boolean modifiedPolySpecular;
|
620
|
+
|
621
|
+
/**
|
622
|
+
*
|
623
|
+
*/
|
624
|
+
protected boolean modifiedPolyEmissive;
|
625
|
+
|
626
|
+
/**
|
627
|
+
*
|
628
|
+
*/
|
629
|
+
protected boolean modifiedPolyShininess;
|
630
|
+
|
631
|
+
/**
|
632
|
+
*
|
633
|
+
*/
|
634
|
+
protected boolean modifiedLineVertices;
|
635
|
+
|
636
|
+
/**
|
637
|
+
*
|
638
|
+
*/
|
639
|
+
protected boolean modifiedLineColors;
|
640
|
+
|
641
|
+
/**
|
642
|
+
*
|
643
|
+
*/
|
644
|
+
protected boolean modifiedLineAttributes;
|
645
|
+
|
646
|
+
/**
|
647
|
+
*
|
648
|
+
*/
|
649
|
+
protected boolean modifiedPointVertices;
|
650
|
+
|
651
|
+
/**
|
652
|
+
*
|
653
|
+
*/
|
654
|
+
protected boolean modifiedPointColors;
|
655
|
+
|
656
|
+
/**
|
657
|
+
*
|
658
|
+
*/
|
659
|
+
protected boolean modifiedPointAttributes;
|
660
|
+
|
661
|
+
/**
|
662
|
+
*
|
663
|
+
*/
|
664
|
+
protected int firstModifiedPolyVertex;
|
665
|
+
|
666
|
+
/**
|
667
|
+
*
|
668
|
+
*/
|
669
|
+
protected int lastModifiedPolyVertex;
|
670
|
+
|
671
|
+
/**
|
672
|
+
*
|
673
|
+
*/
|
674
|
+
protected int firstModifiedPolyColor;
|
675
|
+
|
676
|
+
/**
|
677
|
+
*
|
678
|
+
*/
|
679
|
+
protected int lastModifiedPolyColor;
|
680
|
+
|
681
|
+
/**
|
682
|
+
*
|
683
|
+
*/
|
684
|
+
protected int firstModifiedPolyNormal;
|
685
|
+
|
686
|
+
/**
|
687
|
+
*
|
688
|
+
*/
|
689
|
+
protected int lastModifiedPolyNormal;
|
690
|
+
|
691
|
+
/**
|
692
|
+
*
|
693
|
+
*/
|
694
|
+
protected int firstModifiedPolyTexcoord;
|
695
|
+
|
696
|
+
/**
|
697
|
+
*
|
698
|
+
*/
|
699
|
+
protected int lastModifiedPolyTexcoord;
|
700
|
+
|
701
|
+
/**
|
702
|
+
*
|
703
|
+
*/
|
704
|
+
protected int firstModifiedPolyAmbient;
|
705
|
+
|
706
|
+
/**
|
707
|
+
*
|
708
|
+
*/
|
709
|
+
protected int lastModifiedPolyAmbient;
|
710
|
+
|
711
|
+
/**
|
712
|
+
*
|
713
|
+
*/
|
714
|
+
protected int firstModifiedPolySpecular;
|
715
|
+
|
716
|
+
/**
|
717
|
+
*
|
718
|
+
*/
|
719
|
+
protected int lastModifiedPolySpecular;
|
720
|
+
|
721
|
+
/**
|
722
|
+
*
|
723
|
+
*/
|
724
|
+
protected int firstModifiedPolyEmissive;
|
725
|
+
|
726
|
+
/**
|
727
|
+
*
|
728
|
+
*/
|
729
|
+
protected int lastModifiedPolyEmissive;
|
730
|
+
|
731
|
+
/**
|
732
|
+
*
|
733
|
+
*/
|
734
|
+
protected int firstModifiedPolyShininess;
|
735
|
+
|
736
|
+
/**
|
737
|
+
*
|
738
|
+
*/
|
739
|
+
protected int lastModifiedPolyShininess;
|
740
|
+
|
741
|
+
/**
|
742
|
+
*
|
743
|
+
*/
|
744
|
+
protected int firstModifiedLineVertex;
|
745
|
+
|
746
|
+
/**
|
747
|
+
*
|
748
|
+
*/
|
749
|
+
protected int lastModifiedLineVertex;
|
750
|
+
|
751
|
+
/**
|
752
|
+
*
|
753
|
+
*/
|
754
|
+
protected int firstModifiedLineColor;
|
755
|
+
|
756
|
+
/**
|
757
|
+
*
|
758
|
+
*/
|
759
|
+
protected int lastModifiedLineColor;
|
760
|
+
|
761
|
+
/**
|
762
|
+
*
|
763
|
+
*/
|
764
|
+
protected int firstModifiedLineAttribute;
|
765
|
+
|
766
|
+
/**
|
767
|
+
*
|
768
|
+
*/
|
769
|
+
protected int lastModifiedLineAttribute;
|
770
|
+
|
771
|
+
/**
|
772
|
+
*
|
773
|
+
*/
|
774
|
+
protected int firstModifiedPointVertex;
|
775
|
+
|
776
|
+
/**
|
777
|
+
*
|
778
|
+
*/
|
779
|
+
protected int lastModifiedPointVertex;
|
780
|
+
|
781
|
+
/**
|
782
|
+
*
|
783
|
+
*/
|
784
|
+
protected int firstModifiedPointColor;
|
785
|
+
|
786
|
+
/**
|
787
|
+
*
|
788
|
+
*/
|
789
|
+
protected int lastModifiedPointColor;
|
790
|
+
|
791
|
+
/**
|
792
|
+
*
|
793
|
+
*/
|
794
|
+
protected int firstModifiedPointAttribute;
|
795
|
+
|
796
|
+
/**
|
797
|
+
*
|
798
|
+
*/
|
799
|
+
protected int lastModifiedPointAttribute;
|
281
800
|
|
282
801
|
// ........................................................
|
283
802
|
|
284
803
|
// Saved style variables to style can be re-enabled after disableStyle,
|
285
804
|
// although it won't work if properties are defined on a per-vertex basis.
|
286
805
|
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
protected int savedStrokeCap;
|
291
|
-
protected int savedStrokeJoin;
|
292
|
-
|
293
|
-
protected boolean savedFill;
|
294
|
-
protected int savedFillColor;
|
295
|
-
|
296
|
-
protected boolean savedTint;
|
297
|
-
protected int savedTintColor;
|
806
|
+
/**
|
807
|
+
*
|
808
|
+
*/
|
298
809
|
|
299
|
-
protected
|
300
|
-
protected int savedSpecularColor;
|
301
|
-
protected int savedEmissiveColor;
|
302
|
-
protected float savedShininess;
|
810
|
+
protected boolean savedStroke;
|
303
811
|
|
304
|
-
|
812
|
+
/**
|
813
|
+
*
|
814
|
+
*/
|
815
|
+
protected int savedStrokeColor;
|
816
|
+
|
817
|
+
/**
|
818
|
+
*
|
819
|
+
*/
|
820
|
+
protected float savedStrokeWeight;
|
821
|
+
|
822
|
+
/**
|
823
|
+
*
|
824
|
+
*/
|
825
|
+
protected int savedStrokeCap;
|
826
|
+
|
827
|
+
/**
|
828
|
+
*
|
829
|
+
*/
|
830
|
+
protected int savedStrokeJoin;
|
831
|
+
|
832
|
+
/**
|
833
|
+
*
|
834
|
+
*/
|
835
|
+
protected boolean savedFill;
|
836
|
+
|
837
|
+
/**
|
838
|
+
*
|
839
|
+
*/
|
840
|
+
protected int savedFillColor;
|
841
|
+
|
842
|
+
/**
|
843
|
+
*
|
844
|
+
*/
|
845
|
+
protected boolean savedTint;
|
846
|
+
|
847
|
+
/**
|
848
|
+
*
|
849
|
+
*/
|
850
|
+
protected int savedTintColor;
|
851
|
+
|
852
|
+
/**
|
853
|
+
*
|
854
|
+
*/
|
855
|
+
protected int savedAmbientColor;
|
856
|
+
|
857
|
+
/**
|
858
|
+
*
|
859
|
+
*/
|
860
|
+
protected int savedSpecularColor;
|
861
|
+
|
862
|
+
/**
|
863
|
+
*
|
864
|
+
*/
|
865
|
+
protected int savedEmissiveColor;
|
866
|
+
|
867
|
+
/**
|
868
|
+
*
|
869
|
+
*/
|
870
|
+
protected float savedShininess;
|
871
|
+
|
872
|
+
/**
|
873
|
+
*
|
874
|
+
*/
|
875
|
+
protected int savedTextureMode;
|
305
876
|
|
306
877
|
|
307
878
|
PShapeOpenGL() {
|
308
879
|
}
|
309
880
|
|
310
|
-
|
311
|
-
|
881
|
+
/**
|
882
|
+
*
|
883
|
+
* @param pg
|
884
|
+
* @param family
|
885
|
+
*/
|
886
|
+
public PShapeOpenGL(PGraphicsOpenGL pg, int family) {
|
312
887
|
this.pg = pg;
|
313
888
|
this.family = family;
|
314
889
|
|
@@ -403,7 +978,10 @@ public class PShapeOpenGL extends PShape {
|
|
403
978
|
}
|
404
979
|
|
405
980
|
|
406
|
-
/** Create a shape from the PRIMITIVE family, using this kind and these params
|
981
|
+
/** Create a shape from the PRIMITIVE family, using this kind and these params
|
982
|
+
* @param pg
|
983
|
+
* @param kind
|
984
|
+
* @param p */
|
407
985
|
public PShapeOpenGL(PGraphicsOpenGL pg, int kind, float... p) {
|
408
986
|
this(pg, PRIMITIVE);
|
409
987
|
setKind(kind);
|
@@ -501,8 +1079,11 @@ public class PShapeOpenGL extends PShape {
|
|
501
1079
|
markForTessellation();
|
502
1080
|
}
|
503
1081
|
|
504
|
-
|
505
|
-
|
1082
|
+
/**
|
1083
|
+
*
|
1084
|
+
* @param root
|
1085
|
+
*/
|
1086
|
+
protected void updateRoot(PShape root) {
|
506
1087
|
this.root = (PShapeOpenGL) root;
|
507
1088
|
if (family == GROUP) {
|
508
1089
|
for (int i = 0; i < childCount; i++) {
|
@@ -518,6 +1099,13 @@ public class PShapeOpenGL extends PShape {
|
|
518
1099
|
//
|
519
1100
|
// Shape creation (temporary hack)
|
520
1101
|
|
1102
|
+
/**
|
1103
|
+
*
|
1104
|
+
* @param pg
|
1105
|
+
* @param src
|
1106
|
+
* @return
|
1107
|
+
*/
|
1108
|
+
|
521
1109
|
|
522
1110
|
public static PShapeOpenGL createShape(PGraphicsOpenGL pg, PShape src) {
|
523
1111
|
PShapeOpenGL dest = null;
|
@@ -573,6 +1161,14 @@ public class PShapeOpenGL extends PShape {
|
|
573
1161
|
}
|
574
1162
|
*/
|
575
1163
|
|
1164
|
+
/**
|
1165
|
+
*
|
1166
|
+
* @param pg
|
1167
|
+
* @param src
|
1168
|
+
* @param dest
|
1169
|
+
*/
|
1170
|
+
|
1171
|
+
|
576
1172
|
static public void copyGroup(PGraphicsOpenGL pg, PShape src, PShape dest) {
|
577
1173
|
copyMatrix(src, dest);
|
578
1174
|
copyStyles(src, dest);
|
@@ -649,8 +1245,11 @@ public class PShapeOpenGL extends PShape {
|
|
649
1245
|
return depth;
|
650
1246
|
}
|
651
1247
|
|
652
|
-
|
653
|
-
|
1248
|
+
/**
|
1249
|
+
*
|
1250
|
+
* @param min
|
1251
|
+
*/
|
1252
|
+
protected void getVertexMin(PVector min) {
|
654
1253
|
updateTessellation();
|
655
1254
|
|
656
1255
|
if (family == GROUP) {
|
@@ -673,8 +1272,11 @@ public class PShapeOpenGL extends PShape {
|
|
673
1272
|
}
|
674
1273
|
}
|
675
1274
|
|
676
|
-
|
677
|
-
|
1275
|
+
/**
|
1276
|
+
*
|
1277
|
+
* @param max
|
1278
|
+
*/
|
1279
|
+
protected void getVertexMax(PVector max) {
|
678
1280
|
updateTessellation();
|
679
1281
|
|
680
1282
|
if (family == GROUP) {
|
@@ -697,8 +1299,13 @@ public class PShapeOpenGL extends PShape {
|
|
697
1299
|
}
|
698
1300
|
}
|
699
1301
|
|
700
|
-
|
701
|
-
|
1302
|
+
/**
|
1303
|
+
*
|
1304
|
+
* @param sum
|
1305
|
+
* @param count
|
1306
|
+
* @return
|
1307
|
+
*/
|
1308
|
+
protected int getVertexSum(PVector sum, int count) {
|
702
1309
|
updateTessellation();
|
703
1310
|
|
704
1311
|
if (family == GROUP) {
|
@@ -731,6 +1338,11 @@ public class PShapeOpenGL extends PShape {
|
|
731
1338
|
|
732
1339
|
// Drawing methods
|
733
1340
|
|
1341
|
+
/**
|
1342
|
+
*
|
1343
|
+
* @param mode
|
1344
|
+
*/
|
1345
|
+
|
734
1346
|
|
735
1347
|
@Override
|
736
1348
|
public void setTextureMode(int mode) {
|
@@ -749,8 +1361,11 @@ public class PShapeOpenGL extends PShape {
|
|
749
1361
|
}
|
750
1362
|
}
|
751
1363
|
|
752
|
-
|
753
|
-
|
1364
|
+
/**
|
1365
|
+
*
|
1366
|
+
* @param mode
|
1367
|
+
*/
|
1368
|
+
protected void setTextureModeImpl(int mode) {
|
754
1369
|
if (textureMode == mode) return;
|
755
1370
|
textureMode = mode;
|
756
1371
|
if (image != null) {
|
@@ -764,8 +1379,11 @@ public class PShapeOpenGL extends PShape {
|
|
764
1379
|
}
|
765
1380
|
}
|
766
1381
|
|
767
|
-
|
768
|
-
|
1382
|
+
/**
|
1383
|
+
*
|
1384
|
+
* @param tex
|
1385
|
+
*/
|
1386
|
+
@Override
|
769
1387
|
public void setTexture(PImage tex) {
|
770
1388
|
if (openShape) {
|
771
1389
|
PGraphics.showWarning(INSIDE_BEGIN_END_ERROR, "setTexture()");
|
@@ -782,8 +1400,11 @@ public class PShapeOpenGL extends PShape {
|
|
782
1400
|
}
|
783
1401
|
}
|
784
1402
|
|
785
|
-
|
786
|
-
|
1403
|
+
/**
|
1404
|
+
*
|
1405
|
+
* @param tex
|
1406
|
+
*/
|
1407
|
+
protected void setTextureImpl(PImage tex) {
|
787
1408
|
PImage image0 = image;
|
788
1409
|
image = tex;
|
789
1410
|
|
@@ -813,8 +1434,12 @@ public class PShapeOpenGL extends PShape {
|
|
813
1434
|
}
|
814
1435
|
}
|
815
1436
|
|
816
|
-
|
817
|
-
|
1437
|
+
/**
|
1438
|
+
*
|
1439
|
+
* @param uFactor
|
1440
|
+
* @param vFactor
|
1441
|
+
*/
|
1442
|
+
protected void scaleTextureUV(float uFactor, float vFactor) {
|
818
1443
|
if (PGraphicsOpenGL.same(uFactor, 1) &&
|
819
1444
|
PGraphicsOpenGL.same(vFactor, 1)) return;
|
820
1445
|
|
@@ -844,8 +1469,11 @@ public class PShapeOpenGL extends PShape {
|
|
844
1469
|
}
|
845
1470
|
}
|
846
1471
|
|
847
|
-
|
848
|
-
|
1472
|
+
/**
|
1473
|
+
*
|
1474
|
+
* @param tex
|
1475
|
+
*/
|
1476
|
+
protected void addTexture(PImage tex) {
|
849
1477
|
if (textures == null) {
|
850
1478
|
textures = new HashSet<PImage>();
|
851
1479
|
}
|
@@ -855,8 +1483,12 @@ public class PShapeOpenGL extends PShape {
|
|
855
1483
|
}
|
856
1484
|
}
|
857
1485
|
|
858
|
-
|
859
|
-
|
1486
|
+
/**
|
1487
|
+
*
|
1488
|
+
* @param tex
|
1489
|
+
* @param caller
|
1490
|
+
*/
|
1491
|
+
protected void removeTexture(PImage tex, PShapeOpenGL caller) {
|
860
1492
|
if (textures == null || !textures.contains(tex)) return; // Nothing to remove.
|
861
1493
|
|
862
1494
|
// First check that none of the child shapes have texture tex...
|
@@ -885,13 +1517,20 @@ public class PShapeOpenGL extends PShape {
|
|
885
1517
|
}
|
886
1518
|
}
|
887
1519
|
|
888
|
-
|
889
|
-
|
1520
|
+
/**
|
1521
|
+
*
|
1522
|
+
* @param newValue
|
1523
|
+
*/
|
1524
|
+
protected void strokedTexture(boolean newValue) {
|
890
1525
|
strokedTexture(newValue, null);
|
891
1526
|
}
|
892
1527
|
|
893
|
-
|
894
|
-
|
1528
|
+
/**
|
1529
|
+
*
|
1530
|
+
* @param newValue
|
1531
|
+
* @param caller
|
1532
|
+
*/
|
1533
|
+
protected void strokedTexture(boolean newValue, PShapeOpenGL caller) {
|
895
1534
|
if (strokedTexture == newValue) return; // Nothing to change.
|
896
1535
|
|
897
1536
|
if (newValue) {
|
@@ -915,13 +1554,20 @@ public class PShapeOpenGL extends PShape {
|
|
915
1554
|
}
|
916
1555
|
}
|
917
1556
|
|
918
|
-
|
919
|
-
|
1557
|
+
/**
|
1558
|
+
*
|
1559
|
+
* @param newValue
|
1560
|
+
*/
|
1561
|
+
protected void untexChild(boolean newValue) {
|
920
1562
|
untexChild(newValue, null);
|
921
1563
|
}
|
922
1564
|
|
923
|
-
|
924
|
-
|
1565
|
+
/**
|
1566
|
+
*
|
1567
|
+
* @param newValue
|
1568
|
+
* @param caller
|
1569
|
+
*/
|
1570
|
+
protected void untexChild(boolean newValue, PShapeOpenGL caller) {
|
925
1571
|
if (untexChild == newValue) return; // Nothing to change.
|
926
1572
|
|
927
1573
|
if (newValue) {
|
@@ -945,8 +1591,11 @@ public class PShapeOpenGL extends PShape {
|
|
945
1591
|
}
|
946
1592
|
}
|
947
1593
|
|
948
|
-
|
949
|
-
|
1594
|
+
/**
|
1595
|
+
*
|
1596
|
+
* @return
|
1597
|
+
*/
|
1598
|
+
protected boolean hasTexture() {
|
950
1599
|
if (family == GROUP) {
|
951
1600
|
return textures != null && 0 < textures.size();
|
952
1601
|
} else {
|
@@ -954,8 +1603,12 @@ public class PShapeOpenGL extends PShape {
|
|
954
1603
|
}
|
955
1604
|
}
|
956
1605
|
|
957
|
-
|
958
|
-
|
1606
|
+
/**
|
1607
|
+
*
|
1608
|
+
* @param tex
|
1609
|
+
* @return
|
1610
|
+
*/
|
1611
|
+
protected boolean hasTexture(PImage tex) {
|
959
1612
|
if (family == GROUP) {
|
960
1613
|
return textures != null && textures.contains(tex);
|
961
1614
|
} else {
|
@@ -963,8 +1616,11 @@ public class PShapeOpenGL extends PShape {
|
|
963
1616
|
}
|
964
1617
|
}
|
965
1618
|
|
966
|
-
|
967
|
-
|
1619
|
+
/**
|
1620
|
+
*
|
1621
|
+
* @return
|
1622
|
+
*/
|
1623
|
+
protected boolean hasStrokedTexture() {
|
968
1624
|
if (family == GROUP) {
|
969
1625
|
return strokedTexture;
|
970
1626
|
} else {
|
@@ -972,8 +1628,11 @@ public class PShapeOpenGL extends PShape {
|
|
972
1628
|
}
|
973
1629
|
}
|
974
1630
|
|
975
|
-
|
976
|
-
|
1631
|
+
/**
|
1632
|
+
*
|
1633
|
+
* @param solid
|
1634
|
+
*/
|
1635
|
+
@Override
|
977
1636
|
public void solid(boolean solid) {
|
978
1637
|
if (family == GROUP) {
|
979
1638
|
for (int i = 0; i < childCount; i++) {
|
@@ -985,47 +1644,80 @@ public class PShapeOpenGL extends PShape {
|
|
985
1644
|
}
|
986
1645
|
}
|
987
1646
|
|
988
|
-
|
989
|
-
|
1647
|
+
/**
|
1648
|
+
*
|
1649
|
+
*/
|
1650
|
+
@Override
|
990
1651
|
protected void beginContourImpl() {
|
991
1652
|
breakShape = true;
|
992
1653
|
}
|
993
1654
|
|
994
|
-
|
995
|
-
|
1655
|
+
/**
|
1656
|
+
*
|
1657
|
+
*/
|
1658
|
+
@Override
|
996
1659
|
protected void endContourImpl() {
|
997
1660
|
}
|
998
1661
|
|
999
|
-
|
1000
|
-
|
1662
|
+
/**
|
1663
|
+
*
|
1664
|
+
* @param x
|
1665
|
+
* @param y
|
1666
|
+
*/
|
1667
|
+
@Override
|
1001
1668
|
public void vertex(float x, float y) {
|
1002
1669
|
vertexImpl(x, y, 0, 0, 0);
|
1003
1670
|
if (image != null)
|
1004
1671
|
PGraphics.showWarning(PGraphicsOpenGL.MISSING_UV_TEXCOORDS_ERROR);
|
1005
1672
|
}
|
1006
1673
|
|
1007
|
-
|
1008
|
-
|
1674
|
+
/**
|
1675
|
+
*
|
1676
|
+
* @param x
|
1677
|
+
* @param y
|
1678
|
+
* @param u
|
1679
|
+
* @param v
|
1680
|
+
*/
|
1681
|
+
@Override
|
1009
1682
|
public void vertex(float x, float y, float u, float v) {
|
1010
1683
|
vertexImpl(x, y, 0, u, v);
|
1011
1684
|
}
|
1012
1685
|
|
1013
|
-
|
1014
|
-
|
1686
|
+
/**
|
1687
|
+
*
|
1688
|
+
* @param x
|
1689
|
+
* @param y
|
1690
|
+
* @param z
|
1691
|
+
*/
|
1692
|
+
@Override
|
1015
1693
|
public void vertex(float x, float y, float z) {
|
1016
1694
|
vertexImpl(x, y, z, 0, 0);
|
1017
1695
|
if (image != null)
|
1018
1696
|
PGraphics.showWarning(PGraphicsOpenGL.MISSING_UV_TEXCOORDS_ERROR);
|
1019
1697
|
}
|
1020
1698
|
|
1021
|
-
|
1022
|
-
|
1699
|
+
/**
|
1700
|
+
*
|
1701
|
+
* @param x
|
1702
|
+
* @param y
|
1703
|
+
* @param z
|
1704
|
+
* @param u
|
1705
|
+
* @param v
|
1706
|
+
*/
|
1707
|
+
@Override
|
1023
1708
|
public void vertex(float x, float y, float z, float u, float v) {
|
1024
1709
|
vertexImpl(x, y, z, u, v);
|
1025
1710
|
}
|
1026
1711
|
|
1027
|
-
|
1028
|
-
|
1712
|
+
/**
|
1713
|
+
*
|
1714
|
+
* @param x
|
1715
|
+
* @param y
|
1716
|
+
* @param z
|
1717
|
+
* @param u
|
1718
|
+
* @param v
|
1719
|
+
*/
|
1720
|
+
protected void vertexImpl(float x, float y, float z, float u, float v) {
|
1029
1721
|
if (!openShape) {
|
1030
1722
|
PGraphics.showWarning(OUTSIDE_BEGIN_END_ERROR, "vertex()");
|
1031
1723
|
return;
|
@@ -1073,8 +1765,11 @@ public class PShapeOpenGL extends PShape {
|
|
1073
1765
|
markForTessellation();
|
1074
1766
|
}
|
1075
1767
|
|
1076
|
-
|
1077
|
-
|
1768
|
+
/**
|
1769
|
+
*
|
1770
|
+
* @return
|
1771
|
+
*/
|
1772
|
+
protected boolean vertexBreak() {
|
1078
1773
|
if (breakShape) {
|
1079
1774
|
breakShape = false;
|
1080
1775
|
return true;
|
@@ -1082,8 +1777,13 @@ public class PShapeOpenGL extends PShape {
|
|
1082
1777
|
return false;
|
1083
1778
|
}
|
1084
1779
|
|
1085
|
-
|
1086
|
-
|
1780
|
+
/**
|
1781
|
+
*
|
1782
|
+
* @param nx
|
1783
|
+
* @param ny
|
1784
|
+
* @param nz
|
1785
|
+
*/
|
1786
|
+
@Override
|
1087
1787
|
public void normal(float nx, float ny, float nz) {
|
1088
1788
|
if (!openShape) {
|
1089
1789
|
PGraphics.showWarning(OUTSIDE_BEGIN_END_ERROR, "normal()");
|
@@ -1110,55 +1810,90 @@ public class PShapeOpenGL extends PShape {
|
|
1110
1810
|
}
|
1111
1811
|
}
|
1112
1812
|
|
1113
|
-
|
1114
|
-
|
1813
|
+
/**
|
1814
|
+
*
|
1815
|
+
* @param name
|
1816
|
+
* @param x
|
1817
|
+
* @param y
|
1818
|
+
* @param z
|
1819
|
+
*/
|
1820
|
+
@Override
|
1115
1821
|
public void attribPosition(String name, float x, float y, float z) {
|
1116
1822
|
VertexAttribute attrib = attribImpl(name, VertexAttribute.POSITION,
|
1117
1823
|
PGL.FLOAT, 3);
|
1118
1824
|
if (attrib != null) attrib.set(x, y, z);
|
1119
1825
|
}
|
1120
1826
|
|
1121
|
-
|
1122
|
-
|
1827
|
+
/**
|
1828
|
+
*
|
1829
|
+
* @param name
|
1830
|
+
* @param nx
|
1831
|
+
* @param ny
|
1832
|
+
* @param nz
|
1833
|
+
*/
|
1834
|
+
@Override
|
1123
1835
|
public void attribNormal(String name, float nx, float ny, float nz) {
|
1124
1836
|
VertexAttribute attrib = attribImpl(name, VertexAttribute.NORMAL,
|
1125
1837
|
PGL.FLOAT, 3);
|
1126
1838
|
if (attrib != null) attrib.set(nx, ny, nz);
|
1127
1839
|
}
|
1128
1840
|
|
1129
|
-
|
1130
|
-
|
1841
|
+
/**
|
1842
|
+
*
|
1843
|
+
* @param name
|
1844
|
+
* @param color
|
1845
|
+
*/
|
1846
|
+
@Override
|
1131
1847
|
public void attribColor(String name, int color) {
|
1132
1848
|
VertexAttribute attrib = attribImpl(name, VertexAttribute.COLOR, PGL.INT, 1);
|
1133
1849
|
if (attrib != null) attrib.set(new int[] {color});
|
1134
1850
|
}
|
1135
1851
|
|
1136
|
-
|
1137
|
-
|
1852
|
+
/**
|
1853
|
+
*
|
1854
|
+
* @param name
|
1855
|
+
* @param values
|
1856
|
+
*/
|
1857
|
+
@Override
|
1138
1858
|
public void attrib(String name, float... values) {
|
1139
1859
|
VertexAttribute attrib = attribImpl(name, VertexAttribute.OTHER, PGL.FLOAT,
|
1140
1860
|
values.length);
|
1141
1861
|
if (attrib != null) attrib.set(values);
|
1142
1862
|
}
|
1143
1863
|
|
1144
|
-
|
1145
|
-
|
1864
|
+
/**
|
1865
|
+
*
|
1866
|
+
* @param name
|
1867
|
+
* @param values
|
1868
|
+
*/
|
1869
|
+
@Override
|
1146
1870
|
public void attrib(String name, int... values) {
|
1147
1871
|
VertexAttribute attrib = attribImpl(name, VertexAttribute.OTHER, PGL.INT,
|
1148
1872
|
values.length);
|
1149
1873
|
if (attrib != null) attrib.set(values);
|
1150
1874
|
}
|
1151
1875
|
|
1152
|
-
|
1153
|
-
|
1876
|
+
/**
|
1877
|
+
*
|
1878
|
+
* @param name
|
1879
|
+
* @param values
|
1880
|
+
*/
|
1881
|
+
@Override
|
1154
1882
|
public void attrib(String name, boolean... values) {
|
1155
1883
|
VertexAttribute attrib = attribImpl(name, VertexAttribute.OTHER, PGL.BOOL,
|
1156
1884
|
values.length);
|
1157
1885
|
if (attrib != null) attrib.set(values);
|
1158
1886
|
}
|
1159
1887
|
|
1160
|
-
|
1161
|
-
|
1888
|
+
/**
|
1889
|
+
*
|
1890
|
+
* @param name
|
1891
|
+
* @param kind
|
1892
|
+
* @param type
|
1893
|
+
* @param size
|
1894
|
+
* @return
|
1895
|
+
*/
|
1896
|
+
protected VertexAttribute attribImpl(String name, int kind, int type, int size) {
|
1162
1897
|
if (4 < size) {
|
1163
1898
|
PGraphics.showWarning("Vertex attributes cannot have more than 4 values");
|
1164
1899
|
return null;
|
@@ -1184,8 +1919,11 @@ public class PShapeOpenGL extends PShape {
|
|
1184
1919
|
return attrib;
|
1185
1920
|
}
|
1186
1921
|
|
1187
|
-
|
1188
|
-
|
1922
|
+
/**
|
1923
|
+
*
|
1924
|
+
* @param mode
|
1925
|
+
*/
|
1926
|
+
@Override
|
1189
1927
|
public void endShape(int mode) {
|
1190
1928
|
super.endShape(mode);
|
1191
1929
|
|
@@ -1198,8 +1936,11 @@ public class PShapeOpenGL extends PShape {
|
|
1198
1936
|
shapeCreated = true;
|
1199
1937
|
}
|
1200
1938
|
|
1201
|
-
|
1202
|
-
|
1939
|
+
/**
|
1940
|
+
*
|
1941
|
+
* @param source
|
1942
|
+
*/
|
1943
|
+
@Override
|
1203
1944
|
public void setParams(float[] source) {
|
1204
1945
|
if (family != PRIMITIVE) {
|
1205
1946
|
PGraphics.showWarning("Parameters can only be set to PRIMITIVE shapes");
|
@@ -1211,8 +1952,14 @@ public class PShapeOpenGL extends PShape {
|
|
1211
1952
|
shapeCreated = true;
|
1212
1953
|
}
|
1213
1954
|
|
1214
|
-
|
1215
|
-
|
1955
|
+
/**
|
1956
|
+
*
|
1957
|
+
* @param vcount
|
1958
|
+
* @param verts
|
1959
|
+
* @param ccount
|
1960
|
+
* @param codes
|
1961
|
+
*/
|
1962
|
+
@Override
|
1216
1963
|
public void setPath(int vcount, float[][] verts, int ccount, int[] codes) {
|
1217
1964
|
if (family != PATH) {
|
1218
1965
|
PGraphics.showWarning("Vertex coordinates and codes can only be set to " +
|
@@ -1288,8 +2035,12 @@ public class PShapeOpenGL extends PShape {
|
|
1288
2035
|
}
|
1289
2036
|
}
|
1290
2037
|
|
1291
|
-
|
1292
|
-
|
2038
|
+
/**
|
2039
|
+
*
|
2040
|
+
* @param x
|
2041
|
+
* @param y
|
2042
|
+
*/
|
2043
|
+
@Override
|
1293
2044
|
public void scale(float x, float y) {
|
1294
2045
|
if (is3D) {
|
1295
2046
|
transform(SCALE, x, y, 1);
|
@@ -1304,23 +2055,52 @@ public class PShapeOpenGL extends PShape {
|
|
1304
2055
|
transform(SCALE, x, y, z);
|
1305
2056
|
}
|
1306
2057
|
|
1307
|
-
|
1308
|
-
|
2058
|
+
/**
|
2059
|
+
*
|
2060
|
+
* @param source
|
2061
|
+
*/
|
2062
|
+
@Override
|
1309
2063
|
public void applyMatrix(PMatrix2D source) {
|
1310
2064
|
transform(MATRIX, source.m00, source.m01, source.m02,
|
1311
2065
|
source.m10, source.m11, source.m12);
|
1312
2066
|
}
|
1313
2067
|
|
1314
|
-
|
1315
|
-
|
2068
|
+
/**
|
2069
|
+
*
|
2070
|
+
* @param n00
|
2071
|
+
* @param n01
|
2072
|
+
* @param n02
|
2073
|
+
* @param n10
|
2074
|
+
* @param n11
|
2075
|
+
* @param n12
|
2076
|
+
*/
|
2077
|
+
@Override
|
1316
2078
|
public void applyMatrix(float n00, float n01, float n02,
|
1317
2079
|
float n10, float n11, float n12) {
|
1318
2080
|
transform(MATRIX, n00, n01, n02,
|
1319
2081
|
n10, n11, n12);
|
1320
2082
|
}
|
1321
2083
|
|
1322
|
-
|
1323
|
-
|
2084
|
+
/**
|
2085
|
+
*
|
2086
|
+
* @param n00
|
2087
|
+
* @param n01
|
2088
|
+
* @param n02
|
2089
|
+
* @param n03
|
2090
|
+
* @param n10
|
2091
|
+
* @param n11
|
2092
|
+
* @param n12
|
2093
|
+
* @param n13
|
2094
|
+
* @param n20
|
2095
|
+
* @param n21
|
2096
|
+
* @param n22
|
2097
|
+
* @param n23
|
2098
|
+
* @param n30
|
2099
|
+
* @param n31
|
2100
|
+
* @param n32
|
2101
|
+
* @param n33
|
2102
|
+
*/
|
2103
|
+
@Override
|
1324
2104
|
public void applyMatrix(float n00, float n01, float n02, float n03,
|
1325
2105
|
float n10, float n11, float n12, float n13,
|
1326
2106
|
float n20, float n21, float n22, float n23,
|
@@ -1355,8 +2135,12 @@ public class PShapeOpenGL extends PShape {
|
|
1355
2135
|
}
|
1356
2136
|
}
|
1357
2137
|
|
1358
|
-
|
1359
|
-
|
2138
|
+
/**
|
2139
|
+
*
|
2140
|
+
* @param type
|
2141
|
+
* @param args
|
2142
|
+
*/
|
2143
|
+
protected void transform(int type, float... args) {
|
1360
2144
|
int dimensions = is3D ? 3 : 2;
|
1361
2145
|
checkMatrix(dimensions);
|
1362
2146
|
if (transform == null) {
|
@@ -1415,8 +2199,10 @@ public class PShapeOpenGL extends PShape {
|
|
1415
2199
|
if (tessellated) applyMatrixImpl(transform);
|
1416
2200
|
}
|
1417
2201
|
|
1418
|
-
|
1419
|
-
|
2202
|
+
/**
|
2203
|
+
*
|
2204
|
+
*/
|
2205
|
+
protected void pushTransform() {
|
1420
2206
|
if (transformStack == null) transformStack = new Stack<PMatrix>();
|
1421
2207
|
PMatrix mat;
|
1422
2208
|
if (transform instanceof PMatrix2D) {
|
@@ -1428,13 +2214,20 @@ public class PShapeOpenGL extends PShape {
|
|
1428
2214
|
transformStack.push(mat);
|
1429
2215
|
}
|
1430
2216
|
|
1431
|
-
|
1432
|
-
|
2217
|
+
/**
|
2218
|
+
*
|
2219
|
+
* @return
|
2220
|
+
*/
|
2221
|
+
protected PMatrix popTransform() {
|
1433
2222
|
if (transformStack == null || transformStack.size() == 0) return null;
|
1434
2223
|
return transformStack.pop();
|
1435
2224
|
}
|
1436
2225
|
|
1437
|
-
|
2226
|
+
/**
|
2227
|
+
*
|
2228
|
+
* @param matrix
|
2229
|
+
*/
|
2230
|
+
protected void applyMatrixImpl(PMatrix matrix) {
|
1438
2231
|
if (hasPolys) {
|
1439
2232
|
tessGeo.applyMatrixOnPolyGeometry(matrix,
|
1440
2233
|
firstPolyVertex, lastPolyVertex);
|
@@ -1471,6 +2264,11 @@ public class PShapeOpenGL extends PShape {
|
|
1471
2264
|
|
1472
2265
|
// Bezier curves
|
1473
2266
|
|
2267
|
+
/**
|
2268
|
+
*
|
2269
|
+
* @param detail
|
2270
|
+
*/
|
2271
|
+
|
1474
2272
|
|
1475
2273
|
@Override
|
1476
2274
|
public void bezierDetail(int detail) {
|
@@ -1481,8 +2279,16 @@ public class PShapeOpenGL extends PShape {
|
|
1481
2279
|
//pg.bezierDetail(detail); // setting the detail in the renderer, WTF??
|
1482
2280
|
}
|
1483
2281
|
|
1484
|
-
|
1485
|
-
|
2282
|
+
/**
|
2283
|
+
*
|
2284
|
+
* @param x2
|
2285
|
+
* @param y2
|
2286
|
+
* @param x3
|
2287
|
+
* @param y3
|
2288
|
+
* @param x4
|
2289
|
+
* @param y4
|
2290
|
+
*/
|
2291
|
+
@Override
|
1486
2292
|
public void bezierVertex(float x2, float y2,
|
1487
2293
|
float x3, float y3,
|
1488
2294
|
float x4, float y4) {
|
@@ -1491,8 +2297,19 @@ public class PShapeOpenGL extends PShape {
|
|
1491
2297
|
x4, y4, 0);
|
1492
2298
|
}
|
1493
2299
|
|
1494
|
-
|
1495
|
-
|
2300
|
+
/**
|
2301
|
+
*
|
2302
|
+
* @param x2
|
2303
|
+
* @param y2
|
2304
|
+
* @param z2
|
2305
|
+
* @param x3
|
2306
|
+
* @param y3
|
2307
|
+
* @param z3
|
2308
|
+
* @param x4
|
2309
|
+
* @param y4
|
2310
|
+
* @param z4
|
2311
|
+
*/
|
2312
|
+
@Override
|
1496
2313
|
public void bezierVertex(float x2, float y2, float z2,
|
1497
2314
|
float x3, float y3, float z3,
|
1498
2315
|
float x4, float y4, float z4) {
|
@@ -1501,8 +2318,19 @@ public class PShapeOpenGL extends PShape {
|
|
1501
2318
|
x4, y4, z4);
|
1502
2319
|
}
|
1503
2320
|
|
1504
|
-
|
1505
|
-
|
2321
|
+
/**
|
2322
|
+
*
|
2323
|
+
* @param x2
|
2324
|
+
* @param y2
|
2325
|
+
* @param z2
|
2326
|
+
* @param x3
|
2327
|
+
* @param y3
|
2328
|
+
* @param z3
|
2329
|
+
* @param x4
|
2330
|
+
* @param y4
|
2331
|
+
* @param z4
|
2332
|
+
*/
|
2333
|
+
protected void bezierVertexImpl(float x2, float y2, float z2,
|
1506
2334
|
float x3, float y3, float z3,
|
1507
2335
|
float x4, float y4, float z4) {
|
1508
2336
|
inGeo.setMaterial(fillColor, strokeColor, strokeWeight,
|
@@ -1513,24 +2341,46 @@ public class PShapeOpenGL extends PShape {
|
|
1513
2341
|
x4, y4, z4, vertexBreak());
|
1514
2342
|
}
|
1515
2343
|
|
1516
|
-
|
1517
|
-
|
2344
|
+
/**
|
2345
|
+
*
|
2346
|
+
* @param cx
|
2347
|
+
* @param cy
|
2348
|
+
* @param x3
|
2349
|
+
* @param y3
|
2350
|
+
*/
|
2351
|
+
@Override
|
1518
2352
|
public void quadraticVertex(float cx, float cy,
|
1519
2353
|
float x3, float y3) {
|
1520
2354
|
quadraticVertexImpl(cx, cy, 0,
|
1521
2355
|
x3, y3, 0);
|
1522
2356
|
}
|
1523
2357
|
|
1524
|
-
|
1525
|
-
|
2358
|
+
/**
|
2359
|
+
*
|
2360
|
+
* @param cx
|
2361
|
+
* @param cy
|
2362
|
+
* @param cz
|
2363
|
+
* @param x3
|
2364
|
+
* @param y3
|
2365
|
+
* @param z3
|
2366
|
+
*/
|
2367
|
+
@Override
|
1526
2368
|
public void quadraticVertex(float cx, float cy, float cz,
|
1527
2369
|
float x3, float y3, float z3) {
|
1528
2370
|
quadraticVertexImpl(cx, cy, cz,
|
1529
2371
|
x3, y3, z3);
|
1530
2372
|
}
|
1531
2373
|
|
1532
|
-
|
1533
|
-
|
2374
|
+
/**
|
2375
|
+
*
|
2376
|
+
* @param cx
|
2377
|
+
* @param cy
|
2378
|
+
* @param cz
|
2379
|
+
* @param x3
|
2380
|
+
* @param y3
|
2381
|
+
* @param z3
|
2382
|
+
*/
|
2383
|
+
protected void quadraticVertexImpl(float cx, float cy, float cz,
|
1534
2384
|
float x3, float y3, float z3) {
|
1535
2385
|
inGeo.setMaterial(fillColor, strokeColor, strokeWeight,
|
1536
2386
|
ambientColor, specularColor, emissiveColor, shininess);
|
@@ -1546,6 +2396,11 @@ public class PShapeOpenGL extends PShape {
|
|
1546
2396
|
|
1547
2397
|
// Catmull-Rom curves
|
1548
2398
|
|
2399
|
+
/**
|
2400
|
+
*
|
2401
|
+
* @param detail
|
2402
|
+
*/
|
2403
|
+
|
1549
2404
|
|
1550
2405
|
@Override
|
1551
2406
|
public void curveDetail(int detail) {
|
@@ -1556,8 +2411,11 @@ public class PShapeOpenGL extends PShape {
|
|
1556
2411
|
}
|
1557
2412
|
}
|
1558
2413
|
|
1559
|
-
|
1560
|
-
|
2414
|
+
/**
|
2415
|
+
*
|
2416
|
+
* @param tightness
|
2417
|
+
*/
|
2418
|
+
@Override
|
1561
2419
|
public void curveTightness(float tightness) {
|
1562
2420
|
curveTightness = tightness;
|
1563
2421
|
// pg.curveTightness(tightness);
|
@@ -1566,20 +2424,34 @@ public class PShapeOpenGL extends PShape {
|
|
1566
2424
|
}
|
1567
2425
|
}
|
1568
2426
|
|
1569
|
-
|
1570
|
-
|
2427
|
+
/**
|
2428
|
+
*
|
2429
|
+
* @param x
|
2430
|
+
* @param y
|
2431
|
+
*/
|
2432
|
+
@Override
|
1571
2433
|
public void curveVertex(float x, float y) {
|
1572
2434
|
curveVertexImpl(x, y, 0);
|
1573
2435
|
}
|
1574
2436
|
|
1575
|
-
|
1576
|
-
|
2437
|
+
/**
|
2438
|
+
*
|
2439
|
+
* @param x
|
2440
|
+
* @param y
|
2441
|
+
* @param z
|
2442
|
+
*/
|
2443
|
+
@Override
|
1577
2444
|
public void curveVertex(float x, float y, float z) {
|
1578
2445
|
curveVertexImpl(x, y, z);
|
1579
2446
|
}
|
1580
2447
|
|
1581
|
-
|
1582
|
-
|
2448
|
+
/**
|
2449
|
+
*
|
2450
|
+
* @param x
|
2451
|
+
* @param y
|
2452
|
+
* @param z
|
2453
|
+
*/
|
2454
|
+
protected void curveVertexImpl(float x, float y, float z) {
|
1583
2455
|
inGeo.setMaterial(fillColor, strokeColor, strokeWeight,
|
1584
2456
|
ambientColor, specularColor, emissiveColor, shininess);
|
1585
2457
|
inGeo.setNormal(normalX, normalY, normalZ);
|
@@ -1619,20 +2491,32 @@ public class PShapeOpenGL extends PShape {
|
|
1619
2491
|
return vec;
|
1620
2492
|
}
|
1621
2493
|
|
1622
|
-
|
1623
|
-
|
2494
|
+
/**
|
2495
|
+
*
|
2496
|
+
* @param index
|
2497
|
+
* @return
|
2498
|
+
*/
|
2499
|
+
@Override
|
1624
2500
|
public float getVertexX(int index) {
|
1625
2501
|
return inGeo.vertices[3 * index + 0];
|
1626
2502
|
}
|
1627
2503
|
|
1628
|
-
|
1629
|
-
|
2504
|
+
/**
|
2505
|
+
*
|
2506
|
+
* @param index
|
2507
|
+
* @return
|
2508
|
+
*/
|
2509
|
+
@Override
|
1630
2510
|
public float getVertexY(int index) {
|
1631
2511
|
return inGeo.vertices[3 * index + 1];
|
1632
2512
|
}
|
1633
2513
|
|
1634
|
-
|
1635
|
-
|
2514
|
+
/**
|
2515
|
+
*
|
2516
|
+
* @param index
|
2517
|
+
* @return
|
2518
|
+
*/
|
2519
|
+
@Override
|
1636
2520
|
public float getVertexZ(int index) {
|
1637
2521
|
return inGeo.vertices[3 * index + 2];
|
1638
2522
|
}
|
@@ -1703,8 +2587,13 @@ public class PShapeOpenGL extends PShape {
|
|
1703
2587
|
markForTessellation();
|
1704
2588
|
}
|
1705
2589
|
|
1706
|
-
|
1707
|
-
|
2590
|
+
/**
|
2591
|
+
*
|
2592
|
+
* @param index
|
2593
|
+
* @param vec
|
2594
|
+
* @return
|
2595
|
+
*/
|
2596
|
+
@Override
|
1708
2597
|
public PVector getNormal(int index, PVector vec) {
|
1709
2598
|
if (vec == null) {
|
1710
2599
|
vec = new PVector();
|
@@ -1715,26 +2604,44 @@ public class PShapeOpenGL extends PShape {
|
|
1715
2604
|
return vec;
|
1716
2605
|
}
|
1717
2606
|
|
1718
|
-
|
1719
|
-
|
2607
|
+
/**
|
2608
|
+
*
|
2609
|
+
* @param index
|
2610
|
+
* @return
|
2611
|
+
*/
|
2612
|
+
@Override
|
1720
2613
|
public float getNormalX(int index) {
|
1721
2614
|
return inGeo.normals[3 * index + 0];
|
1722
2615
|
}
|
1723
2616
|
|
1724
|
-
|
1725
|
-
|
2617
|
+
/**
|
2618
|
+
*
|
2619
|
+
* @param index
|
2620
|
+
* @return
|
2621
|
+
*/
|
2622
|
+
@Override
|
1726
2623
|
public float getNormalY(int index) {
|
1727
2624
|
return inGeo.normals[3 * index + 1];
|
1728
2625
|
}
|
1729
2626
|
|
1730
|
-
|
1731
|
-
|
2627
|
+
/**
|
2628
|
+
*
|
2629
|
+
* @param index
|
2630
|
+
* @return
|
2631
|
+
*/
|
2632
|
+
@Override
|
1732
2633
|
public float getNormalZ(int index) {
|
1733
2634
|
return inGeo.normals[3 * index + 2];
|
1734
2635
|
}
|
1735
2636
|
|
1736
|
-
|
1737
|
-
|
2637
|
+
/**
|
2638
|
+
*
|
2639
|
+
* @param index
|
2640
|
+
* @param nx
|
2641
|
+
* @param ny
|
2642
|
+
* @param nz
|
2643
|
+
*/
|
2644
|
+
@Override
|
1738
2645
|
public void setNormal(int index, float nx, float ny, float nz) {
|
1739
2646
|
if (openShape) {
|
1740
2647
|
PGraphics.showWarning(INSIDE_BEGIN_END_ERROR, "setNormal()");
|
@@ -1747,8 +2654,13 @@ public class PShapeOpenGL extends PShape {
|
|
1747
2654
|
markForTessellation();
|
1748
2655
|
}
|
1749
2656
|
|
1750
|
-
|
1751
|
-
|
2657
|
+
/**
|
2658
|
+
*
|
2659
|
+
* @param name
|
2660
|
+
* @param index
|
2661
|
+
* @param values
|
2662
|
+
*/
|
2663
|
+
@Override
|
1752
2664
|
public void setAttrib(String name, int index, float... values) {
|
1753
2665
|
if (openShape) {
|
1754
2666
|
PGraphics.showWarning(INSIDE_BEGIN_END_ERROR, "setNormal()");
|
@@ -1763,8 +2675,13 @@ public class PShapeOpenGL extends PShape {
|
|
1763
2675
|
markForTessellation();
|
1764
2676
|
}
|
1765
2677
|
|
1766
|
-
|
1767
|
-
|
2678
|
+
/**
|
2679
|
+
*
|
2680
|
+
* @param name
|
2681
|
+
* @param index
|
2682
|
+
* @param values
|
2683
|
+
*/
|
2684
|
+
@Override
|
1768
2685
|
public void setAttrib(String name, int index, int... values) {
|
1769
2686
|
if (openShape) {
|
1770
2687
|
PGraphics.showWarning(INSIDE_BEGIN_END_ERROR, "setNormal()");
|
@@ -1779,8 +2696,13 @@ public class PShapeOpenGL extends PShape {
|
|
1779
2696
|
markForTessellation();
|
1780
2697
|
}
|
1781
2698
|
|
1782
|
-
|
1783
|
-
|
2699
|
+
/**
|
2700
|
+
*
|
2701
|
+
* @param name
|
2702
|
+
* @param index
|
2703
|
+
* @param values
|
2704
|
+
*/
|
2705
|
+
@Override
|
1784
2706
|
public void setAttrib(String name, int index, boolean... values) {
|
1785
2707
|
if (openShape) {
|
1786
2708
|
PGraphics.showWarning(INSIDE_BEGIN_END_ERROR, "setNormal()");
|
@@ -1795,20 +2717,33 @@ public class PShapeOpenGL extends PShape {
|
|
1795
2717
|
markForTessellation();
|
1796
2718
|
}
|
1797
2719
|
|
1798
|
-
|
1799
|
-
|
2720
|
+
/**
|
2721
|
+
*
|
2722
|
+
* @param index
|
2723
|
+
* @return
|
2724
|
+
*/
|
2725
|
+
@Override
|
1800
2726
|
public float getTextureU(int index) {
|
1801
2727
|
return inGeo.texcoords[2 * index + 0];
|
1802
2728
|
}
|
1803
2729
|
|
1804
|
-
|
1805
|
-
|
2730
|
+
/**
|
2731
|
+
*
|
2732
|
+
* @param index
|
2733
|
+
* @return
|
2734
|
+
*/
|
2735
|
+
@Override
|
1806
2736
|
public float getTextureV(int index) {
|
1807
2737
|
return inGeo.texcoords[2 * index + 1];
|
1808
2738
|
}
|
1809
2739
|
|
1810
|
-
|
1811
|
-
|
2740
|
+
/**
|
2741
|
+
*
|
2742
|
+
* @param index
|
2743
|
+
* @param u
|
2744
|
+
* @param v
|
2745
|
+
*/
|
2746
|
+
@Override
|
1812
2747
|
public void setTextureUV(int index, float u, float v) {
|
1813
2748
|
if (openShape) {
|
1814
2749
|
PGraphics.showWarning(INSIDE_BEGIN_END_ERROR, "setTextureUV()");
|
@@ -1825,8 +2760,12 @@ public class PShapeOpenGL extends PShape {
|
|
1825
2760
|
markForTessellation();
|
1826
2761
|
}
|
1827
2762
|
|
1828
|
-
|
1829
|
-
|
2763
|
+
/**
|
2764
|
+
*
|
2765
|
+
* @param index
|
2766
|
+
* @return
|
2767
|
+
*/
|
2768
|
+
@Override
|
1830
2769
|
public int getFill(int index) {
|
1831
2770
|
if (family != GROUP && image == null) {
|
1832
2771
|
return PGL.nativeToJavaARGB(inGeo.colors[index]);
|
@@ -1872,8 +2811,11 @@ public class PShapeOpenGL extends PShape {
|
|
1872
2811
|
}
|
1873
2812
|
}
|
1874
2813
|
|
1875
|
-
|
1876
|
-
|
2814
|
+
/**
|
2815
|
+
*
|
2816
|
+
* @param fill
|
2817
|
+
*/
|
2818
|
+
protected void setFillImpl(int fill) {
|
1877
2819
|
if (fillColor == fill) return;
|
1878
2820
|
fillColor = fill;
|
1879
2821
|
|
@@ -1920,8 +2862,12 @@ public class PShapeOpenGL extends PShape {
|
|
1920
2862
|
}
|
1921
2863
|
}
|
1922
2864
|
|
1923
|
-
|
1924
|
-
|
2865
|
+
/**
|
2866
|
+
*
|
2867
|
+
* @param index
|
2868
|
+
* @return
|
2869
|
+
*/
|
2870
|
+
@Override
|
1925
2871
|
public int getTint(int index) {
|
1926
2872
|
if (family != GROUP && image != null) {
|
1927
2873
|
return PGL.nativeToJavaARGB(inGeo.colors[index]);
|
@@ -1930,8 +2876,11 @@ public class PShapeOpenGL extends PShape {
|
|
1930
2876
|
}
|
1931
2877
|
}
|
1932
2878
|
|
1933
|
-
|
1934
|
-
|
2879
|
+
/**
|
2880
|
+
*
|
2881
|
+
* @param tint
|
2882
|
+
*/
|
2883
|
+
@Override
|
1935
2884
|
public void setTint(boolean tint) {
|
1936
2885
|
if (openShape) {
|
1937
2886
|
PGraphics.showWarning(INSIDE_BEGIN_END_ERROR, "setTint()");
|
@@ -1949,8 +2898,11 @@ public class PShapeOpenGL extends PShape {
|
|
1949
2898
|
this.tint = tint;
|
1950
2899
|
}
|
1951
2900
|
|
1952
|
-
|
1953
|
-
|
2901
|
+
/**
|
2902
|
+
*
|
2903
|
+
* @param tint
|
2904
|
+
*/
|
2905
|
+
@Override
|
1954
2906
|
public void setTint(int tint) {
|
1955
2907
|
if (openShape) {
|
1956
2908
|
PGraphics.showWarning(INSIDE_BEGIN_END_ERROR, "setTint()");
|
@@ -1967,8 +2919,11 @@ public class PShapeOpenGL extends PShape {
|
|
1967
2919
|
}
|
1968
2920
|
}
|
1969
2921
|
|
1970
|
-
|
1971
|
-
|
2922
|
+
/**
|
2923
|
+
*
|
2924
|
+
* @param tint
|
2925
|
+
*/
|
2926
|
+
protected void setTintImpl(int tint) {
|
1972
2927
|
if (tintColor == tint) return;
|
1973
2928
|
tintColor = tint;
|
1974
2929
|
|
@@ -1992,8 +2947,12 @@ public class PShapeOpenGL extends PShape {
|
|
1992
2947
|
}
|
1993
2948
|
}
|
1994
2949
|
|
1995
|
-
|
1996
|
-
|
2950
|
+
/**
|
2951
|
+
*
|
2952
|
+
* @param index
|
2953
|
+
* @param tint
|
2954
|
+
*/
|
2955
|
+
@Override
|
1997
2956
|
public void setTint(int index, int tint) {
|
1998
2957
|
if (openShape) {
|
1999
2958
|
PGraphics.showWarning(INSIDE_BEGIN_END_ERROR, "setTint()");
|
@@ -2006,8 +2965,12 @@ public class PShapeOpenGL extends PShape {
|
|
2006
2965
|
}
|
2007
2966
|
}
|
2008
2967
|
|
2009
|
-
|
2010
|
-
|
2968
|
+
/**
|
2969
|
+
*
|
2970
|
+
* @param index
|
2971
|
+
* @return
|
2972
|
+
*/
|
2973
|
+
@Override
|
2011
2974
|
public int getStroke(int index) {
|
2012
2975
|
if (family != GROUP) {
|
2013
2976
|
return PGL.nativeToJavaARGB(inGeo.strokeColors[index]);
|
@@ -2035,8 +2998,11 @@ public class PShapeOpenGL extends PShape {
|
|
2035
2998
|
}
|
2036
2999
|
}
|
2037
3000
|
|
2038
|
-
|
2039
|
-
|
3001
|
+
/**
|
3002
|
+
*
|
3003
|
+
* @param stroke
|
3004
|
+
*/
|
3005
|
+
protected void setStrokeImpl(boolean stroke) {
|
2040
3006
|
if (this.stroke != stroke) {
|
2041
3007
|
if (stroke) {
|
2042
3008
|
// Before there was no stroke, now there is stroke, so current stroke
|
@@ -2074,8 +3040,11 @@ public class PShapeOpenGL extends PShape {
|
|
2074
3040
|
}
|
2075
3041
|
}
|
2076
3042
|
|
2077
|
-
|
2078
|
-
|
3043
|
+
/**
|
3044
|
+
*
|
3045
|
+
* @param stroke
|
3046
|
+
*/
|
3047
|
+
protected void setStrokeImpl(int stroke) {
|
2079
3048
|
if (strokeColor == stroke) return;
|
2080
3049
|
strokeColor = stroke;
|
2081
3050
|
|
@@ -2119,8 +3088,12 @@ public class PShapeOpenGL extends PShape {
|
|
2119
3088
|
markForTessellation();
|
2120
3089
|
}
|
2121
3090
|
|
2122
|
-
|
2123
|
-
|
3091
|
+
/**
|
3092
|
+
*
|
3093
|
+
* @param index
|
3094
|
+
* @return
|
3095
|
+
*/
|
3096
|
+
@Override
|
2124
3097
|
public float getStrokeWeight(int index) {
|
2125
3098
|
if (family != GROUP) {
|
2126
3099
|
return inGeo.strokeWeights[index];
|
@@ -2129,8 +3102,11 @@ public class PShapeOpenGL extends PShape {
|
|
2129
3102
|
}
|
2130
3103
|
}
|
2131
3104
|
|
2132
|
-
|
2133
|
-
|
3105
|
+
/**
|
3106
|
+
*
|
3107
|
+
* @param weight
|
3108
|
+
*/
|
3109
|
+
@Override
|
2134
3110
|
public void setStrokeWeight(float weight) {
|
2135
3111
|
if (openShape) {
|
2136
3112
|
PGraphics.showWarning(INSIDE_BEGIN_END_ERROR, "setStrokeWeight()");
|
@@ -2147,8 +3123,11 @@ public class PShapeOpenGL extends PShape {
|
|
2147
3123
|
}
|
2148
3124
|
}
|
2149
3125
|
|
2150
|
-
|
2151
|
-
|
3126
|
+
/**
|
3127
|
+
*
|
3128
|
+
* @param weight
|
3129
|
+
*/
|
3130
|
+
protected void setStrokeWeightImpl(float weight) {
|
2152
3131
|
if (PGraphicsOpenGL.same(strokeWeight, weight)) return;
|
2153
3132
|
float oldWeight = strokeWeight;
|
2154
3133
|
strokeWeight = weight;
|
@@ -2186,8 +3165,12 @@ public class PShapeOpenGL extends PShape {
|
|
2186
3165
|
}
|
2187
3166
|
}
|
2188
3167
|
|
2189
|
-
|
2190
|
-
|
3168
|
+
/**
|
3169
|
+
*
|
3170
|
+
* @param index
|
3171
|
+
* @param weight
|
3172
|
+
*/
|
3173
|
+
@Override
|
2191
3174
|
public void setStrokeWeight(int index, float weight) {
|
2192
3175
|
if (openShape) {
|
2193
3176
|
PGraphics.showWarning(INSIDE_BEGIN_END_ERROR, "setStrokeWeight()");
|
@@ -2198,8 +3181,11 @@ public class PShapeOpenGL extends PShape {
|
|
2198
3181
|
markForTessellation();
|
2199
3182
|
}
|
2200
3183
|
|
2201
|
-
|
2202
|
-
|
3184
|
+
/**
|
3185
|
+
*
|
3186
|
+
* @param join
|
3187
|
+
*/
|
3188
|
+
@Override
|
2203
3189
|
public void setStrokeJoin(int join) {
|
2204
3190
|
if (openShape) {
|
2205
3191
|
PGraphics.showWarning(INSIDE_BEGIN_END_ERROR, "setStrokeJoin()");
|
@@ -2222,8 +3208,11 @@ public class PShapeOpenGL extends PShape {
|
|
2222
3208
|
}
|
2223
3209
|
}
|
2224
3210
|
|
2225
|
-
|
2226
|
-
|
3211
|
+
/**
|
3212
|
+
*
|
3213
|
+
* @param cap
|
3214
|
+
*/
|
3215
|
+
@Override
|
2227
3216
|
public void setStrokeCap(int cap) {
|
2228
3217
|
if (openShape) {
|
2229
3218
|
PGraphics.showWarning(INSIDE_BEGIN_END_ERROR, "setStrokeCap()");
|
@@ -2246,8 +3235,12 @@ public class PShapeOpenGL extends PShape {
|
|
2246
3235
|
}
|
2247
3236
|
}
|
2248
3237
|
|
2249
|
-
|
2250
|
-
|
3238
|
+
/**
|
3239
|
+
*
|
3240
|
+
* @param index
|
3241
|
+
* @return
|
3242
|
+
*/
|
3243
|
+
@Override
|
2251
3244
|
public int getAmbient(int index) {
|
2252
3245
|
if (family != GROUP) {
|
2253
3246
|
return PGL.nativeToJavaARGB(inGeo.ambient[index]);
|
@@ -2256,8 +3249,11 @@ public class PShapeOpenGL extends PShape {
|
|
2256
3249
|
}
|
2257
3250
|
}
|
2258
3251
|
|
2259
|
-
|
2260
|
-
|
3252
|
+
/**
|
3253
|
+
*
|
3254
|
+
* @param ambient
|
3255
|
+
*/
|
3256
|
+
@Override
|
2261
3257
|
public void setAmbient(int ambient) {
|
2262
3258
|
if (openShape) {
|
2263
3259
|
PGraphics.showWarning(INSIDE_BEGIN_END_ERROR, "setAmbient()");
|
@@ -2274,8 +3270,11 @@ public class PShapeOpenGL extends PShape {
|
|
2274
3270
|
}
|
2275
3271
|
}
|
2276
3272
|
|
2277
|
-
|
2278
|
-
|
3273
|
+
/**
|
3274
|
+
*
|
3275
|
+
* @param ambient
|
3276
|
+
*/
|
3277
|
+
protected void setAmbientImpl(int ambient) {
|
2279
3278
|
if (ambientColor == ambient) return;
|
2280
3279
|
ambientColor = ambient;
|
2281
3280
|
|
@@ -2298,8 +3297,12 @@ public class PShapeOpenGL extends PShape {
|
|
2298
3297
|
setAmbient = true;
|
2299
3298
|
}
|
2300
3299
|
|
2301
|
-
|
2302
|
-
|
3300
|
+
/**
|
3301
|
+
*
|
3302
|
+
* @param index
|
3303
|
+
* @param ambient
|
3304
|
+
*/
|
3305
|
+
@Override
|
2303
3306
|
public void setAmbient(int index, int ambient) {
|
2304
3307
|
if (openShape) {
|
2305
3308
|
PGraphics.showWarning(INSIDE_BEGIN_END_ERROR, "setAmbient()");
|
@@ -2311,8 +3314,12 @@ public class PShapeOpenGL extends PShape {
|
|
2311
3314
|
setAmbient = true;
|
2312
3315
|
}
|
2313
3316
|
|
2314
|
-
|
2315
|
-
|
3317
|
+
/**
|
3318
|
+
*
|
3319
|
+
* @param index
|
3320
|
+
* @return
|
3321
|
+
*/
|
3322
|
+
@Override
|
2316
3323
|
public int getSpecular(int index) {
|
2317
3324
|
if (family == GROUP) {
|
2318
3325
|
return PGL.nativeToJavaARGB(inGeo.specular[index]);
|
@@ -2321,8 +3328,11 @@ public class PShapeOpenGL extends PShape {
|
|
2321
3328
|
}
|
2322
3329
|
}
|
2323
3330
|
|
2324
|
-
|
2325
|
-
|
3331
|
+
/**
|
3332
|
+
*
|
3333
|
+
* @param specular
|
3334
|
+
*/
|
3335
|
+
@Override
|
2326
3336
|
public void setSpecular(int specular) {
|
2327
3337
|
if (openShape) {
|
2328
3338
|
PGraphics.showWarning(INSIDE_BEGIN_END_ERROR, "setSpecular()");
|
@@ -2339,8 +3349,11 @@ public class PShapeOpenGL extends PShape {
|
|
2339
3349
|
}
|
2340
3350
|
}
|
2341
3351
|
|
2342
|
-
|
2343
|
-
|
3352
|
+
/**
|
3353
|
+
*
|
3354
|
+
* @param specular
|
3355
|
+
*/
|
3356
|
+
protected void setSpecularImpl(int specular) {
|
2344
3357
|
if (specularColor == specular) return;
|
2345
3358
|
specularColor = specular;
|
2346
3359
|
|
@@ -2362,8 +3375,12 @@ public class PShapeOpenGL extends PShape {
|
|
2362
3375
|
}
|
2363
3376
|
}
|
2364
3377
|
|
2365
|
-
|
2366
|
-
|
3378
|
+
/**
|
3379
|
+
*
|
3380
|
+
* @param index
|
3381
|
+
* @param specular
|
3382
|
+
*/
|
3383
|
+
@Override
|
2367
3384
|
public void setSpecular(int index, int specular) {
|
2368
3385
|
if (openShape) {
|
2369
3386
|
PGraphics.showWarning(INSIDE_BEGIN_END_ERROR, "setSpecular()");
|
@@ -2374,8 +3391,12 @@ public class PShapeOpenGL extends PShape {
|
|
2374
3391
|
markForTessellation();
|
2375
3392
|
}
|
2376
3393
|
|
2377
|
-
|
2378
|
-
|
3394
|
+
/**
|
3395
|
+
*
|
3396
|
+
* @param index
|
3397
|
+
* @return
|
3398
|
+
*/
|
3399
|
+
@Override
|
2379
3400
|
public int getEmissive(int index) {
|
2380
3401
|
if (family == GROUP) {
|
2381
3402
|
return PGL.nativeToJavaARGB(inGeo.emissive[index]);
|
@@ -2384,8 +3405,11 @@ public class PShapeOpenGL extends PShape {
|
|
2384
3405
|
}
|
2385
3406
|
}
|
2386
3407
|
|
2387
|
-
|
2388
|
-
|
3408
|
+
/**
|
3409
|
+
*
|
3410
|
+
* @param emissive
|
3411
|
+
*/
|
3412
|
+
@Override
|
2389
3413
|
public void setEmissive(int emissive) {
|
2390
3414
|
if (openShape) {
|
2391
3415
|
PGraphics.showWarning(INSIDE_BEGIN_END_ERROR, "setEmissive()");
|
@@ -2402,8 +3426,11 @@ public class PShapeOpenGL extends PShape {
|
|
2402
3426
|
}
|
2403
3427
|
}
|
2404
3428
|
|
2405
|
-
|
2406
|
-
|
3429
|
+
/**
|
3430
|
+
*
|
3431
|
+
* @param emissive
|
3432
|
+
*/
|
3433
|
+
protected void setEmissiveImpl(int emissive) {
|
2407
3434
|
if (emissiveColor == emissive) return;
|
2408
3435
|
emissiveColor = emissive;
|
2409
3436
|
|
@@ -2425,8 +3452,12 @@ public class PShapeOpenGL extends PShape {
|
|
2425
3452
|
}
|
2426
3453
|
}
|
2427
3454
|
|
2428
|
-
|
2429
|
-
|
3455
|
+
/**
|
3456
|
+
*
|
3457
|
+
* @param index
|
3458
|
+
* @param emissive
|
3459
|
+
*/
|
3460
|
+
@Override
|
2430
3461
|
public void setEmissive(int index, int emissive) {
|
2431
3462
|
if (openShape) {
|
2432
3463
|
PGraphics.showWarning(INSIDE_BEGIN_END_ERROR, "setEmissive()");
|
@@ -2437,8 +3468,12 @@ public class PShapeOpenGL extends PShape {
|
|
2437
3468
|
markForTessellation();
|
2438
3469
|
}
|
2439
3470
|
|
2440
|
-
|
2441
|
-
|
3471
|
+
/**
|
3472
|
+
*
|
3473
|
+
* @param index
|
3474
|
+
* @return
|
3475
|
+
*/
|
3476
|
+
@Override
|
2442
3477
|
public float getShininess(int index) {
|
2443
3478
|
if (family == GROUP) {
|
2444
3479
|
return inGeo.shininess[index];
|
@@ -2447,8 +3482,11 @@ public class PShapeOpenGL extends PShape {
|
|
2447
3482
|
}
|
2448
3483
|
}
|
2449
3484
|
|
2450
|
-
|
2451
|
-
|
3485
|
+
/**
|
3486
|
+
*
|
3487
|
+
* @param shininess
|
3488
|
+
*/
|
3489
|
+
@Override
|
2452
3490
|
public void setShininess(float shininess) {
|
2453
3491
|
if (openShape) {
|
2454
3492
|
PGraphics.showWarning(INSIDE_BEGIN_END_ERROR, "setShininess()");
|
@@ -2465,8 +3503,11 @@ public class PShapeOpenGL extends PShape {
|
|
2465
3503
|
}
|
2466
3504
|
}
|
2467
3505
|
|
2468
|
-
|
2469
|
-
|
3506
|
+
/**
|
3507
|
+
*
|
3508
|
+
* @param shininess
|
3509
|
+
*/
|
3510
|
+
protected void setShininessImpl(float shininess) {
|
2470
3511
|
if (PGraphicsOpenGL.same(this.shininess, shininess)) return;
|
2471
3512
|
this.shininess = shininess;
|
2472
3513
|
|
@@ -2486,8 +3527,12 @@ public class PShapeOpenGL extends PShape {
|
|
2486
3527
|
}
|
2487
3528
|
}
|
2488
3529
|
|
2489
|
-
|
2490
|
-
|
3530
|
+
/**
|
3531
|
+
*
|
3532
|
+
* @param index
|
3533
|
+
* @param shine
|
3534
|
+
*/
|
3535
|
+
@Override
|
2491
3536
|
public void setShininess(int index, float shine) {
|
2492
3537
|
if (openShape) {
|
2493
3538
|
PGraphics.showWarning(INSIDE_BEGIN_END_ERROR, "setShininess()");
|
@@ -2504,8 +3549,11 @@ public class PShapeOpenGL extends PShape {
|
|
2504
3549
|
|
2505
3550
|
// Vertex codes
|
2506
3551
|
|
2507
|
-
|
2508
|
-
|
3552
|
+
/**
|
3553
|
+
*
|
3554
|
+
* @return
|
3555
|
+
*/
|
3556
|
+
@Override
|
2509
3557
|
public int[] getVertexCodes() {
|
2510
3558
|
if (family == GROUP) return null;
|
2511
3559
|
else {
|
@@ -2519,8 +3567,11 @@ public class PShapeOpenGL extends PShape {
|
|
2519
3567
|
}
|
2520
3568
|
}
|
2521
3569
|
|
2522
|
-
|
2523
|
-
|
3570
|
+
/**
|
3571
|
+
*
|
3572
|
+
* @return
|
3573
|
+
*/
|
3574
|
+
@Override
|
2524
3575
|
public int getVertexCodeCount() {
|
2525
3576
|
if (family == GROUP) return 0;
|
2526
3577
|
else {
|
@@ -2536,6 +3587,8 @@ public class PShapeOpenGL extends PShape {
|
|
2536
3587
|
|
2537
3588
|
/**
|
2538
3589
|
* One of VERTEX, BEZIER_VERTEX, CURVE_VERTEX, or BREAK.
|
3590
|
+
* @param index
|
3591
|
+
* @return
|
2539
3592
|
*/
|
2540
3593
|
@Override
|
2541
3594
|
public int getVertexCode(int index) {
|
@@ -2549,6 +3602,11 @@ public class PShapeOpenGL extends PShape {
|
|
2549
3602
|
|
2550
3603
|
// Tessellated geometry getter.
|
2551
3604
|
|
3605
|
+
/**
|
3606
|
+
*
|
3607
|
+
* @return
|
3608
|
+
*/
|
3609
|
+
|
2552
3610
|
|
2553
3611
|
@Override
|
2554
3612
|
public PShape getTessellation() {
|
@@ -2649,6 +3707,13 @@ public class PShapeOpenGL extends PShape {
|
|
2649
3707
|
}
|
2650
3708
|
|
2651
3709
|
// Testing this method, not use as it might go away...
|
3710
|
+
|
3711
|
+
/**
|
3712
|
+
*
|
3713
|
+
* @param kind
|
3714
|
+
* @param data
|
3715
|
+
* @return
|
3716
|
+
*/
|
2652
3717
|
public float[] getTessellation(int kind, int data) {
|
2653
3718
|
updateTessellation();
|
2654
3719
|
|
@@ -2750,6 +3815,10 @@ public class PShapeOpenGL extends PShape {
|
|
2750
3815
|
|
2751
3816
|
// Tessellation
|
2752
3817
|
|
3818
|
+
/**
|
3819
|
+
*
|
3820
|
+
*/
|
3821
|
+
|
2753
3822
|
|
2754
3823
|
protected void updateTessellation() {
|
2755
3824
|
if (!root.tessellated) {
|
@@ -2760,14 +3829,18 @@ public class PShapeOpenGL extends PShape {
|
|
2760
3829
|
}
|
2761
3830
|
}
|
2762
3831
|
|
2763
|
-
|
2764
|
-
|
3832
|
+
/**
|
3833
|
+
*
|
3834
|
+
*/
|
3835
|
+
protected void markForTessellation() {
|
2765
3836
|
root.tessellated = false;
|
2766
3837
|
tessellated = false;
|
2767
3838
|
}
|
2768
3839
|
|
2769
|
-
|
2770
|
-
|
3840
|
+
/**
|
3841
|
+
*
|
3842
|
+
*/
|
3843
|
+
protected void initModified() {
|
2771
3844
|
modified = false;
|
2772
3845
|
|
2773
3846
|
modifiedPolyVertices = false;
|
@@ -2819,8 +3892,10 @@ public class PShapeOpenGL extends PShape {
|
|
2819
3892
|
lastModifiedPointAttribute = PConstants.MIN_INT;
|
2820
3893
|
}
|
2821
3894
|
|
2822
|
-
|
2823
|
-
|
3895
|
+
/**
|
3896
|
+
*
|
3897
|
+
*/
|
3898
|
+
protected void tessellate() {
|
2824
3899
|
if (root == this && parent == null) { // Root shape
|
2825
3900
|
if (polyAttribs == null) {
|
2826
3901
|
polyAttribs = PGraphicsOpenGL.newAttributeMap();
|
@@ -2845,8 +3920,10 @@ public class PShapeOpenGL extends PShape {
|
|
2845
3920
|
}
|
2846
3921
|
}
|
2847
3922
|
|
2848
|
-
|
2849
|
-
|
3923
|
+
/**
|
3924
|
+
*
|
3925
|
+
*/
|
3926
|
+
protected void collectPolyAttribs() {
|
2850
3927
|
AttributeMap rootAttribs = root.polyAttribs;
|
2851
3928
|
|
2852
3929
|
if (family == GROUP) {
|
@@ -2870,7 +3947,10 @@ public class PShapeOpenGL extends PShape {
|
|
2870
3947
|
}
|
2871
3948
|
}
|
2872
3949
|
|
2873
|
-
|
3950
|
+
/**
|
3951
|
+
*
|
3952
|
+
*/
|
3953
|
+
protected void tessellateImpl() {
|
2874
3954
|
tessGeo = root.tessGeo;
|
2875
3955
|
|
2876
3956
|
firstPolyIndexCache = -1;
|
@@ -3004,8 +4084,10 @@ public class PShapeOpenGL extends PShape {
|
|
3004
4084
|
tessellated = true;
|
3005
4085
|
}
|
3006
4086
|
|
3007
|
-
|
3008
|
-
|
4087
|
+
/**
|
4088
|
+
*
|
4089
|
+
*/
|
4090
|
+
protected void tessellatePoint() {
|
3009
4091
|
float x = 0, y = 0, z = 0;
|
3010
4092
|
if (params.length == 2) {
|
3011
4093
|
x = params[0];
|
@@ -3024,8 +4106,10 @@ public class PShapeOpenGL extends PShape {
|
|
3024
4106
|
tessellator.tessellatePoints();
|
3025
4107
|
}
|
3026
4108
|
|
3027
|
-
|
3028
|
-
|
4109
|
+
/**
|
4110
|
+
*
|
4111
|
+
*/
|
4112
|
+
protected void tessellateLine() {
|
3029
4113
|
float x1 = 0, y1 = 0, z1 = 0;
|
3030
4114
|
float x2 = 0, y2 = 0, z2 = 0;
|
3031
4115
|
if (params.length == 4) {
|
@@ -3051,8 +4135,10 @@ public class PShapeOpenGL extends PShape {
|
|
3051
4135
|
tessellator.tessellateLines();
|
3052
4136
|
}
|
3053
4137
|
|
3054
|
-
|
3055
|
-
|
4138
|
+
/**
|
4139
|
+
*
|
4140
|
+
*/
|
4141
|
+
protected void tessellateTriangle() {
|
3056
4142
|
float x1 = 0, y1 = 0;
|
3057
4143
|
float x2 = 0, y2 = 0;
|
3058
4144
|
float x3 = 0, y3 = 0;
|
@@ -3075,8 +4161,10 @@ public class PShapeOpenGL extends PShape {
|
|
3075
4161
|
tessellator.tessellateTriangles();
|
3076
4162
|
}
|
3077
4163
|
|
3078
|
-
|
3079
|
-
|
4164
|
+
/**
|
4165
|
+
*
|
4166
|
+
*/
|
4167
|
+
protected void tessellateQuad() {
|
3080
4168
|
float x1 = 0, y1 = 0;
|
3081
4169
|
float x2 = 0, y2 = 0;
|
3082
4170
|
float x3 = 0, y3 = 0;
|
@@ -3103,8 +4191,10 @@ public class PShapeOpenGL extends PShape {
|
|
3103
4191
|
tessellator.tessellateQuads();
|
3104
4192
|
}
|
3105
4193
|
|
3106
|
-
|
3107
|
-
|
4194
|
+
/**
|
4195
|
+
*
|
4196
|
+
*/
|
4197
|
+
protected void tessellateRect() {
|
3108
4198
|
float a = 0, b = 0, c = 0, d = 0;
|
3109
4199
|
float tl = 0, tr = 0, br = 0, bl = 0;
|
3110
4200
|
boolean rounded = false;
|
@@ -3187,8 +4277,10 @@ public class PShapeOpenGL extends PShape {
|
|
3187
4277
|
}
|
3188
4278
|
}
|
3189
4279
|
|
3190
|
-
|
3191
|
-
|
4280
|
+
/**
|
4281
|
+
*
|
4282
|
+
*/
|
4283
|
+
protected void tessellateEllipse() {
|
3192
4284
|
float a = 0, b = 0, c = 0, d = 0;
|
3193
4285
|
int mode = ellipseMode;
|
3194
4286
|
|
@@ -3236,8 +4328,10 @@ public class PShapeOpenGL extends PShape {
|
|
3236
4328
|
tessellator.tessellateTriangleFan();
|
3237
4329
|
}
|
3238
4330
|
|
3239
|
-
|
3240
|
-
|
4331
|
+
/**
|
4332
|
+
*
|
4333
|
+
*/
|
4334
|
+
protected void tessellateArc() {
|
3241
4335
|
float a = 0, b = 0, c = 0, d = 0;
|
3242
4336
|
float start = 0, stop = 0;
|
3243
4337
|
int mode = ellipseMode;
|
@@ -3298,8 +4392,10 @@ public class PShapeOpenGL extends PShape {
|
|
3298
4392
|
}
|
3299
4393
|
}
|
3300
4394
|
|
3301
|
-
|
3302
|
-
|
4395
|
+
/**
|
4396
|
+
*
|
4397
|
+
*/
|
4398
|
+
protected void tessellateBox() {
|
3303
4399
|
float w = 0, h = 0, d = 0;
|
3304
4400
|
if (params.length == 1) {
|
3305
4401
|
w = h = d = params[0];
|
@@ -3315,8 +4411,10 @@ public class PShapeOpenGL extends PShape {
|
|
3315
4411
|
tessellator.tessellateQuads();
|
3316
4412
|
}
|
3317
4413
|
|
3318
|
-
|
3319
|
-
|
4414
|
+
/**
|
4415
|
+
*
|
4416
|
+
*/
|
4417
|
+
protected void tessellateSphere() {
|
3320
4418
|
float r = 0;
|
3321
4419
|
int nu = sphereDetailU;
|
3322
4420
|
int nv = sphereDetailV;
|
@@ -3350,8 +4448,10 @@ public class PShapeOpenGL extends PShape {
|
|
3350
4448
|
}
|
3351
4449
|
}
|
3352
4450
|
|
3353
|
-
|
3354
|
-
|
4451
|
+
/**
|
4452
|
+
*
|
4453
|
+
*/
|
4454
|
+
protected void tessellatePath() {
|
3355
4455
|
if (vertices == null) return;
|
3356
4456
|
|
3357
4457
|
inGeo.setMaterial(fillColor, strokeColor, strokeWeight,
|
@@ -3477,20 +4577,29 @@ public class PShapeOpenGL extends PShape {
|
|
3477
4577
|
if (curv) restoreCurveVertexSettings();
|
3478
4578
|
}
|
3479
4579
|
|
3480
|
-
|
4580
|
+
/**
|
4581
|
+
*
|
4582
|
+
*/
|
4583
|
+
protected void saveBezierVertexSettings() {
|
3481
4584
|
savedBezierDetail = pg.bezierDetail;
|
3482
4585
|
if (pg.bezierDetail != bezierDetail) {
|
3483
4586
|
pg.bezierDetail(bezierDetail);
|
3484
4587
|
}
|
3485
4588
|
}
|
3486
4589
|
|
3487
|
-
|
4590
|
+
/**
|
4591
|
+
*
|
4592
|
+
*/
|
4593
|
+
protected void restoreBezierVertexSettings() {
|
3488
4594
|
if (savedBezierDetail != bezierDetail) {
|
3489
4595
|
pg.bezierDetail(savedBezierDetail);
|
3490
4596
|
}
|
3491
4597
|
}
|
3492
4598
|
|
3493
|
-
|
4599
|
+
/**
|
4600
|
+
*
|
4601
|
+
*/
|
4602
|
+
protected void saveCurveVertexSettings() {
|
3494
4603
|
savedCurveDetail = pg.curveDetail;
|
3495
4604
|
savedCurveTightness = pg.curveTightness;
|
3496
4605
|
if (pg.curveDetail != curveDetail) {
|
@@ -3501,7 +4610,10 @@ public class PShapeOpenGL extends PShape {
|
|
3501
4610
|
}
|
3502
4611
|
}
|
3503
4612
|
|
3504
|
-
|
4613
|
+
/**
|
4614
|
+
*
|
4615
|
+
*/
|
4616
|
+
protected void restoreCurveVertexSettings() {
|
3505
4617
|
if (savedCurveDetail != curveDetail) {
|
3506
4618
|
pg.curveDetail(savedCurveDetail);
|
3507
4619
|
}
|
@@ -3516,8 +4628,10 @@ public class PShapeOpenGL extends PShape {
|
|
3516
4628
|
|
3517
4629
|
// Aggregation
|
3518
4630
|
|
3519
|
-
|
3520
|
-
|
4631
|
+
/**
|
4632
|
+
*
|
4633
|
+
*/
|
4634
|
+
protected void aggregate() {
|
3521
4635
|
if (root == this && parent == null) {
|
3522
4636
|
// Initializing auxiliary variables in root node
|
3523
4637
|
// needed for aggregation.
|
@@ -3569,6 +4683,10 @@ public class PShapeOpenGL extends PShape {
|
|
3569
4683
|
// vertices (4 + 5 + 6 + 3 = 18) being rendered, while calling
|
3570
4684
|
// draw() from either child groups 0 or 1 should result in the first
|
3571
4685
|
// 4 vertices or the last 14 vertices being rendered, respectively.
|
4686
|
+
|
4687
|
+
/**
|
4688
|
+
*
|
4689
|
+
*/
|
3572
4690
|
protected void aggregateImpl() {
|
3573
4691
|
if (family == GROUP) {
|
3574
4692
|
// Recursively aggregating the child shapes.
|
@@ -3618,6 +4736,10 @@ public class PShapeOpenGL extends PShape {
|
|
3618
4736
|
|
3619
4737
|
|
3620
4738
|
// Updates the index cache for the range that corresponds to this shape.
|
4739
|
+
|
4740
|
+
/**
|
4741
|
+
*
|
4742
|
+
*/
|
3621
4743
|
protected void updatePolyIndexCache() {
|
3622
4744
|
IndexCache cache = tessGeo.polyIndexCache;
|
3623
4745
|
if (family == GROUP) {
|
@@ -3718,14 +4840,22 @@ public class PShapeOpenGL extends PShape {
|
|
3718
4840
|
}
|
3719
4841
|
}
|
3720
4842
|
|
3721
|
-
|
3722
|
-
|
4843
|
+
/**
|
4844
|
+
*
|
4845
|
+
* @param n
|
4846
|
+
* @return
|
4847
|
+
*/
|
4848
|
+
protected boolean startStrokedTex(int n) {
|
3723
4849
|
return image != null && (n == firstLineIndexCache ||
|
3724
4850
|
n == firstPointIndexCache);
|
3725
4851
|
}
|
3726
4852
|
|
3727
|
-
|
3728
|
-
|
4853
|
+
/**
|
4854
|
+
*
|
4855
|
+
* @param n
|
4856
|
+
* @param vert
|
4857
|
+
*/
|
4858
|
+
protected void setFirstStrokeVertex(int n, int vert) {
|
3729
4859
|
if (n == firstLineIndexCache && firstLineVertex == -1) {
|
3730
4860
|
firstLineVertex = lastLineVertex = vert;
|
3731
4861
|
}
|
@@ -3734,7 +4864,11 @@ public class PShapeOpenGL extends PShape {
|
|
3734
4864
|
}
|
3735
4865
|
}
|
3736
4866
|
|
3737
|
-
|
4867
|
+
/**
|
4868
|
+
*
|
4869
|
+
* @param vert
|
4870
|
+
*/
|
4871
|
+
protected void setLastStrokeVertex(int vert) {
|
3738
4872
|
if (-1 < lastLineVertex) {
|
3739
4873
|
lastLineVertex = vert;
|
3740
4874
|
}
|
@@ -3743,7 +4877,10 @@ public class PShapeOpenGL extends PShape {
|
|
3743
4877
|
}
|
3744
4878
|
}
|
3745
4879
|
|
3746
|
-
|
4880
|
+
/**
|
4881
|
+
*
|
4882
|
+
*/
|
4883
|
+
protected void updateLineIndexCache() {
|
3747
4884
|
IndexCache cache = tessGeo.lineIndexCache;
|
3748
4885
|
if (family == GROUP) {
|
3749
4886
|
firstLineIndexCache = lastLineIndexCache = -1;
|
@@ -3805,8 +4942,10 @@ public class PShapeOpenGL extends PShape {
|
|
3805
4942
|
}
|
3806
4943
|
}
|
3807
4944
|
|
3808
|
-
|
3809
|
-
|
4945
|
+
/**
|
4946
|
+
*
|
4947
|
+
*/
|
4948
|
+
protected void updatePointIndexCache() {
|
3810
4949
|
IndexCache cache = tessGeo.pointIndexCache;
|
3811
4950
|
if (family == GROUP) {
|
3812
4951
|
firstPointIndexCache = lastPointIndexCache = -1;
|
@@ -3881,6 +5020,10 @@ public class PShapeOpenGL extends PShape {
|
|
3881
5020
|
|
3882
5021
|
// Buffer initialization
|
3883
5022
|
|
5023
|
+
/**
|
5024
|
+
*
|
5025
|
+
*/
|
5026
|
+
|
3884
5027
|
|
3885
5028
|
protected void initBuffers() {
|
3886
5029
|
boolean outdated = contextIsOutdated();
|
@@ -3901,8 +5044,10 @@ public class PShapeOpenGL extends PShape {
|
|
3901
5044
|
needBufferInit = false;
|
3902
5045
|
}
|
3903
5046
|
|
3904
|
-
|
3905
|
-
|
5047
|
+
/**
|
5048
|
+
*
|
5049
|
+
*/
|
5050
|
+
protected void initPolyBuffers() {
|
3906
5051
|
int size = tessGeo.polyVertexCount;
|
3907
5052
|
int sizef = size * PGL.SIZEOF_FLOAT;
|
3908
5053
|
int sizei = size * PGL.SIZEOF_INT;
|
@@ -3985,8 +5130,10 @@ public class PShapeOpenGL extends PShape {
|
|
3985
5130
|
pgl.bindBuffer(PGL.ELEMENT_ARRAY_BUFFER, 0);
|
3986
5131
|
}
|
3987
5132
|
|
3988
|
-
|
3989
|
-
|
5133
|
+
/**
|
5134
|
+
*
|
5135
|
+
*/
|
5136
|
+
protected void initLineBuffers() {
|
3990
5137
|
int size = tessGeo.lineVertexCount;
|
3991
5138
|
int sizef = size * PGL.SIZEOF_FLOAT;
|
3992
5139
|
int sizei = size * PGL.SIZEOF_INT;
|
@@ -4025,8 +5172,10 @@ public class PShapeOpenGL extends PShape {
|
|
4025
5172
|
pgl.bindBuffer(PGL.ELEMENT_ARRAY_BUFFER, 0);
|
4026
5173
|
}
|
4027
5174
|
|
4028
|
-
|
4029
|
-
|
5175
|
+
/**
|
5176
|
+
*
|
5177
|
+
*/
|
5178
|
+
protected void initPointBuffers() {
|
4030
5179
|
int size = tessGeo.pointVertexCount;
|
4031
5180
|
int sizef = size * PGL.SIZEOF_FLOAT;
|
4032
5181
|
int sizei = size * PGL.SIZEOF_INT;
|
@@ -4065,8 +5214,11 @@ public class PShapeOpenGL extends PShape {
|
|
4065
5214
|
pgl.bindBuffer(PGL.ELEMENT_ARRAY_BUFFER, 0);
|
4066
5215
|
}
|
4067
5216
|
|
4068
|
-
|
4069
|
-
|
5217
|
+
/**
|
5218
|
+
*
|
5219
|
+
* @return
|
5220
|
+
*/
|
5221
|
+
protected boolean contextIsOutdated() {
|
4070
5222
|
boolean outdated = !pgl.contextIsCurrent(context);
|
4071
5223
|
if (outdated) {
|
4072
5224
|
bufPolyVertex.dispose();
|
@@ -4102,6 +5254,10 @@ public class PShapeOpenGL extends PShape {
|
|
4102
5254
|
|
4103
5255
|
// Geometry update
|
4104
5256
|
|
5257
|
+
/**
|
5258
|
+
*
|
5259
|
+
*/
|
5260
|
+
|
4105
5261
|
|
4106
5262
|
protected void updateGeometry() {
|
4107
5263
|
root.initBuffers();
|
@@ -4110,8 +5266,10 @@ public class PShapeOpenGL extends PShape {
|
|
4110
5266
|
}
|
4111
5267
|
}
|
4112
5268
|
|
4113
|
-
|
4114
|
-
|
5269
|
+
/**
|
5270
|
+
*
|
5271
|
+
*/
|
5272
|
+
protected void updateGeometryImpl() {
|
4115
5273
|
if (modifiedPolyVertices) {
|
4116
5274
|
int offset = firstModifiedPolyVertex;
|
4117
5275
|
int size = lastModifiedPolyVertex - offset + 1;
|
@@ -4241,8 +5399,12 @@ public class PShapeOpenGL extends PShape {
|
|
4241
5399
|
modified = false;
|
4242
5400
|
}
|
4243
5401
|
|
4244
|
-
|
4245
|
-
|
5402
|
+
/**
|
5403
|
+
*
|
5404
|
+
* @param offset
|
5405
|
+
* @param size
|
5406
|
+
*/
|
5407
|
+
protected void copyPolyVertices(int offset, int size) {
|
4246
5408
|
tessGeo.updatePolyVerticesBuffer(offset, size);
|
4247
5409
|
pgl.bindBuffer(PGL.ARRAY_BUFFER, bufPolyVertex.glId);
|
4248
5410
|
tessGeo.polyVerticesBuffer.position(4 * offset);
|
@@ -4252,8 +5414,12 @@ public class PShapeOpenGL extends PShape {
|
|
4252
5414
|
pgl.bindBuffer(PGL.ARRAY_BUFFER, 0);
|
4253
5415
|
}
|
4254
5416
|
|
4255
|
-
|
4256
|
-
|
5417
|
+
/**
|
5418
|
+
*
|
5419
|
+
* @param offset
|
5420
|
+
* @param size
|
5421
|
+
*/
|
5422
|
+
protected void copyPolyColors(int offset, int size) {
|
4257
5423
|
tessGeo.updatePolyColorsBuffer(offset, size);
|
4258
5424
|
pgl.bindBuffer(PGL.ARRAY_BUFFER, bufPolyColor.glId);
|
4259
5425
|
tessGeo.polyColorsBuffer.position(offset);
|
@@ -4263,8 +5429,12 @@ public class PShapeOpenGL extends PShape {
|
|
4263
5429
|
pgl.bindBuffer(PGL.ARRAY_BUFFER, 0);
|
4264
5430
|
}
|
4265
5431
|
|
4266
|
-
|
4267
|
-
|
5432
|
+
/**
|
5433
|
+
*
|
5434
|
+
* @param offset
|
5435
|
+
* @param size
|
5436
|
+
*/
|
5437
|
+
protected void copyPolyNormals(int offset, int size) {
|
4268
5438
|
tessGeo.updatePolyNormalsBuffer(offset, size);
|
4269
5439
|
pgl.bindBuffer(PGL.ARRAY_BUFFER, bufPolyNormal.glId);
|
4270
5440
|
tessGeo.polyNormalsBuffer.position(3 * offset);
|
@@ -4274,8 +5444,12 @@ public class PShapeOpenGL extends PShape {
|
|
4274
5444
|
pgl.bindBuffer(PGL.ARRAY_BUFFER, 0);
|
4275
5445
|
}
|
4276
5446
|
|
4277
|
-
|
4278
|
-
|
5447
|
+
/**
|
5448
|
+
*
|
5449
|
+
* @param offset
|
5450
|
+
* @param size
|
5451
|
+
*/
|
5452
|
+
protected void copyPolyTexCoords(int offset, int size) {
|
4279
5453
|
tessGeo.updatePolyTexCoordsBuffer(offset, size);
|
4280
5454
|
pgl.bindBuffer(PGL.ARRAY_BUFFER, bufPolyTexcoord.glId);
|
4281
5455
|
tessGeo.polyTexCoordsBuffer.position(2 * offset);
|
@@ -4285,8 +5459,12 @@ public class PShapeOpenGL extends PShape {
|
|
4285
5459
|
pgl.bindBuffer(PGL.ARRAY_BUFFER, 0);
|
4286
5460
|
}
|
4287
5461
|
|
4288
|
-
|
4289
|
-
|
5462
|
+
/**
|
5463
|
+
*
|
5464
|
+
* @param offset
|
5465
|
+
* @param size
|
5466
|
+
*/
|
5467
|
+
protected void copyPolyAmbient(int offset, int size) {
|
4290
5468
|
tessGeo.updatePolyAmbientBuffer(offset, size);
|
4291
5469
|
pgl.bindBuffer(PGL.ARRAY_BUFFER, bufPolyAmbient.glId);
|
4292
5470
|
tessGeo.polyAmbientBuffer.position(offset);
|
@@ -4296,8 +5474,12 @@ public class PShapeOpenGL extends PShape {
|
|
4296
5474
|
pgl.bindBuffer(PGL.ARRAY_BUFFER, 0);
|
4297
5475
|
}
|
4298
5476
|
|
4299
|
-
|
4300
|
-
|
5477
|
+
/**
|
5478
|
+
*
|
5479
|
+
* @param offset
|
5480
|
+
* @param size
|
5481
|
+
*/
|
5482
|
+
protected void copyPolySpecular(int offset, int size) {
|
4301
5483
|
tessGeo.updatePolySpecularBuffer(offset, size);
|
4302
5484
|
pgl.bindBuffer(PGL.ARRAY_BUFFER, bufPolySpecular.glId);
|
4303
5485
|
tessGeo.polySpecularBuffer.position(offset);
|
@@ -4307,8 +5489,12 @@ public class PShapeOpenGL extends PShape {
|
|
4307
5489
|
pgl.bindBuffer(PGL.ARRAY_BUFFER, 0);
|
4308
5490
|
}
|
4309
5491
|
|
4310
|
-
|
4311
|
-
|
5492
|
+
/**
|
5493
|
+
*
|
5494
|
+
* @param offset
|
5495
|
+
* @param size
|
5496
|
+
*/
|
5497
|
+
protected void copyPolyEmissive(int offset, int size) {
|
4312
5498
|
tessGeo.updatePolyEmissiveBuffer(offset, size);
|
4313
5499
|
pgl.bindBuffer(PGL.ARRAY_BUFFER, bufPolyEmissive.glId);
|
4314
5500
|
tessGeo.polyEmissiveBuffer.position(offset);
|
@@ -4318,8 +5504,12 @@ public class PShapeOpenGL extends PShape {
|
|
4318
5504
|
pgl.bindBuffer(PGL.ARRAY_BUFFER, 0);
|
4319
5505
|
}
|
4320
5506
|
|
4321
|
-
|
4322
|
-
|
5507
|
+
/**
|
5508
|
+
*
|
5509
|
+
* @param offset
|
5510
|
+
* @param size
|
5511
|
+
*/
|
5512
|
+
protected void copyPolyShininess(int offset, int size) {
|
4323
5513
|
tessGeo.updatePolyShininessBuffer(offset, size);
|
4324
5514
|
pgl.bindBuffer(PGL.ARRAY_BUFFER, bufPolyShininess.glId);
|
4325
5515
|
tessGeo.polyShininessBuffer.position(offset);
|
@@ -4329,8 +5519,13 @@ public class PShapeOpenGL extends PShape {
|
|
4329
5519
|
pgl.bindBuffer(PGL.ARRAY_BUFFER, 0);
|
4330
5520
|
}
|
4331
5521
|
|
4332
|
-
|
4333
|
-
|
5522
|
+
/**
|
5523
|
+
*
|
5524
|
+
* @param attrib
|
5525
|
+
* @param offset
|
5526
|
+
* @param size
|
5527
|
+
*/
|
5528
|
+
protected void copyPolyAttrib(VertexAttribute attrib, int offset, int size) {
|
4334
5529
|
tessGeo.updateAttribBuffer(attrib.name, offset, size);
|
4335
5530
|
pgl.bindBuffer(PGL.ARRAY_BUFFER, attrib.buf.glId);
|
4336
5531
|
Buffer buf = tessGeo.polyAttribBuffers.get(attrib.name);
|
@@ -4341,8 +5536,12 @@ public class PShapeOpenGL extends PShape {
|
|
4341
5536
|
pgl.bindBuffer(PGL.ARRAY_BUFFER, 0);
|
4342
5537
|
}
|
4343
5538
|
|
4344
|
-
|
4345
|
-
|
5539
|
+
/**
|
5540
|
+
*
|
5541
|
+
* @param offset
|
5542
|
+
* @param size
|
5543
|
+
*/
|
5544
|
+
protected void copyLineVertices(int offset, int size) {
|
4346
5545
|
tessGeo.updateLineVerticesBuffer(offset, size);
|
4347
5546
|
pgl.bindBuffer(PGL.ARRAY_BUFFER, bufLineVertex.glId);
|
4348
5547
|
tessGeo.lineVerticesBuffer.position(4 * offset);
|
@@ -4352,8 +5551,12 @@ public class PShapeOpenGL extends PShape {
|
|
4352
5551
|
pgl.bindBuffer(PGL.ARRAY_BUFFER, 0);
|
4353
5552
|
}
|
4354
5553
|
|
4355
|
-
|
4356
|
-
|
5554
|
+
/**
|
5555
|
+
*
|
5556
|
+
* @param offset
|
5557
|
+
* @param size
|
5558
|
+
*/
|
5559
|
+
protected void copyLineColors(int offset, int size) {
|
4357
5560
|
tessGeo.updateLineColorsBuffer(offset, size);
|
4358
5561
|
pgl.bindBuffer(PGL.ARRAY_BUFFER, bufLineColor.glId);
|
4359
5562
|
tessGeo.lineColorsBuffer.position(offset);
|
@@ -4363,8 +5566,12 @@ public class PShapeOpenGL extends PShape {
|
|
4363
5566
|
pgl.bindBuffer(PGL.ARRAY_BUFFER, 0);
|
4364
5567
|
}
|
4365
5568
|
|
4366
|
-
|
4367
|
-
|
5569
|
+
/**
|
5570
|
+
*
|
5571
|
+
* @param offset
|
5572
|
+
* @param size
|
5573
|
+
*/
|
5574
|
+
protected void copyLineAttributes(int offset, int size) {
|
4368
5575
|
tessGeo.updateLineDirectionsBuffer(offset, size);
|
4369
5576
|
pgl.bindBuffer(PGL.ARRAY_BUFFER, bufLineAttrib.glId);
|
4370
5577
|
tessGeo.lineDirectionsBuffer.position(4 * offset);
|
@@ -4374,8 +5581,12 @@ public class PShapeOpenGL extends PShape {
|
|
4374
5581
|
pgl.bindBuffer(PGL.ARRAY_BUFFER, 0);
|
4375
5582
|
}
|
4376
5583
|
|
4377
|
-
|
4378
|
-
|
5584
|
+
/**
|
5585
|
+
*
|
5586
|
+
* @param offset
|
5587
|
+
* @param size
|
5588
|
+
*/
|
5589
|
+
protected void copyPointVertices(int offset, int size) {
|
4379
5590
|
tessGeo.updatePointVerticesBuffer(offset, size);
|
4380
5591
|
pgl.bindBuffer(PGL.ARRAY_BUFFER, bufPointVertex.glId);
|
4381
5592
|
tessGeo.pointVerticesBuffer.position(4 * offset);
|
@@ -4385,8 +5596,12 @@ public class PShapeOpenGL extends PShape {
|
|
4385
5596
|
pgl.bindBuffer(PGL.ARRAY_BUFFER, 0);
|
4386
5597
|
}
|
4387
5598
|
|
4388
|
-
|
4389
|
-
|
5599
|
+
/**
|
5600
|
+
*
|
5601
|
+
* @param offset
|
5602
|
+
* @param size
|
5603
|
+
*/
|
5604
|
+
protected void copyPointColors(int offset, int size) {
|
4390
5605
|
tessGeo.updatePointColorsBuffer(offset, size);
|
4391
5606
|
pgl.bindBuffer(PGL.ARRAY_BUFFER, bufPointColor.glId);
|
4392
5607
|
tessGeo.pointColorsBuffer.position(offset);
|
@@ -4396,8 +5611,12 @@ public class PShapeOpenGL extends PShape {
|
|
4396
5611
|
pgl.bindBuffer(PGL.ARRAY_BUFFER, 0);
|
4397
5612
|
}
|
4398
5613
|
|
4399
|
-
|
4400
|
-
|
5614
|
+
/**
|
5615
|
+
*
|
5616
|
+
* @param offset
|
5617
|
+
* @param size
|
5618
|
+
*/
|
5619
|
+
protected void copyPointAttributes(int offset, int size) {
|
4401
5620
|
tessGeo.updatePointOffsetsBuffer(offset, size);
|
4402
5621
|
pgl.bindBuffer(PGL.ARRAY_BUFFER, bufPointAttrib.glId);
|
4403
5622
|
tessGeo.pointOffsetsBuffer.position(2 * offset);
|
@@ -4407,120 +5626,181 @@ public class PShapeOpenGL extends PShape {
|
|
4407
5626
|
pgl.bindBuffer(PGL.ARRAY_BUFFER, 0);
|
4408
5627
|
}
|
4409
5628
|
|
4410
|
-
|
4411
|
-
|
5629
|
+
/**
|
5630
|
+
*
|
5631
|
+
* @param first
|
5632
|
+
* @param last
|
5633
|
+
*/
|
5634
|
+
protected void setModifiedPolyVertices(int first, int last) {
|
4412
5635
|
if (first < firstModifiedPolyVertex) firstModifiedPolyVertex = first;
|
4413
5636
|
if (last > lastModifiedPolyVertex) lastModifiedPolyVertex = last;
|
4414
5637
|
modifiedPolyVertices = true;
|
4415
5638
|
modified = true;
|
4416
5639
|
}
|
4417
5640
|
|
4418
|
-
|
4419
|
-
|
5641
|
+
/**
|
5642
|
+
*
|
5643
|
+
* @param first
|
5644
|
+
* @param last
|
5645
|
+
*/
|
5646
|
+
protected void setModifiedPolyColors(int first, int last) {
|
4420
5647
|
if (first < firstModifiedPolyColor) firstModifiedPolyColor = first;
|
4421
5648
|
if (last > lastModifiedPolyColor) lastModifiedPolyColor = last;
|
4422
5649
|
modifiedPolyColors = true;
|
4423
5650
|
modified = true;
|
4424
5651
|
}
|
4425
5652
|
|
4426
|
-
|
4427
|
-
|
5653
|
+
/**
|
5654
|
+
*
|
5655
|
+
* @param first
|
5656
|
+
* @param last
|
5657
|
+
*/
|
5658
|
+
protected void setModifiedPolyNormals(int first, int last) {
|
4428
5659
|
if (first < firstModifiedPolyNormal) firstModifiedPolyNormal = first;
|
4429
5660
|
if (last > lastModifiedPolyNormal) lastModifiedPolyNormal = last;
|
4430
5661
|
modifiedPolyNormals = true;
|
4431
5662
|
modified = true;
|
4432
5663
|
}
|
4433
5664
|
|
4434
|
-
|
4435
|
-
|
5665
|
+
/**
|
5666
|
+
*
|
5667
|
+
* @param first
|
5668
|
+
* @param last
|
5669
|
+
*/
|
5670
|
+
protected void setModifiedPolyTexCoords(int first, int last) {
|
4436
5671
|
if (first < firstModifiedPolyTexcoord) firstModifiedPolyTexcoord = first;
|
4437
5672
|
if (last > lastModifiedPolyTexcoord) lastModifiedPolyTexcoord = last;
|
4438
5673
|
modifiedPolyTexCoords = true;
|
4439
5674
|
modified = true;
|
4440
5675
|
}
|
4441
5676
|
|
4442
|
-
|
4443
|
-
|
5677
|
+
/**
|
5678
|
+
*
|
5679
|
+
* @param first
|
5680
|
+
* @param last
|
5681
|
+
*/
|
5682
|
+
protected void setModifiedPolyAmbient(int first, int last) {
|
4444
5683
|
if (first < firstModifiedPolyAmbient) firstModifiedPolyAmbient = first;
|
4445
5684
|
if (last > lastModifiedPolyAmbient) lastModifiedPolyAmbient = last;
|
4446
5685
|
modifiedPolyAmbient = true;
|
4447
5686
|
modified = true;
|
4448
5687
|
}
|
4449
5688
|
|
4450
|
-
|
4451
|
-
|
5689
|
+
/**
|
5690
|
+
*
|
5691
|
+
* @param first
|
5692
|
+
* @param last
|
5693
|
+
*/
|
5694
|
+
protected void setModifiedPolySpecular(int first, int last) {
|
4452
5695
|
if (first < firstModifiedPolySpecular) firstModifiedPolySpecular = first;
|
4453
5696
|
if (last > lastModifiedPolySpecular) lastModifiedPolySpecular = last;
|
4454
5697
|
modifiedPolySpecular = true;
|
4455
5698
|
modified = true;
|
4456
5699
|
}
|
4457
5700
|
|
4458
|
-
|
4459
|
-
|
5701
|
+
/**
|
5702
|
+
*
|
5703
|
+
* @param first
|
5704
|
+
* @param last
|
5705
|
+
*/
|
5706
|
+
protected void setModifiedPolyEmissive(int first, int last) {
|
4460
5707
|
if (first < firstModifiedPolyEmissive) firstModifiedPolyEmissive = first;
|
4461
5708
|
if (last > lastModifiedPolyEmissive) lastModifiedPolyEmissive = last;
|
4462
5709
|
modifiedPolyEmissive = true;
|
4463
5710
|
modified = true;
|
4464
5711
|
}
|
4465
5712
|
|
4466
|
-
|
4467
|
-
|
5713
|
+
/**
|
5714
|
+
*
|
5715
|
+
* @param first
|
5716
|
+
* @param last
|
5717
|
+
*/
|
5718
|
+
protected void setModifiedPolyShininess(int first, int last) {
|
4468
5719
|
if (first < firstModifiedPolyShininess) firstModifiedPolyShininess = first;
|
4469
5720
|
if (last > lastModifiedPolyShininess) lastModifiedPolyShininess = last;
|
4470
5721
|
modifiedPolyShininess = true;
|
4471
5722
|
modified = true;
|
4472
5723
|
}
|
4473
5724
|
|
4474
|
-
|
4475
|
-
|
5725
|
+
/**
|
5726
|
+
*
|
5727
|
+
* @param attrib
|
5728
|
+
* @param first
|
5729
|
+
* @param last
|
5730
|
+
*/
|
5731
|
+
protected void setModifiedPolyAttrib(VertexAttribute attrib, int first, int last) {
|
4476
5732
|
if (first < attrib.firstModified) attrib.firstModified = first;
|
4477
5733
|
if (last > attrib.lastModified) attrib.lastModified = last;
|
4478
5734
|
attrib.modified = true;
|
4479
5735
|
modified = true;
|
4480
5736
|
}
|
4481
5737
|
|
4482
|
-
|
4483
|
-
|
5738
|
+
/**
|
5739
|
+
*
|
5740
|
+
* @param first
|
5741
|
+
* @param last
|
5742
|
+
*/
|
5743
|
+
protected void setModifiedLineVertices(int first, int last) {
|
4484
5744
|
if (first < firstModifiedLineVertex) firstModifiedLineVertex = first;
|
4485
5745
|
if (last > lastModifiedLineVertex) lastModifiedLineVertex = last;
|
4486
5746
|
modifiedLineVertices = true;
|
4487
5747
|
modified = true;
|
4488
5748
|
}
|
4489
5749
|
|
4490
|
-
|
4491
|
-
|
5750
|
+
/**
|
5751
|
+
*
|
5752
|
+
* @param first
|
5753
|
+
* @param last
|
5754
|
+
*/
|
5755
|
+
protected void setModifiedLineColors(int first, int last) {
|
4492
5756
|
if (first < firstModifiedLineColor) firstModifiedLineColor = first;
|
4493
5757
|
if (last > lastModifiedLineColor) lastModifiedLineColor = last;
|
4494
5758
|
modifiedLineColors = true;
|
4495
5759
|
modified = true;
|
4496
5760
|
}
|
4497
5761
|
|
4498
|
-
|
4499
|
-
|
5762
|
+
/**
|
5763
|
+
*
|
5764
|
+
* @param first
|
5765
|
+
* @param last
|
5766
|
+
*/
|
5767
|
+
protected void setModifiedLineAttributes(int first, int last) {
|
4500
5768
|
if (first < firstModifiedLineAttribute) firstModifiedLineAttribute = first;
|
4501
5769
|
if (last > lastModifiedLineAttribute) lastModifiedLineAttribute = last;
|
4502
5770
|
modifiedLineAttributes = true;
|
4503
5771
|
modified = true;
|
4504
5772
|
}
|
4505
5773
|
|
4506
|
-
|
4507
|
-
|
5774
|
+
/**
|
5775
|
+
*
|
5776
|
+
* @param first
|
5777
|
+
* @param last
|
5778
|
+
*/
|
5779
|
+
protected void setModifiedPointVertices(int first, int last) {
|
4508
5780
|
if (first < firstModifiedPointVertex) firstModifiedPointVertex = first;
|
4509
5781
|
if (last > lastModifiedPointVertex) lastModifiedPointVertex = last;
|
4510
5782
|
modifiedPointVertices = true;
|
4511
5783
|
modified = true;
|
4512
5784
|
}
|
4513
5785
|
|
4514
|
-
|
4515
|
-
|
5786
|
+
/**
|
5787
|
+
*
|
5788
|
+
* @param first
|
5789
|
+
* @param last
|
5790
|
+
*/
|
5791
|
+
protected void setModifiedPointColors(int first, int last) {
|
4516
5792
|
if (first < firstModifiedPointColor) firstModifiedPointColor = first;
|
4517
5793
|
if (last > lastModifiedPointColor) lastModifiedPointColor = last;
|
4518
5794
|
modifiedPointColors = true;
|
4519
5795
|
modified = true;
|
4520
5796
|
}
|
4521
5797
|
|
4522
|
-
|
4523
|
-
|
5798
|
+
/**
|
5799
|
+
*
|
5800
|
+
* @param first
|
5801
|
+
* @param last
|
5802
|
+
*/
|
5803
|
+
protected void setModifiedPointAttributes(int first, int last) {
|
4524
5804
|
if (first < firstModifiedPointAttribute) firstModifiedPointAttribute = first;
|
4525
5805
|
if (last > lastModifiedPointAttribute) lastModifiedPointAttribute = last;
|
4526
5806
|
modifiedPointAttributes = true;
|
@@ -4598,8 +5878,11 @@ public class PShapeOpenGL extends PShape {
|
|
4598
5878
|
super.enableStyle();
|
4599
5879
|
}
|
4600
5880
|
|
4601
|
-
|
4602
|
-
|
5881
|
+
/**
|
5882
|
+
*
|
5883
|
+
* @param g
|
5884
|
+
*/
|
5885
|
+
@Override
|
4603
5886
|
protected void styles(PGraphics g) {
|
4604
5887
|
if (g instanceof PGraphicsOpenGL) {
|
4605
5888
|
if (g.stroke) {
|
@@ -4783,14 +6066,23 @@ public class PShapeOpenGL extends PShape {
|
|
4783
6066
|
// so they cannot rendered in a single call.
|
4784
6067
|
// Or accurate 2D mode is enabled, which forces each
|
4785
6068
|
// shape to be rendered separately.
|
6069
|
+
|
6070
|
+
/**
|
6071
|
+
*
|
6072
|
+
* @param g
|
6073
|
+
* @return
|
6074
|
+
*/
|
4786
6075
|
protected boolean fragmentedGroup(PGraphicsOpenGL g) {
|
4787
6076
|
return g.getHint(DISABLE_OPTIMIZED_STROKE) ||
|
4788
6077
|
(textures != null && (1 < textures.size() || untexChild)) ||
|
4789
6078
|
strokedTexture;
|
4790
6079
|
}
|
4791
6080
|
|
4792
|
-
|
4793
|
-
|
6081
|
+
/**
|
6082
|
+
*
|
6083
|
+
* @param g
|
6084
|
+
*/
|
6085
|
+
@Override
|
4794
6086
|
protected void pre(PGraphics g) {
|
4795
6087
|
if (g instanceof PGraphicsOpenGL) {
|
4796
6088
|
if (!style) {
|
@@ -4801,8 +6093,11 @@ public class PShapeOpenGL extends PShape {
|
|
4801
6093
|
}
|
4802
6094
|
}
|
4803
6095
|
|
4804
|
-
|
4805
|
-
|
6096
|
+
/**
|
6097
|
+
*
|
6098
|
+
* @param g
|
6099
|
+
*/
|
6100
|
+
@Override
|
4806
6101
|
protected void post(PGraphics g) {
|
4807
6102
|
if (g instanceof PGraphicsOpenGL) {
|
4808
6103
|
} else {
|
@@ -4810,8 +6105,11 @@ public class PShapeOpenGL extends PShape {
|
|
4810
6105
|
}
|
4811
6106
|
}
|
4812
6107
|
|
4813
|
-
|
4814
|
-
|
6108
|
+
/**
|
6109
|
+
*
|
6110
|
+
* @param g
|
6111
|
+
*/
|
6112
|
+
@Override
|
4815
6113
|
protected void drawGeometry(PGraphics g) {
|
4816
6114
|
vertexCount = inGeo.vertexCount;
|
4817
6115
|
vertices = inGeo.getVertexData();
|
@@ -4825,6 +6123,12 @@ public class PShapeOpenGL extends PShape {
|
|
4825
6123
|
|
4826
6124
|
// Render the geometry stored in the root shape as VBOs, for the vertices
|
4827
6125
|
// corresponding to this shape. Sometimes we can have root == this.
|
6126
|
+
|
6127
|
+
/**
|
6128
|
+
*
|
6129
|
+
* @param g
|
6130
|
+
* @param texture
|
6131
|
+
*/
|
4828
6132
|
protected void render(PGraphicsOpenGL g, PImage texture) {
|
4829
6133
|
if (root == null) {
|
4830
6134
|
// Some error. Root should never be null. At least it should be 'this'.
|
@@ -4858,8 +6162,12 @@ public class PShapeOpenGL extends PShape {
|
|
4858
6162
|
}
|
4859
6163
|
}
|
4860
6164
|
|
4861
|
-
|
4862
|
-
|
6165
|
+
/**
|
6166
|
+
*
|
6167
|
+
* @param g
|
6168
|
+
* @param textureImage
|
6169
|
+
*/
|
6170
|
+
protected void renderPolys(PGraphicsOpenGL g, PImage textureImage) {
|
4863
6171
|
boolean customShader = g.polyShader != null;
|
4864
6172
|
boolean needNormals = customShader ? g.polyShader.accessNormals() : false;
|
4865
6173
|
boolean needTexCoords = customShader ? g.polyShader.accessTexCoords() : false;
|
@@ -4953,8 +6261,12 @@ public class PShapeOpenGL extends PShape {
|
|
4953
6261
|
}
|
4954
6262
|
}
|
4955
6263
|
|
4956
|
-
|
4957
|
-
|
6264
|
+
/**
|
6265
|
+
*
|
6266
|
+
* @param g
|
6267
|
+
* @param textureImage
|
6268
|
+
*/
|
6269
|
+
protected void rawPolys(PGraphicsOpenGL g, PImage textureImage) {
|
4958
6270
|
PGraphics raw = g.getRaw();
|
4959
6271
|
|
4960
6272
|
raw.colorMode(RGB);
|
@@ -5048,8 +6360,11 @@ public class PShapeOpenGL extends PShape {
|
|
5048
6360
|
raw.endShape();
|
5049
6361
|
}
|
5050
6362
|
|
5051
|
-
|
5052
|
-
|
6363
|
+
/**
|
6364
|
+
*
|
6365
|
+
* @param g
|
6366
|
+
*/
|
6367
|
+
protected void renderLines(PGraphicsOpenGL g) {
|
5053
6368
|
PShader shader = g.getLineShader();
|
5054
6369
|
shader.bind();
|
5055
6370
|
|
@@ -5072,8 +6387,11 @@ public class PShapeOpenGL extends PShape {
|
|
5072
6387
|
shader.unbind();
|
5073
6388
|
}
|
5074
6389
|
|
5075
|
-
|
5076
|
-
|
6390
|
+
/**
|
6391
|
+
*
|
6392
|
+
* @param g
|
6393
|
+
*/
|
6394
|
+
protected void rawLines(PGraphicsOpenGL g) {
|
5077
6395
|
PGraphics raw = g.getRaw();
|
5078
6396
|
|
5079
6397
|
raw.colorMode(RGB);
|
@@ -5145,8 +6463,11 @@ public class PShapeOpenGL extends PShape {
|
|
5145
6463
|
raw.endShape();
|
5146
6464
|
}
|
5147
6465
|
|
5148
|
-
|
5149
|
-
|
6466
|
+
/**
|
6467
|
+
*
|
6468
|
+
* @param g
|
6469
|
+
*/
|
6470
|
+
protected void renderPoints(PGraphicsOpenGL g) {
|
5150
6471
|
PShader shader = g.getPointShader();
|
5151
6472
|
shader.bind();
|
5152
6473
|
|
@@ -5169,8 +6490,11 @@ public class PShapeOpenGL extends PShape {
|
|
5169
6490
|
shader.unbind();
|
5170
6491
|
}
|
5171
6492
|
|
5172
|
-
|
5173
|
-
|
6493
|
+
/**
|
6494
|
+
*
|
6495
|
+
* @param g
|
6496
|
+
*/
|
6497
|
+
protected void rawPoints(PGraphicsOpenGL g) {
|
5174
6498
|
PGraphics raw = g.getRaw();
|
5175
6499
|
|
5176
6500
|
raw.colorMode(RGB);
|