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.
Files changed (97) hide show
  1. checksums.yaml +4 -4
  2. data/.mvn/wrapper/maven-wrapper.properties +1 -1
  3. data/CHANGELOG.md +3 -1
  4. data/README.md +1 -1
  5. data/Rakefile +8 -6
  6. data/docs/_editors/geany.md +5 -4
  7. data/docs/_editors/vim.md +6 -0
  8. data/docs/_includes/head.html +1 -0
  9. data/docs/_libraries/control_panel.md +2 -2
  10. data/docs/_libraries/gl_video.md +21 -0
  11. data/docs/_posts/2018-05-06-getting_started.md +10 -9
  12. data/docs/_posts/2018-05-06-install_jruby.md +19 -2
  13. data/docs/_posts/2018-06-26-auto_install_picrate.md +19 -4
  14. data/docs/_posts/2018-11-18-building-gem.md +18 -0
  15. data/docs/_posts/2018-11-27-getting_started_geany.md +38 -0
  16. data/docs/about.md +21 -10
  17. data/docs/assets/android-chrome-192x192.png +0 -0
  18. data/docs/assets/android-chrome-512x512.png +0 -0
  19. data/docs/assets/favicon.ico +0 -0
  20. data/docs/assets/geany.png +0 -0
  21. data/docs/assets/jwishy_picrate.png +0 -0
  22. data/docs/assets/picrate.svg +251 -0
  23. data/docs/index.html +8 -14
  24. data/lib/picrate/runner.rb +6 -2
  25. data/lib/picrate/version.rb +1 -1
  26. data/library/boids/boids.rb +10 -13
  27. data/mvnw +234 -0
  28. data/picrate.gemspec +2 -1
  29. data/pom.rb +1 -1
  30. data/pom.xml +1 -1
  31. data/src/main/java/japplemenubar/JAppleMenuBar.java +10 -2
  32. data/src/main/java/monkstone/ColorUtil.java +11 -1
  33. data/src/main/java/monkstone/MathToolModule.java +1 -0
  34. data/src/main/java/monkstone/PicrateLibrary.java +1 -0
  35. data/src/main/java/monkstone/fastmath/Deglut.java +1 -0
  36. data/src/main/java/monkstone/noise/SimplexNoise.java +3 -3
  37. data/src/main/java/monkstone/slider/CustomHorizontalSlider.java +1 -1
  38. data/src/main/java/monkstone/slider/CustomVerticalSlider.java +1 -1
  39. data/src/main/java/monkstone/slider/SimpleHorizontalSlider.java +1 -1
  40. data/src/main/java/monkstone/slider/SimpleSlider.java +8 -8
  41. data/src/main/java/monkstone/slider/SimpleVerticalSlider.java +1 -1
  42. data/src/main/java/monkstone/slider/Slider.java +3 -3
  43. data/src/main/java/monkstone/slider/SliderBar.java +1 -1
  44. data/src/main/java/monkstone/slider/SliderGroup.java +1 -1
  45. data/src/main/java/monkstone/vecmath/AppRender.java +1 -0
  46. data/src/main/java/monkstone/vecmath/JRender.java +1 -0
  47. data/src/main/java/monkstone/vecmath/ShapeRender.java +1 -0
  48. data/src/main/java/monkstone/vecmath/vec2/Vec2.java +8 -0
  49. data/src/main/java/monkstone/vecmath/vec3/Vec3.java +1 -0
  50. data/src/main/java/processing/awt/PGraphicsJava2D.java +85 -16
  51. data/src/main/java/processing/awt/PSurfaceAWT.java +1 -1
  52. data/src/main/java/processing/core/PApplet.java +18 -12
  53. data/src/main/java/processing/core/PShape.java +1182 -305
  54. data/src/main/java/processing/core/PStyle.java +1 -1
  55. data/src/main/java/processing/core/PSurface.java +1 -1
  56. data/src/main/java/processing/data/FloatDict.java +196 -54
  57. data/src/main/java/processing/data/FloatList.java +167 -54
  58. data/src/main/java/processing/data/IntDict.java +211 -56
  59. data/src/main/java/processing/data/IntList.java +185 -52
  60. data/src/main/java/processing/data/JSONArray.java +69 -20
  61. data/src/main/java/processing/data/JSONObject.java +53 -12
  62. data/src/main/java/processing/data/Sort.java +40 -10
  63. data/src/main/java/processing/data/StringDict.java +159 -49
  64. data/src/main/java/processing/data/StringList.java +147 -42
  65. data/src/main/java/processing/data/Table.java +778 -223
  66. data/src/main/java/processing/data/TableRow.java +26 -2
  67. data/src/main/java/processing/data/XML.java +190 -50
  68. data/src/main/java/processing/event/Event.java +93 -0
  69. data/src/main/java/processing/event/KeyEvent.java +55 -13
  70. data/src/main/java/processing/event/MouseEvent.java +77 -1
  71. data/src/main/java/processing/event/TouchEvent.java +14 -1
  72. data/src/main/java/processing/javafx/PGraphicsFX2D.java +8 -0
  73. data/src/main/java/processing/opengl/FrameBuffer.java +228 -66
  74. data/src/main/java/processing/opengl/LinePath.java +131 -27
  75. data/src/main/java/processing/opengl/LineStroker.java +30 -5
  76. data/src/main/java/processing/opengl/PGL.java +4066 -865
  77. data/src/main/java/processing/opengl/PGraphics2D.java +38 -10
  78. data/src/main/java/processing/opengl/PGraphics3D.java +38 -6
  79. data/src/main/java/processing/opengl/PGraphicsOpenGL.java +1980 -474
  80. data/src/main/java/processing/opengl/PJOGL.java +1460 -248
  81. data/src/main/java/processing/opengl/PShader.java +904 -217
  82. data/src/main/java/processing/opengl/PShapeOpenGL.java +1811 -487
  83. data/src/main/java/processing/opengl/PSurfaceJOGL.java +278 -71
  84. data/src/main/java/processing/opengl/Texture.java +610 -135
  85. data/src/main/java/processing/opengl/VertexBuffer.java +45 -9
  86. data/src/main/resources/icon/icon-1024.png +0 -0
  87. data/src/main/resources/icon/icon-128.png +0 -0
  88. data/src/main/resources/icon/icon-16.png +0 -0
  89. data/src/main/resources/icon/icon-256.png +0 -0
  90. data/src/main/resources/icon/icon-32.png +0 -0
  91. data/src/main/resources/icon/icon-48.png +0 -0
  92. data/src/main/resources/icon/icon-512.png +0 -0
  93. data/src/main/resources/icon/icon-64.png +0 -0
  94. data/vendors/Rakefile +1 -1
  95. metadata +13 -6
  96. data/docs/assets/circle_collisions.png +0 -0
  97. data/docs/favicon.ico +0 -0
@@ -41,129 +41,430 @@ import java.util.HashMap;
41
41
  * @webref rendering:shaders
42
42
  */
43
43
  public class PShader implements PConstants {
44
- static protected final int POINT = 0;
45
- static protected final int LINE = 1;
46
- static protected final int POLY = 2;
47
- static protected final int COLOR = 3;
48
- static protected final int LIGHT = 4;
49
- static protected final int TEXTURE = 5;
50
- static protected final int TEXLIGHT = 6;
51
-
52
- static protected String pointShaderAttrRegexp =
44
+
45
+ /**
46
+ *
47
+ */
48
+ static protected final int POINT = 0;
49
+
50
+ /**
51
+ *
52
+ */
53
+ static protected final int LINE = 1;
54
+
55
+ /**
56
+ *
57
+ */
58
+ static protected final int POLY = 2;
59
+
60
+ /**
61
+ *
62
+ */
63
+ static protected final int COLOR = 3;
64
+
65
+ /**
66
+ *
67
+ */
68
+ static protected final int LIGHT = 4;
69
+
70
+ /**
71
+ *
72
+ */
73
+ static protected final int TEXTURE = 5;
74
+
75
+ /**
76
+ *
77
+ */
78
+ static protected final int TEXLIGHT = 6;
79
+
80
+ /**
81
+ *
82
+ */
83
+ static protected String pointShaderAttrRegexp =
53
84
  "attribute *vec2 *offset";
54
- static protected String pointShaderInRegexp =
85
+
86
+ /**
87
+ *
88
+ */
89
+ static protected String pointShaderInRegexp =
55
90
  "in *vec2 *offset;";
56
- static protected String lineShaderAttrRegexp =
91
+
92
+ /**
93
+ *
94
+ */
95
+ static protected String lineShaderAttrRegexp =
57
96
  "attribute *vec4 *direction";
58
- static protected String lineShaderInRegexp =
97
+
98
+ /**
99
+ *
100
+ */
101
+ static protected String lineShaderInRegexp =
59
102
  "in *vec4 *direction";
60
- static protected String pointShaderDefRegexp =
103
+
104
+ /**
105
+ *
106
+ */
107
+ static protected String pointShaderDefRegexp =
61
108
  "#define *PROCESSING_POINT_SHADER";
62
- static protected String lineShaderDefRegexp =
109
+
110
+ /**
111
+ *
112
+ */
113
+ static protected String lineShaderDefRegexp =
63
114
  "#define *PROCESSING_LINE_SHADER";
64
- static protected String colorShaderDefRegexp =
115
+
116
+ /**
117
+ *
118
+ */
119
+ static protected String colorShaderDefRegexp =
65
120
  "#define *PROCESSING_COLOR_SHADER";
66
- static protected String lightShaderDefRegexp =
121
+
122
+ /**
123
+ *
124
+ */
125
+ static protected String lightShaderDefRegexp =
67
126
  "#define *PROCESSING_LIGHT_SHADER";
68
- static protected String texShaderDefRegexp =
127
+
128
+ /**
129
+ *
130
+ */
131
+ static protected String texShaderDefRegexp =
69
132
  "#define *PROCESSING_TEXTURE_SHADER";
70
- static protected String texlightShaderDefRegexp =
133
+
134
+ /**
135
+ *
136
+ */
137
+ static protected String texlightShaderDefRegexp =
71
138
  "#define *PROCESSING_TEXLIGHT_SHADER";
72
- static protected String polyShaderDefRegexp =
139
+
140
+ /**
141
+ *
142
+ */
143
+ static protected String polyShaderDefRegexp =
73
144
  "#define *PROCESSING_POLYGON_SHADER";
74
- static protected String triShaderAttrRegexp =
145
+
146
+ /**
147
+ *
148
+ */
149
+ static protected String triShaderAttrRegexp =
75
150
  "#define *PROCESSING_TRIANGLES_SHADER";
76
- static protected String quadShaderAttrRegexp =
151
+
152
+ /**
153
+ *
154
+ */
155
+ static protected String quadShaderAttrRegexp =
77
156
  "#define *PROCESSING_QUADS_SHADER";
78
157
 
79
- protected PApplet parent;
158
+ /**
159
+ *
160
+ */
161
+ protected PApplet parent;
80
162
  // The main renderer associated to the parent PApplet.
81
163
  //protected PGraphicsOpenGL pgMain;
82
164
  // We need a reference to the renderer since a shader might
83
165
  // be called by different renderers within a single application
84
166
  // (the one corresponding to the main surface, or other offscreen
85
167
  // renderers).
168
+
169
+ /**
170
+ *
171
+ */
86
172
  protected PGraphicsOpenGL primaryPG;
87
- protected PGraphicsOpenGL currentPG;
88
- protected PGL pgl;
89
- protected int context; // The context that created this shader.
90
173
 
91
- // The shader type: POINT, LINE, POLY, etc.
92
- protected int type;
174
+ /**
175
+ *
176
+ */
177
+ protected PGraphicsOpenGL currentPG;
93
178
 
94
- public int glProgram;
95
- public int glVertex;
96
- public int glFragment;
97
- private GLResourceShader glres;
179
+ /**
180
+ *
181
+ */
182
+ protected PGL pgl;
98
183
 
99
- protected URL vertexURL;
100
- protected URL fragmentURL;
184
+ /**
185
+ *
186
+ */
187
+ protected int context; // The context that created this shader.
101
188
 
102
- protected String vertexFilename;
103
- protected String fragmentFilename;
189
+ // The shader type: POINT, LINE, POLY, etc.
104
190
 
105
- protected String[] vertexShaderSource;
106
- protected String[] fragmentShaderSource;
191
+ /**
192
+ *
193
+ */
194
+ protected int type;
195
+
196
+ /**
197
+ *
198
+ */
199
+ public int glProgram;
107
200
 
108
- protected boolean bound;
201
+ /**
202
+ *
203
+ */
204
+ public int glVertex;
109
205
 
110
- protected HashMap<String, UniformValue> uniformValues = null;
206
+ /**
207
+ *
208
+ */
209
+ public int glFragment;
210
+ private GLResourceShader glres;
111
211
 
112
- protected HashMap<Integer, Texture> textures;
113
- protected HashMap<Integer, Integer> texUnits;
212
+ /**
213
+ *
214
+ */
215
+ protected URL vertexURL;
216
+
217
+ /**
218
+ *
219
+ */
220
+ protected URL fragmentURL;
221
+
222
+ /**
223
+ *
224
+ */
225
+ protected String vertexFilename;
226
+
227
+ /**
228
+ *
229
+ */
230
+ protected String fragmentFilename;
231
+
232
+ /**
233
+ *
234
+ */
235
+ protected String[] vertexShaderSource;
236
+
237
+ /**
238
+ *
239
+ */
240
+ protected String[] fragmentShaderSource;
241
+
242
+ /**
243
+ *
244
+ */
245
+ protected boolean bound;
246
+
247
+ /**
248
+ *
249
+ */
250
+ protected HashMap<String, UniformValue> uniformValues = null;
251
+
252
+ /**
253
+ *
254
+ */
255
+ protected HashMap<Integer, Texture> textures;
256
+
257
+ /**
258
+ *
259
+ */
260
+ protected HashMap<Integer, Integer> texUnits;
114
261
 
115
262
  // Direct buffers to pass shader data to GL
263
+
264
+ /**
265
+ *
266
+ */
116
267
  protected IntBuffer intBuffer;
117
- protected FloatBuffer floatBuffer;
118
268
 
119
- protected boolean loadedAttributes = false;
120
- protected boolean loadedUniforms = false;
269
+ /**
270
+ *
271
+ */
272
+ protected FloatBuffer floatBuffer;
273
+
274
+ /**
275
+ *
276
+ */
277
+ protected boolean loadedAttributes = false;
278
+
279
+ /**
280
+ *
281
+ */
282
+ protected boolean loadedUniforms = false;
121
283
 
122
284
  // Uniforms common to all shader types
285
+
286
+ /**
287
+ *
288
+ */
123
289
  protected int transformMatLoc;
124
- protected int modelviewMatLoc;
125
- protected int projectionMatLoc;
126
- protected int ppixelsLoc;
127
- protected int ppixelsUnit;
128
- protected int viewportLoc;
129
- protected int resolutionLoc;
290
+
291
+ /**
292
+ *
293
+ */
294
+ protected int modelviewMatLoc;
295
+
296
+ /**
297
+ *
298
+ */
299
+ protected int projectionMatLoc;
300
+
301
+ /**
302
+ *
303
+ */
304
+ protected int ppixelsLoc;
305
+
306
+ /**
307
+ *
308
+ */
309
+ protected int ppixelsUnit;
310
+
311
+ /**
312
+ *
313
+ */
314
+ protected int viewportLoc;
315
+
316
+ /**
317
+ *
318
+ */
319
+ protected int resolutionLoc;
130
320
 
131
321
  // Uniforms only for lines and points
322
+
323
+ /**
324
+ *
325
+ */
132
326
  protected int perspectiveLoc;
133
- protected int scaleLoc;
327
+
328
+ /**
329
+ *
330
+ */
331
+ protected int scaleLoc;
134
332
 
135
333
  // Lighting uniforms
334
+
335
+ /**
336
+ *
337
+ */
136
338
  protected int lightCountLoc;
137
- protected int lightPositionLoc;
138
- protected int lightNormalLoc;
139
- protected int lightAmbientLoc;
140
- protected int lightDiffuseLoc;
141
- protected int lightSpecularLoc;
142
- protected int lightFalloffLoc;
143
- protected int lightSpotLoc;
339
+
340
+ /**
341
+ *
342
+ */
343
+ protected int lightPositionLoc;
344
+
345
+ /**
346
+ *
347
+ */
348
+ protected int lightNormalLoc;
349
+
350
+ /**
351
+ *
352
+ */
353
+ protected int lightAmbientLoc;
354
+
355
+ /**
356
+ *
357
+ */
358
+ protected int lightDiffuseLoc;
359
+
360
+ /**
361
+ *
362
+ */
363
+ protected int lightSpecularLoc;
364
+
365
+ /**
366
+ *
367
+ */
368
+ protected int lightFalloffLoc;
369
+
370
+ /**
371
+ *
372
+ */
373
+ protected int lightSpotLoc;
144
374
 
145
375
  // Texturing uniforms
376
+
377
+ /**
378
+ *
379
+ */
146
380
  protected Texture texture;
147
- protected int texUnit;
148
- protected int textureLoc;
149
- protected int texMatrixLoc;
150
- protected int texOffsetLoc;
151
- protected float[] tcmat;
381
+
382
+ /**
383
+ *
384
+ */
385
+ protected int texUnit;
386
+
387
+ /**
388
+ *
389
+ */
390
+ protected int textureLoc;
391
+
392
+ /**
393
+ *
394
+ */
395
+ protected int texMatrixLoc;
396
+
397
+ /**
398
+ *
399
+ */
400
+ protected int texOffsetLoc;
401
+
402
+ /**
403
+ *
404
+ */
405
+ protected float[] tcmat;
152
406
 
153
407
  // Vertex attributes
408
+
409
+ /**
410
+ *
411
+ */
154
412
  protected int vertexLoc;
155
- protected int colorLoc;
156
- protected int normalLoc;
157
- protected int texCoordLoc;
158
- protected int normalMatLoc;
159
- protected int directionLoc;
160
- protected int offsetLoc;
161
- protected int ambientLoc;
162
- protected int specularLoc;
163
- protected int emissiveLoc;
164
- protected int shininessLoc;
165
-
166
- public PShader() {
413
+
414
+ /**
415
+ *
416
+ */
417
+ protected int colorLoc;
418
+
419
+ /**
420
+ *
421
+ */
422
+ protected int normalLoc;
423
+
424
+ /**
425
+ *
426
+ */
427
+ protected int texCoordLoc;
428
+
429
+ /**
430
+ *
431
+ */
432
+ protected int normalMatLoc;
433
+
434
+ /**
435
+ *
436
+ */
437
+ protected int directionLoc;
438
+
439
+ /**
440
+ *
441
+ */
442
+ protected int offsetLoc;
443
+
444
+ /**
445
+ *
446
+ */
447
+ protected int ambientLoc;
448
+
449
+ /**
450
+ *
451
+ */
452
+ protected int specularLoc;
453
+
454
+ /**
455
+ *
456
+ */
457
+ protected int emissiveLoc;
458
+
459
+ /**
460
+ *
461
+ */
462
+ protected int shininessLoc;
463
+
464
+ /**
465
+ *
466
+ */
467
+ public PShader() {
167
468
  parent = null;
168
469
  pgl = null;
169
470
  context = -1;
@@ -185,8 +486,11 @@ public class PShader implements PConstants {
185
486
  type = -1;
186
487
  }
187
488
 
188
-
189
- public PShader(PApplet parent) {
489
+ /**
490
+ *
491
+ * @param parent
492
+ */
493
+ public PShader(PApplet parent) {
190
494
  this();
191
495
  this.parent = parent;
192
496
  primaryPG = (PGraphicsOpenGL)parent.g;
@@ -239,6 +543,7 @@ public class PShader implements PConstants {
239
543
 
240
544
 
241
545
  /**
546
+ * @param parent
242
547
  * @param vertURL network location of the vertex shader
243
548
  * @param fragURL network location of the fragment shader
244
549
  */
@@ -276,7 +581,13 @@ public class PShader implements PConstants {
276
581
  }
277
582
  }
278
583
 
279
- public PShader(PApplet parent, String[] vertSource, String[] fragSource) {
584
+ /**
585
+ *
586
+ * @param parent
587
+ * @param vertSource
588
+ * @param fragSource
589
+ */
590
+ public PShader(PApplet parent, String[] vertSource, String[] fragSource) {
280
591
  this.parent = parent;
281
592
  primaryPG = (PGraphicsOpenGL)parent.g;
282
593
  pgl = primaryPG.pgl;
@@ -310,36 +621,55 @@ public class PShader implements PConstants {
310
621
  }
311
622
  }
312
623
 
313
-
314
- public void setVertexShader(String vertFilename) {
624
+ /**
625
+ *
626
+ * @param vertFilename
627
+ */
628
+ public void setVertexShader(String vertFilename) {
315
629
  this.vertexFilename = vertFilename;
316
630
  vertexShaderSource = pgl.loadVertexShader(vertFilename);
317
631
  }
318
632
 
319
-
320
- public void setVertexShader(URL vertURL) {
633
+ /**
634
+ *
635
+ * @param vertURL
636
+ */
637
+ public void setVertexShader(URL vertURL) {
321
638
  this.vertexURL = vertURL;
322
639
  vertexShaderSource = pgl.loadVertexShader(vertURL);
323
640
  }
324
641
 
325
-
326
- public void setVertexShader(String[] vertSource) {
642
+ /**
643
+ *
644
+ * @param vertSource
645
+ */
646
+ public void setVertexShader(String[] vertSource) {
327
647
  vertexShaderSource = vertSource;
328
648
  }
329
649
 
330
-
331
- public void setFragmentShader(String fragFilename) {
650
+ /**
651
+ *
652
+ * @param fragFilename
653
+ */
654
+ public void setFragmentShader(String fragFilename) {
332
655
  this.fragmentFilename = fragFilename;
333
656
  fragmentShaderSource = pgl.loadFragmentShader(fragFilename);
334
657
  }
335
658
 
336
-
337
- public void setFragmentShader(URL fragURL) {
659
+ /**
660
+ *
661
+ * @param fragURL
662
+ */
663
+ public void setFragmentShader(URL fragURL) {
338
664
  this.fragmentURL = fragURL;
339
665
  fragmentShaderSource = pgl.loadFragmentShader(fragURL);
340
666
  }
341
667
 
342
- public void setFragmentShader(String[] fragSource) {
668
+ /**
669
+ *
670
+ * @param fragSource
671
+ */
672
+ public void setFragmentShader(String[] fragSource) {
343
673
  fragmentShaderSource = fragSource;
344
674
  }
345
675
 
@@ -376,6 +706,7 @@ public class PShader implements PConstants {
376
706
 
377
707
  /**
378
708
  * Returns true if the shader is bound, false otherwise.
709
+ * @return
379
710
  */
380
711
  public boolean bound() {
381
712
  return bound;
@@ -392,47 +723,79 @@ public class PShader implements PConstants {
392
723
  }
393
724
 
394
725
  /**
726
+ * @param name
395
727
  * @param y second component of the variable to modify. The variable has to be declared with an array/vector type in the shader (i.e.: int[2], vec2)
728
+ * @param x
396
729
  */
397
730
  public void set(String name, int x, int y) {
398
731
  setUniformImpl(name, UniformValue.INT2, new int[] { x, y });
399
732
  }
400
733
 
401
734
  /**
735
+ * @param name
402
736
  * @param z third component of the variable to modify. The variable has to be declared with an array/vector type in the shader (i.e.: int[3], vec3)
737
+ * @param x
738
+ * @param y
403
739
  */
404
740
  public void set(String name, int x, int y, int z) {
405
741
  setUniformImpl(name, UniformValue.INT3, new int[] { x, y, z });
406
742
  }
407
743
 
408
744
  /**
745
+ * @param name
746
+ * @param x
409
747
  * @param w fourth component of the variable to modify. The variable has to be declared with an array/vector type in the shader (i.e.: int[4], vec4)
748
+ * @param z
749
+ * @param y
410
750
  */
411
751
  public void set(String name, int x, int y, int z, int w) {
412
752
  setUniformImpl(name, UniformValue.INT4, new int[] { x, y, z, w });
413
753
  }
414
754
 
415
-
416
- public void set(String name, float x) {
755
+ /**
756
+ *
757
+ * @param name
758
+ * @param x
759
+ */
760
+ public void set(String name, float x) {
417
761
  setUniformImpl(name, UniformValue.FLOAT1, new float[] { x });
418
762
  }
419
763
 
420
-
421
- public void set(String name, float x, float y) {
764
+ /**
765
+ *
766
+ * @param name
767
+ * @param x
768
+ * @param y
769
+ */
770
+ public void set(String name, float x, float y) {
422
771
  setUniformImpl(name, UniformValue.FLOAT2, new float[] { x, y });
423
772
  }
424
773
 
425
-
426
- public void set(String name, float x, float y, float z) {
774
+ /**
775
+ *
776
+ * @param name
777
+ * @param x
778
+ * @param y
779
+ * @param z
780
+ */
781
+ public void set(String name, float x, float y, float z) {
427
782
  setUniformImpl(name, UniformValue.FLOAT3, new float[] { x, y, z });
428
783
  }
429
784
 
430
-
431
- public void set(String name, float x, float y, float z, float w) {
785
+ /**
786
+ *
787
+ * @param name
788
+ * @param x
789
+ * @param y
790
+ * @param z
791
+ * @param w
792
+ */
793
+ public void set(String name, float x, float y, float z, float w) {
432
794
  setUniformImpl(name, UniformValue.FLOAT4, new float[] { x, y, z, w });
433
795
  }
434
796
 
435
797
  /**
798
+ * @param name
436
799
  * @param vec modifies all the components of an array/vector uniform variable. PVector can only be used if the type of the variable is vec3.
437
800
  */
438
801
  public void set(String name, PVector vec) {
@@ -440,37 +803,65 @@ public class PShader implements PConstants {
440
803
  new float[] { vec.x, vec.y, vec.z });
441
804
  }
442
805
 
443
-
444
- public void set(String name, boolean x) {
806
+ /**
807
+ *
808
+ * @param name
809
+ * @param x
810
+ */
811
+ public void set(String name, boolean x) {
445
812
  setUniformImpl(name, UniformValue.INT1, new int[] { (x)?1:0 });
446
813
  }
447
814
 
448
-
449
- public void set(String name, boolean x, boolean y) {
815
+ /**
816
+ *
817
+ * @param name
818
+ * @param x
819
+ * @param y
820
+ */
821
+ public void set(String name, boolean x, boolean y) {
450
822
  setUniformImpl(name, UniformValue.INT2,
451
823
  new int[] { (x)?1:0, (y)?1:0 });
452
824
  }
453
825
 
454
-
455
- public void set(String name, boolean x, boolean y, boolean z) {
826
+ /**
827
+ *
828
+ * @param name
829
+ * @param x
830
+ * @param y
831
+ * @param z
832
+ */
833
+ public void set(String name, boolean x, boolean y, boolean z) {
456
834
  setUniformImpl(name, UniformValue.INT3,
457
835
  new int[] { (x)?1:0, (y)?1:0, (z)?1:0 });
458
836
  }
459
837
 
460
-
461
- public void set(String name, boolean x, boolean y, boolean z, boolean w) {
838
+ /**
839
+ *
840
+ * @param name
841
+ * @param x
842
+ * @param y
843
+ * @param z
844
+ * @param w
845
+ */
846
+ public void set(String name, boolean x, boolean y, boolean z, boolean w) {
462
847
  setUniformImpl(name, UniformValue.INT4,
463
848
  new int[] { (x)?1:0, (y)?1:0, (z)?1:0, (w)?1:0 });
464
849
  }
465
850
 
466
-
467
- public void set(String name, int[] vec) {
851
+ /**
852
+ *
853
+ * @param name
854
+ * @param vec
855
+ */
856
+ public void set(String name, int[] vec) {
468
857
  set(name, vec, 1);
469
858
  }
470
859
 
471
860
 
472
861
  /**
862
+ * @param name
473
863
  * @param ncoords number of coordinates per element, max 4
864
+ * @param vec
474
865
  */
475
866
  public void set(String name, int[] vec, int ncoords) {
476
867
  if (ncoords == 1) {
@@ -489,13 +880,22 @@ public class PShader implements PConstants {
489
880
  }
490
881
  }
491
882
 
492
-
493
- public void set(String name, float[] vec) {
883
+ /**
884
+ *
885
+ * @param name
886
+ * @param vec
887
+ */
888
+ public void set(String name, float[] vec) {
494
889
  set(name, vec, 1);
495
890
  }
496
891
 
497
-
498
- public void set(String name, float[] vec, int ncoords) {
892
+ /**
893
+ *
894
+ * @param name
895
+ * @param vec
896
+ * @param ncoords
897
+ */
898
+ public void set(String name, float[] vec, int ncoords) {
499
899
  if (ncoords == 1) {
500
900
  setUniformImpl(name, UniformValue.FLOAT1VEC, vec);
501
901
  } else if (ncoords == 2) {
@@ -512,13 +912,22 @@ public class PShader implements PConstants {
512
912
  }
513
913
  }
514
914
 
515
-
516
- public void set(String name, boolean[] vec) {
915
+ /**
916
+ *
917
+ * @param name
918
+ * @param vec
919
+ */
920
+ public void set(String name, boolean[] vec) {
517
921
  set(name, vec, 1);
518
922
  }
519
923
 
520
-
521
- public void set(String name, boolean[] boolvec, int ncoords) {
924
+ /**
925
+ *
926
+ * @param name
927
+ * @param boolvec
928
+ * @param ncoords
929
+ */
930
+ public void set(String name, boolean[] boolvec, int ncoords) {
522
931
  int[] vec = new int[boolvec.length];
523
932
  for (int i = 0; i < boolvec.length; i++) {
524
933
  vec[i] = (boolvec[i])?1:0;
@@ -528,6 +937,7 @@ public class PShader implements PConstants {
528
937
 
529
938
 
530
939
  /**
940
+ * @param name
531
941
  * @param mat matrix of values
532
942
  */
533
943
  public void set(String name, PMatrix2D mat) {
@@ -536,13 +946,19 @@ public class PShader implements PConstants {
536
946
  setUniformImpl(name, UniformValue.MAT2, matv);
537
947
  }
538
948
 
539
-
540
- public void set(String name, PMatrix3D mat) {
949
+ /**
950
+ *
951
+ * @param name
952
+ * @param mat
953
+ */
954
+ public void set(String name, PMatrix3D mat) {
541
955
  set(name, mat, false);
542
956
  }
543
957
 
544
958
  /**
959
+ * @param name
545
960
  * @param use3x3 enforces the matrix is 3 x 3
961
+ * @param mat
546
962
  */
547
963
  public void set(String name, PMatrix3D mat, boolean use3x3) {
548
964
  if (use3x3) {
@@ -560,6 +976,7 @@ public class PShader implements PConstants {
560
976
  }
561
977
 
562
978
  /**
979
+ * @param name
563
980
  * @param tex sets the sampler uniform variable to read from this image texture
564
981
  */
565
982
  public void set(String name, PImage tex) {
@@ -576,8 +993,13 @@ public class PShader implements PConstants {
576
993
  protected void setup() {
577
994
  }
578
995
 
579
-
580
- protected void draw(int idxId, int count, int offset) {
996
+ /**
997
+ *
998
+ * @param idxId
999
+ * @param count
1000
+ * @param offset
1001
+ */
1002
+ protected void draw(int idxId, int count, int offset) {
581
1003
  pgl.bindBuffer(PGL.ELEMENT_ARRAY_BUFFER, idxId);
582
1004
  pgl.drawElements(PGL.TRIANGLES, count, PGL.INDEX_TYPE,
583
1005
  offset * PGL.SIZEOF_INDEX);
@@ -608,8 +1030,17 @@ public class PShader implements PConstants {
608
1030
  return pgl.getUniformLocation(glProgram, name);
609
1031
  }
610
1032
 
611
-
612
- protected void setAttributeVBO(int loc, int vboId, int size, int type,
1033
+ /**
1034
+ *
1035
+ * @param loc
1036
+ * @param vboId
1037
+ * @param size
1038
+ * @param type
1039
+ * @param normalized
1040
+ * @param stride
1041
+ * @param offset
1042
+ */
1043
+ protected void setAttributeVBO(int loc, int vboId, int size, int type,
613
1044
  boolean normalized, int stride, int offset) {
614
1045
  if (-1 < loc) {
615
1046
  pgl.bindBuffer(PGL.ARRAY_BUFFER, vboId);
@@ -617,63 +1048,114 @@ public class PShader implements PConstants {
617
1048
  }
618
1049
  }
619
1050
 
620
-
621
- protected void setUniformValue(int loc, int x) {
1051
+ /**
1052
+ *
1053
+ * @param loc
1054
+ * @param x
1055
+ */
1056
+ protected void setUniformValue(int loc, int x) {
622
1057
  if (-1 < loc) {
623
1058
  pgl.uniform1i(loc, x);
624
1059
  }
625
1060
  }
626
1061
 
627
-
628
- protected void setUniformValue(int loc, int x, int y) {
1062
+ /**
1063
+ *
1064
+ * @param loc
1065
+ * @param x
1066
+ * @param y
1067
+ */
1068
+ protected void setUniformValue(int loc, int x, int y) {
629
1069
  if (-1 < loc) {
630
1070
  pgl.uniform2i(loc, x, y);
631
1071
  }
632
1072
  }
633
1073
 
634
-
635
- protected void setUniformValue(int loc, int x, int y, int z) {
1074
+ /**
1075
+ *
1076
+ * @param loc
1077
+ * @param x
1078
+ * @param y
1079
+ * @param z
1080
+ */
1081
+ protected void setUniformValue(int loc, int x, int y, int z) {
636
1082
  if (-1 < loc) {
637
1083
  pgl.uniform3i(loc, x, y, z);
638
1084
  }
639
1085
  }
640
1086
 
641
-
642
- protected void setUniformValue(int loc, int x, int y, int z, int w) {
1087
+ /**
1088
+ *
1089
+ * @param loc
1090
+ * @param x
1091
+ * @param y
1092
+ * @param z
1093
+ * @param w
1094
+ */
1095
+ protected void setUniformValue(int loc, int x, int y, int z, int w) {
643
1096
  if (-1 < loc) {
644
1097
  pgl.uniform4i(loc, x, y, z, w);
645
1098
  }
646
1099
  }
647
1100
 
648
-
649
- protected void setUniformValue(int loc, float x) {
1101
+ /**
1102
+ *
1103
+ * @param loc
1104
+ * @param x
1105
+ */
1106
+ protected void setUniformValue(int loc, float x) {
650
1107
  if (-1 < loc) {
651
1108
  pgl.uniform1f(loc, x);
652
1109
  }
653
1110
  }
654
1111
 
655
- protected void setUniformValue(int loc, float x, float y) {
1112
+ /**
1113
+ *
1114
+ * @param loc
1115
+ * @param x
1116
+ * @param y
1117
+ */
1118
+ protected void setUniformValue(int loc, float x, float y) {
656
1119
  if (-1 < loc) {
657
1120
  pgl.uniform2f(loc, x, y);
658
1121
  }
659
1122
  }
660
1123
 
661
-
662
- protected void setUniformValue(int loc, float x, float y, float z) {
1124
+ /**
1125
+ *
1126
+ * @param loc
1127
+ * @param x
1128
+ * @param y
1129
+ * @param z
1130
+ */
1131
+ protected void setUniformValue(int loc, float x, float y, float z) {
663
1132
  if (-1 < loc) {
664
1133
  pgl.uniform3f(loc, x, y, z);
665
1134
  }
666
1135
  }
667
1136
 
668
-
669
- protected void setUniformValue(int loc, float x, float y, float z, float w) {
1137
+ /**
1138
+ *
1139
+ * @param loc
1140
+ * @param x
1141
+ * @param y
1142
+ * @param z
1143
+ * @param w
1144
+ */
1145
+ protected void setUniformValue(int loc, float x, float y, float z, float w) {
670
1146
  if (-1 < loc) {
671
1147
  pgl.uniform4f(loc, x, y, z, w);
672
1148
  }
673
1149
  }
674
1150
 
675
-
676
- protected void setUniformVector(int loc, int[] vec, int ncoords,
1151
+ /**
1152
+ *
1153
+ * @param loc
1154
+ * @param vec
1155
+ * @param ncoords
1156
+ * @param length
1157
+ */
1158
+ protected void setUniformVector(int loc, int[] vec, int ncoords,
677
1159
  int length) {
678
1160
  if (-1 < loc) {
679
1161
  updateIntBuffer(vec);
@@ -689,8 +1171,14 @@ public class PShader implements PConstants {
689
1171
  }
690
1172
  }
691
1173
 
692
-
693
- protected void setUniformVector(int loc, float[] vec, int ncoords,
1174
+ /**
1175
+ *
1176
+ * @param loc
1177
+ * @param vec
1178
+ * @param ncoords
1179
+ * @param length
1180
+ */
1181
+ protected void setUniformVector(int loc, float[] vec, int ncoords,
694
1182
  int length) {
695
1183
  if (-1 < loc) {
696
1184
  updateFloatBuffer(vec);
@@ -706,8 +1194,12 @@ public class PShader implements PConstants {
706
1194
  }
707
1195
  }
708
1196
 
709
-
710
- protected void setUniformMatrix(int loc, float[] mat) {
1197
+ /**
1198
+ *
1199
+ * @param loc
1200
+ * @param mat
1201
+ */
1202
+ protected void setUniformMatrix(int loc, float[] mat) {
711
1203
  if (-1 < loc) {
712
1204
  updateFloatBuffer(mat);
713
1205
  if (mat.length == 4) {
@@ -720,8 +1212,12 @@ public class PShader implements PConstants {
720
1212
  }
721
1213
  }
722
1214
 
723
-
724
- protected void setUniformTex(int loc, Texture tex) {
1215
+ /**
1216
+ *
1217
+ * @param loc
1218
+ * @param tex
1219
+ */
1220
+ protected void setUniformTex(int loc, Texture tex) {
725
1221
  if (texUnits != null) {
726
1222
  Integer unit = texUnits.get(loc);
727
1223
  if (unit != null) {
@@ -733,16 +1229,23 @@ public class PShader implements PConstants {
733
1229
  }
734
1230
  }
735
1231
 
736
-
737
- protected void setUniformImpl(String name, int type, Object value) {
1232
+ /**
1233
+ *
1234
+ * @param name
1235
+ * @param type
1236
+ * @param value
1237
+ */
1238
+ protected void setUniformImpl(String name, int type, Object value) {
738
1239
  if (uniformValues == null) {
739
1240
  uniformValues = new HashMap<String, UniformValue>();
740
1241
  }
741
1242
  uniformValues.put(name, new UniformValue(type, value));
742
1243
  }
743
1244
 
744
-
745
- protected void consumeUniforms() {
1245
+ /**
1246
+ *
1247
+ */
1248
+ protected void consumeUniforms() {
746
1249
  if (uniformValues != null && 0 < uniformValues.size()) {
747
1250
  int unit = 0;
748
1251
  for (String name: uniformValues.keySet()) {
@@ -844,18 +1347,26 @@ public class PShader implements PConstants {
844
1347
  }
845
1348
  }
846
1349
 
847
-
848
- protected void updateIntBuffer(int[] vec) {
1350
+ /**
1351
+ *
1352
+ * @param vec
1353
+ */
1354
+ protected void updateIntBuffer(int[] vec) {
849
1355
  intBuffer = PGL.updateIntBuffer(intBuffer, vec, false);
850
1356
  }
851
1357
 
852
-
853
- protected void updateFloatBuffer(float[] vec) {
1358
+ /**
1359
+ *
1360
+ * @param vec
1361
+ */
1362
+ protected void updateFloatBuffer(float[] vec) {
854
1363
  floatBuffer = PGL.updateFloatBuffer(floatBuffer, vec, false);
855
1364
  }
856
1365
 
857
-
858
- protected void bindTextures() {
1366
+ /**
1367
+ *
1368
+ */
1369
+ protected void bindTextures() {
859
1370
  if (textures != null && texUnits != null) {
860
1371
  for (int loc: textures.keySet()) {
861
1372
  Texture tex = textures.get(loc);
@@ -870,8 +1381,10 @@ public class PShader implements PConstants {
870
1381
  }
871
1382
  }
872
1383
 
873
-
874
- protected void unbindTextures() {
1384
+ /**
1385
+ *
1386
+ */
1387
+ protected void unbindTextures() {
875
1388
  if (textures != null && texUnits != null) {
876
1389
  for (int loc: textures.keySet()) {
877
1390
  Texture tex = textures.get(loc);
@@ -887,8 +1400,10 @@ public class PShader implements PConstants {
887
1400
  }
888
1401
  }
889
1402
 
890
-
891
- public void init() {
1403
+ /**
1404
+ *
1405
+ */
1406
+ public void init() {
892
1407
  if (glProgram == 0 || contextIsOutdated()) {
893
1408
  create();
894
1409
  if (compile()) {
@@ -904,14 +1419,19 @@ public class PShader implements PConstants {
904
1419
  }
905
1420
  }
906
1421
 
907
-
908
- protected void create() {
1422
+ /**
1423
+ *
1424
+ */
1425
+ protected void create() {
909
1426
  context = pgl.getCurrentContext();
910
1427
  glres = new GLResourceShader(this);
911
1428
  }
912
1429
 
913
-
914
- protected boolean compile() {
1430
+ /**
1431
+ *
1432
+ * @return
1433
+ */
1434
+ protected boolean compile() {
915
1435
  boolean vertRes = true;
916
1436
  if (hasVertexShader()) {
917
1437
  vertRes = compileVertexShader();
@@ -929,8 +1449,10 @@ public class PShader implements PConstants {
929
1449
  return vertRes && fragRes;
930
1450
  }
931
1451
 
932
-
933
- protected void validate() {
1452
+ /**
1453
+ *
1454
+ */
1455
+ protected void validate() {
934
1456
  pgl.getProgramiv(glProgram, PGL.LINK_STATUS, intBuffer);
935
1457
  boolean linked = intBuffer.get(0) == 0 ? false : true;
936
1458
  if (!linked) {
@@ -947,8 +1469,11 @@ public class PShader implements PConstants {
947
1469
  }
948
1470
  }
949
1471
 
950
-
951
- protected boolean contextIsOutdated() {
1472
+ /**
1473
+ *
1474
+ * @return
1475
+ */
1476
+ protected boolean contextIsOutdated() {
952
1477
  boolean outdated = !pgl.contextIsCurrent(context);
953
1478
  if (outdated) {
954
1479
  dispose();
@@ -956,20 +1481,26 @@ public class PShader implements PConstants {
956
1481
  return outdated;
957
1482
  }
958
1483
 
959
-
960
-
961
- protected boolean hasVertexShader() {
1484
+ /**
1485
+ *
1486
+ * @return
1487
+ */
1488
+ protected boolean hasVertexShader() {
962
1489
  return vertexShaderSource != null && 0 < vertexShaderSource.length;
963
1490
  }
964
1491
 
965
-
966
- protected boolean hasFragmentShader() {
1492
+ /**
1493
+ *
1494
+ * @return
1495
+ */
1496
+ protected boolean hasFragmentShader() {
967
1497
  return fragmentShaderSource != null && 0 < fragmentShaderSource.length;
968
1498
  }
969
1499
 
970
1500
 
971
1501
  /**
972
1502
  * @param shaderSource a string containing the shader's code
1503
+ * @return
973
1504
  */
974
1505
  protected boolean compileVertexShader() {
975
1506
  pgl.shaderSource(glVertex, PApplet.join(vertexShaderSource, "\n"));
@@ -989,6 +1520,7 @@ public class PShader implements PConstants {
989
1520
 
990
1521
  /**
991
1522
  * @param shaderSource a string containing the shader's code
1523
+ * @return
992
1524
  */
993
1525
  protected boolean compileFragmentShader() {
994
1526
  pgl.shaderSource(glFragment, PApplet.join(fragmentShaderSource, "\n"));
@@ -1005,8 +1537,10 @@ public class PShader implements PConstants {
1005
1537
  }
1006
1538
  }
1007
1539
 
1008
-
1009
- protected void dispose() {
1540
+ /**
1541
+ *
1542
+ */
1543
+ protected void dispose() {
1010
1544
  if (glres != null) {
1011
1545
  glres.dispose();
1012
1546
  glVertex = 0;
@@ -1016,8 +1550,13 @@ public class PShader implements PConstants {
1016
1550
  }
1017
1551
  }
1018
1552
 
1019
-
1020
- static protected int getShaderType(String[] source, int defaultType) {
1553
+ /**
1554
+ *
1555
+ * @param source
1556
+ * @param defaultType
1557
+ * @return
1558
+ */
1559
+ static protected int getShaderType(String[] source, int defaultType) {
1021
1560
  for (int i = 0; i < source.length; i++) {
1022
1561
  String line = source[i].trim();
1023
1562
 
@@ -1056,38 +1595,62 @@ public class PShader implements PConstants {
1056
1595
  //
1057
1596
  // Processing specific
1058
1597
 
1598
+ /**
1599
+ *
1600
+ * @return
1601
+ */
1602
+
1059
1603
 
1060
1604
  protected int getType() {
1061
1605
  return type;
1062
1606
  }
1063
1607
 
1064
-
1065
- protected void setType(int type) {
1608
+ /**
1609
+ *
1610
+ * @param type
1611
+ */
1612
+ protected void setType(int type) {
1066
1613
  this.type = type;
1067
1614
  }
1068
1615
 
1069
-
1070
- protected boolean hasType() {
1616
+ /**
1617
+ *
1618
+ * @return
1619
+ */
1620
+ protected boolean hasType() {
1071
1621
  return POINT <= type && type <= TEXLIGHT;
1072
1622
  }
1073
1623
 
1074
-
1075
- protected boolean isPointShader() {
1624
+ /**
1625
+ *
1626
+ * @return
1627
+ */
1628
+ protected boolean isPointShader() {
1076
1629
  return type == POINT;
1077
1630
  }
1078
1631
 
1079
-
1080
- protected boolean isLineShader() {
1632
+ /**
1633
+ *
1634
+ * @return
1635
+ */
1636
+ protected boolean isLineShader() {
1081
1637
  return type == LINE;
1082
1638
  }
1083
1639
 
1084
-
1085
- protected boolean isPolyShader() {
1640
+ /**
1641
+ *
1642
+ * @return
1643
+ */
1644
+ protected boolean isPolyShader() {
1086
1645
  return POLY <= type && type <= TEXLIGHT;
1087
1646
  }
1088
1647
 
1089
-
1090
- protected boolean checkPolyType(int type) {
1648
+ /**
1649
+ *
1650
+ * @param type
1651
+ * @return
1652
+ */
1653
+ protected boolean checkPolyType(int type) {
1091
1654
  if (getType() == PShader.POLY) return true;
1092
1655
 
1093
1656
  if (getType() != type) {
@@ -1106,18 +1669,26 @@ public class PShader implements PConstants {
1106
1669
  return true;
1107
1670
  }
1108
1671
 
1109
-
1110
- protected int getLastTexUnit() {
1672
+ /**
1673
+ *
1674
+ * @return
1675
+ */
1676
+ protected int getLastTexUnit() {
1111
1677
  return texUnits == null ? -1 : texUnits.size() - 1;
1112
1678
  }
1113
1679
 
1114
-
1115
- protected void setRenderer(PGraphicsOpenGL pg) {
1680
+ /**
1681
+ *
1682
+ * @param pg
1683
+ */
1684
+ protected void setRenderer(PGraphicsOpenGL pg) {
1116
1685
  this.currentPG = pg;
1117
1686
  }
1118
1687
 
1119
-
1120
- protected void loadAttributes() {
1688
+ /**
1689
+ *
1690
+ */
1691
+ protected void loadAttributes() {
1121
1692
  if (loadedAttributes) return;
1122
1693
 
1123
1694
  vertexLoc = getAttributeLoc("vertex");
@@ -1142,8 +1713,10 @@ public class PShader implements PConstants {
1142
1713
  loadedAttributes = true;
1143
1714
  }
1144
1715
 
1145
-
1146
- protected void loadUniforms() {
1716
+ /**
1717
+ *
1718
+ */
1719
+ protected void loadUniforms() {
1147
1720
  if (loadedUniforms) return;
1148
1721
  transformMatLoc = getUniformLoc("transform");
1149
1722
  if (transformMatLoc == -1)
@@ -1185,8 +1758,10 @@ public class PShader implements PConstants {
1185
1758
  loadedUniforms = true;
1186
1759
  }
1187
1760
 
1188
-
1189
- protected void setCommonUniforms() {
1761
+ /**
1762
+ *
1763
+ */
1764
+ protected void setCommonUniforms() {
1190
1765
  if (-1 < transformMatLoc) {
1191
1766
  currentPG.updateGLProjmodelview();
1192
1767
  setUniformMatrix(transformMatLoc, currentPG.glProjmodelview);
@@ -1226,8 +1801,10 @@ public class PShader implements PConstants {
1226
1801
  }
1227
1802
  }
1228
1803
 
1229
-
1230
- protected void bindTyped() {
1804
+ /**
1805
+ *
1806
+ */
1807
+ protected void bindTyped() {
1231
1808
  if (currentPG == null) {
1232
1809
  setRenderer(primaryPG.getCurrentPG());
1233
1810
  loadAttributes();
@@ -1290,7 +1867,10 @@ public class PShader implements PConstants {
1290
1867
  }
1291
1868
  }
1292
1869
 
1293
- protected void unbindTyped() {
1870
+ /**
1871
+ *
1872
+ */
1873
+ protected void unbindTyped() {
1294
1874
  if (-1 < offsetLoc) pgl.disableVertexAttribArray(offsetLoc);
1295
1875
 
1296
1876
  if (-1 < directionLoc) pgl.disableVertexAttribArray(directionLoc);
@@ -1322,7 +1902,11 @@ public class PShader implements PConstants {
1322
1902
  pgl.bindBuffer(PGL.ARRAY_BUFFER, 0);
1323
1903
  }
1324
1904
 
1325
- protected void setTexture(Texture tex) {
1905
+ /**
1906
+ *
1907
+ * @param tex
1908
+ */
1909
+ protected void setTexture(Texture tex) {
1326
1910
  texture = tex;
1327
1911
 
1328
1912
  float scaleu = 1;
@@ -1368,74 +1952,173 @@ public class PShader implements PConstants {
1368
1952
  }
1369
1953
  }
1370
1954
 
1371
-
1372
- protected boolean supportsTexturing() {
1955
+ /**
1956
+ *
1957
+ * @return
1958
+ */
1959
+ protected boolean supportsTexturing() {
1373
1960
  return -1 < textureLoc;
1374
1961
  }
1375
1962
 
1376
- protected boolean supportLighting() {
1963
+ /**
1964
+ *
1965
+ * @return
1966
+ */
1967
+ protected boolean supportLighting() {
1377
1968
  return -1 < lightCountLoc || -1 < lightPositionLoc || -1 < lightNormalLoc;
1378
1969
  }
1379
1970
 
1380
- protected boolean accessTexCoords() {
1971
+ /**
1972
+ *
1973
+ * @return
1974
+ */
1975
+ protected boolean accessTexCoords() {
1381
1976
  return -1 < texCoordLoc;
1382
1977
  }
1383
1978
 
1384
- protected boolean accessNormals() {
1979
+ /**
1980
+ *
1981
+ * @return
1982
+ */
1983
+ protected boolean accessNormals() {
1385
1984
  return -1 < normalLoc;
1386
1985
  }
1387
1986
 
1388
- protected boolean accessLightAttribs() {
1987
+ /**
1988
+ *
1989
+ * @return
1990
+ */
1991
+ protected boolean accessLightAttribs() {
1389
1992
  return -1 < ambientLoc || -1 < specularLoc || -1 < emissiveLoc ||
1390
1993
  -1 < shininessLoc;
1391
1994
  }
1392
1995
 
1393
- protected void setVertexAttribute(int vboId, int size, int type,
1996
+ /**
1997
+ *
1998
+ * @param vboId
1999
+ * @param size
2000
+ * @param type
2001
+ * @param stride
2002
+ * @param offset
2003
+ */
2004
+ protected void setVertexAttribute(int vboId, int size, int type,
1394
2005
  int stride, int offset) {
1395
2006
  setAttributeVBO(vertexLoc, vboId, size, type, false, stride, offset);
1396
2007
  }
1397
2008
 
1398
- protected void setColorAttribute(int vboId, int size, int type,
2009
+ /**
2010
+ *
2011
+ * @param vboId
2012
+ * @param size
2013
+ * @param type
2014
+ * @param stride
2015
+ * @param offset
2016
+ */
2017
+ protected void setColorAttribute(int vboId, int size, int type,
1399
2018
  int stride, int offset) {
1400
2019
  setAttributeVBO(colorLoc, vboId, size, type, true, stride, offset);
1401
2020
  }
1402
2021
 
1403
- protected void setNormalAttribute(int vboId, int size, int type,
2022
+ /**
2023
+ *
2024
+ * @param vboId
2025
+ * @param size
2026
+ * @param type
2027
+ * @param stride
2028
+ * @param offset
2029
+ */
2030
+ protected void setNormalAttribute(int vboId, int size, int type,
1404
2031
  int stride, int offset) {
1405
2032
  setAttributeVBO(normalLoc, vboId, size, type, false, stride, offset);
1406
2033
  }
1407
2034
 
1408
- protected void setTexcoordAttribute(int vboId, int size, int type,
2035
+ /**
2036
+ *
2037
+ * @param vboId
2038
+ * @param size
2039
+ * @param type
2040
+ * @param stride
2041
+ * @param offset
2042
+ */
2043
+ protected void setTexcoordAttribute(int vboId, int size, int type,
1409
2044
  int stride, int offset) {
1410
2045
  setAttributeVBO(texCoordLoc, vboId, size, type, false, stride, offset);
1411
2046
  }
1412
2047
 
1413
- protected void setAmbientAttribute(int vboId, int size, int type,
2048
+ /**
2049
+ *
2050
+ * @param vboId
2051
+ * @param size
2052
+ * @param type
2053
+ * @param stride
2054
+ * @param offset
2055
+ */
2056
+ protected void setAmbientAttribute(int vboId, int size, int type,
1414
2057
  int stride, int offset) {
1415
2058
  setAttributeVBO(ambientLoc, vboId, size, type, true, stride, offset);
1416
2059
  }
1417
2060
 
1418
- protected void setSpecularAttribute(int vboId, int size, int type,
2061
+ /**
2062
+ *
2063
+ * @param vboId
2064
+ * @param size
2065
+ * @param type
2066
+ * @param stride
2067
+ * @param offset
2068
+ */
2069
+ protected void setSpecularAttribute(int vboId, int size, int type,
1419
2070
  int stride, int offset) {
1420
2071
  setAttributeVBO(specularLoc, vboId, size, type, true, stride, offset);
1421
2072
  }
1422
2073
 
1423
- protected void setEmissiveAttribute(int vboId, int size, int type,
2074
+ /**
2075
+ *
2076
+ * @param vboId
2077
+ * @param size
2078
+ * @param type
2079
+ * @param stride
2080
+ * @param offset
2081
+ */
2082
+ protected void setEmissiveAttribute(int vboId, int size, int type,
1424
2083
  int stride, int offset) {
1425
2084
  setAttributeVBO(emissiveLoc, vboId, size, type, true, stride, offset);
1426
2085
  }
1427
2086
 
1428
- protected void setShininessAttribute(int vboId, int size, int type,
2087
+ /**
2088
+ *
2089
+ * @param vboId
2090
+ * @param size
2091
+ * @param type
2092
+ * @param stride
2093
+ * @param offset
2094
+ */
2095
+ protected void setShininessAttribute(int vboId, int size, int type,
1429
2096
  int stride, int offset) {
1430
2097
  setAttributeVBO(shininessLoc, vboId, size, type, false, stride, offset);
1431
2098
  }
1432
2099
 
1433
- protected void setLineAttribute(int vboId, int size, int type,
2100
+ /**
2101
+ *
2102
+ * @param vboId
2103
+ * @param size
2104
+ * @param type
2105
+ * @param stride
2106
+ * @param offset
2107
+ */
2108
+ protected void setLineAttribute(int vboId, int size, int type,
1434
2109
  int stride, int offset) {
1435
2110
  setAttributeVBO(directionLoc, vboId, size, type, false, stride, offset);
1436
2111
  }
1437
2112
 
1438
- protected void setPointAttribute(int vboId, int size, int type,
2113
+ /**
2114
+ *
2115
+ * @param vboId
2116
+ * @param size
2117
+ * @param type
2118
+ * @param stride
2119
+ * @param offset
2120
+ */
2121
+ protected void setPointAttribute(int vboId, int size, int type,
1439
2122
  int stride, int offset) {
1440
2123
  setAttributeVBO(offsetLoc, vboId, size, type, false, stride, offset);
1441
2124
  }
@@ -1445,6 +2128,10 @@ public class PShader implements PConstants {
1445
2128
  //
1446
2129
  // Class to store a user-specified value for a uniform parameter
1447
2130
  // in the shader
2131
+
2132
+ /**
2133
+ *
2134
+ */
1448
2135
  protected static class UniformValue {
1449
2136
  static final int INT1 = 0;
1450
2137
  static final int INT2 = 1;