picrate 0.7.0-java → 0.8.0-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -1
  3. data/.mvn/wrapper/MavenWrapperDownloader.java +117 -0
  4. data/.mvn/wrapper/maven-wrapper.properties +2 -1
  5. data/.travis.yml +2 -5
  6. data/CHANGELOG.md +4 -0
  7. data/README.md +3 -3
  8. data/Rakefile +15 -27
  9. data/docs/_config.yml +1 -1
  10. data/docs/_posts/2018-05-11-arch-linux-arm.md +1 -1
  11. data/docs/_posts/2018-11-18-building-gem.md +1 -1
  12. data/lib/picrate/app.rb +1 -1
  13. data/lib/picrate/native_folder.rb +1 -1
  14. data/lib/picrate/version.rb +1 -1
  15. data/mvnw +127 -51
  16. data/mvnw.cmd +182 -0
  17. data/pom.rb +39 -30
  18. data/pom.xml +50 -37
  19. data/src/main/java/monkstone/ColorUtil.java +1 -1
  20. data/src/main/java/monkstone/core/LibraryProxy.java +0 -1
  21. data/src/main/java/monkstone/noise/SimplexNoise.java +1 -1
  22. data/src/main/java/monkstone/vecmath/GfxRender.java +87 -0
  23. data/src/main/java/monkstone/vecmath/ShapeRender.java +1 -1
  24. data/src/main/java/monkstone/vecmath/vec2/Vec2.java +1 -1
  25. data/src/main/java/processing/awt/PGraphicsJava2D.java +48 -50
  26. data/src/main/java/processing/awt/PShapeJava2D.java +10 -0
  27. data/src/main/java/processing/awt/PSurfaceAWT.java +315 -371
  28. data/src/main/java/processing/core/PApplet.java +15424 -15495
  29. data/src/main/java/processing/core/PConstants.java +4 -4
  30. data/src/main/java/processing/core/PFont.java +394 -369
  31. data/src/main/java/processing/core/PGraphics.java +11 -10
  32. data/src/main/java/processing/core/PImage.java +1389 -1435
  33. data/src/main/java/processing/core/PMatrix2D.java +297 -294
  34. data/src/main/java/processing/core/PMatrix3D.java +641 -594
  35. data/src/main/java/processing/core/PShape.java +1755 -1784
  36. data/src/main/java/processing/core/PShapeOBJ.java +145 -133
  37. data/src/main/java/processing/core/PShapeSVG.java +808 -801
  38. data/src/main/java/processing/core/PStyle.java +141 -149
  39. data/src/main/java/processing/core/PSurface.java +111 -117
  40. data/src/main/java/processing/core/PSurfaceNone.java +178 -187
  41. data/src/main/java/processing/javafx/PGraphicsFX2D.java +349 -346
  42. data/src/main/java/processing/opengl/FontTexture.java +40 -59
  43. data/src/main/java/processing/opengl/FrameBuffer.java +28 -18
  44. data/src/main/java/processing/opengl/LinePath.java +7 -7
  45. data/src/main/java/processing/opengl/LineStroker.java +6 -10
  46. data/src/main/java/processing/opengl/PGL.java +56 -44
  47. data/src/main/java/processing/opengl/PGraphicsOpenGL.java +909 -2338
  48. data/src/main/java/processing/opengl/PJOGL.java +1722 -1763
  49. data/src/main/java/processing/opengl/PShader.java +1308 -1192
  50. data/src/main/java/processing/opengl/PShapeOpenGL.java +487 -1811
  51. data/src/main/java/processing/opengl/PSurfaceJOGL.java +482 -497
  52. data/src/main/java/processing/opengl/Texture.java +99 -76
  53. data/src/main/java/processing/opengl/VertexBuffer.java +41 -43
  54. data/vendors/Rakefile +1 -1
  55. metadata +7 -4
@@ -24,6 +24,7 @@
24
24
 
25
25
  package processing.opengl;
26
26
 
27
+ import java.lang.reflect.InvocationTargetException;
27
28
  import processing.core.PApplet;
28
29
  import processing.core.PConstants;
29
30
  import processing.core.PGraphics;
@@ -367,7 +368,7 @@ public class Texture implements PConstants {
367
368
  * @param height int
368
369
  * @param params GLTextureParameters
369
370
  */
370
- public void init(int width, int height, Parameters params) {
371
+ public final void init(int width, int height, Parameters params) {
371
372
  setParameters(params);
372
373
  setSize(width, height);
373
374
  allocate();
@@ -798,41 +799,51 @@ public class Texture implements PConstants {
798
799
  int glMagFilter0 = glMagFilter;
799
800
  int glMinFilter0 = glMinFilter;
800
801
  if (mipmaps) {
801
- if (sampling == POINT) {
802
- glMagFilter = PGL.NEAREST;
803
- glMinFilter = PGL.NEAREST;
804
- usingMipmaps = false;
805
- } else if (sampling == LINEAR) {
806
- glMagFilter = PGL.NEAREST;
807
- glMinFilter =
808
- PGL.MIPMAPS_ENABLED ? PGL.LINEAR_MIPMAP_NEAREST : PGL.LINEAR;
809
- usingMipmaps = true;
810
- } else if (sampling == BILINEAR) {
811
- glMagFilter = PGL.LINEAR;
812
- glMinFilter =
813
- PGL.MIPMAPS_ENABLED ? PGL.LINEAR_MIPMAP_NEAREST : PGL.LINEAR;
814
- usingMipmaps = true;
815
- } else if (sampling == TRILINEAR) {
816
- glMagFilter = PGL.LINEAR;
817
- glMinFilter =
818
- PGL.MIPMAPS_ENABLED ? PGL.LINEAR_MIPMAP_LINEAR : PGL.LINEAR;
819
- usingMipmaps = true;
820
- } else {
821
- throw new RuntimeException("Unknown texture filtering mode");
802
+ switch (sampling) {
803
+ case POINT:
804
+ glMagFilter = PGL.NEAREST;
805
+ glMinFilter = PGL.NEAREST;
806
+ usingMipmaps = false;
807
+ break;
808
+ case LINEAR:
809
+ glMagFilter = PGL.NEAREST;
810
+ glMinFilter =
811
+ PGL.MIPMAPS_ENABLED ? PGL.LINEAR_MIPMAP_NEAREST : PGL.LINEAR;
812
+ usingMipmaps = true;
813
+ break;
814
+ case BILINEAR:
815
+ glMagFilter = PGL.LINEAR;
816
+ glMinFilter =
817
+ PGL.MIPMAPS_ENABLED ? PGL.LINEAR_MIPMAP_NEAREST : PGL.LINEAR;
818
+ usingMipmaps = true;
819
+ break;
820
+ case TRILINEAR:
821
+ glMagFilter = PGL.LINEAR;
822
+ glMinFilter =
823
+ PGL.MIPMAPS_ENABLED ? PGL.LINEAR_MIPMAP_LINEAR : PGL.LINEAR;
824
+ usingMipmaps = true;
825
+ break;
826
+ default:
827
+ throw new RuntimeException("Unknown texture filtering mode");
822
828
  }
823
829
  } else {
824
830
  usingMipmaps = false;
825
- if (sampling == POINT) {
826
- glMagFilter = PGL.NEAREST;
827
- glMinFilter = PGL.NEAREST;
828
- } else if (sampling == LINEAR) {
829
- glMagFilter = PGL.NEAREST;
830
- glMinFilter = PGL.LINEAR;
831
- } else if (sampling == BILINEAR || sampling == TRILINEAR) {
832
- glMagFilter = PGL.LINEAR;
833
- glMinFilter = PGL.LINEAR;
834
- } else {
835
- throw new RuntimeException("Unknown texture filtering mode");
831
+ switch (sampling) {
832
+ case POINT:
833
+ glMagFilter = PGL.NEAREST;
834
+ glMinFilter = PGL.NEAREST;
835
+ break;
836
+ case LINEAR:
837
+ glMagFilter = PGL.NEAREST;
838
+ glMinFilter = PGL.LINEAR;
839
+ break;
840
+ case BILINEAR:
841
+ case TRILINEAR:
842
+ glMagFilter = PGL.LINEAR;
843
+ glMinFilter = PGL.LINEAR;
844
+ break;
845
+ default:
846
+ throw new RuntimeException("Unknown texture filtering mode");
836
847
  }
837
848
  }
838
849
 
@@ -1168,7 +1179,7 @@ public class Texture implements PConstants {
1168
1179
  public void copyBufferFromSource(Object natRef, ByteBuffer byteBuf,
1169
1180
  int w, int h) {
1170
1181
  if (bufferCache == null) {
1171
- bufferCache = new LinkedList<BufferData>();
1182
+ bufferCache = new LinkedList<>();
1172
1183
  }
1173
1184
 
1174
1185
  if (bufferCache.size() + 1 <= MAX_BUFFER_CACHE_SIZE) {
@@ -1179,7 +1190,6 @@ public class Texture implements PConstants {
1179
1190
  try {
1180
1191
  usedBuffers.add(new BufferData(natRef, byteBuf.asIntBuffer(), w, h));
1181
1192
  } catch (Exception e) {
1182
- e.printStackTrace();
1183
1193
  }
1184
1194
  }
1185
1195
  }
@@ -1231,7 +1241,7 @@ public class Texture implements PConstants {
1231
1241
  // renderer draws the texture, and hence put the pixels put of sync, we
1232
1242
  // simply empty the cache.
1233
1243
  if (usedBuffers == null) {
1234
- usedBuffers = new LinkedList<BufferData>();
1244
+ usedBuffers = new LinkedList<>();
1235
1245
  }
1236
1246
  while (0 < bufferCache.size()) {
1237
1247
  data = bufferCache.remove(0);
@@ -1279,7 +1289,7 @@ public class Texture implements PConstants {
1279
1289
  // Putting the buffer in the used buffers list to dispose at the end of
1280
1290
  // draw.
1281
1291
  if (usedBuffers == null) {
1282
- usedBuffers = new LinkedList<BufferData>();
1292
+ usedBuffers = new LinkedList<>();
1283
1293
  }
1284
1294
  usedBuffers.add(data);
1285
1295
 
@@ -1296,7 +1306,7 @@ public class Texture implements PConstants {
1296
1306
  try {
1297
1307
  disposeBufferMethod = bufferSource.getClass().
1298
1308
  getMethod("disposeBuffer", new Class[] { Object.class });
1299
- } catch (Exception e) {
1309
+ } catch (NoSuchMethodException | SecurityException e) {
1300
1310
  throw new RuntimeException("Provided source object doesn't have a " +
1301
1311
  "disposeBuffer method.");
1302
1312
  }
@@ -1828,7 +1838,6 @@ public class Texture implements PConstants {
1828
1838
  /**
1829
1839
  * Sets texture target and internal format according to the target and
1830
1840
  * type specified.
1831
- * @param target int
1832
1841
  * @param params GLTextureParameters
1833
1842
  */
1834
1843
  protected void setParameters(Parameters params) {
@@ -1838,14 +1847,18 @@ public class Texture implements PConstants {
1838
1847
  throw new RuntimeException("Unknown texture target");
1839
1848
  }
1840
1849
 
1841
- if (params.format == RGB) {
1842
- glFormat = PGL.RGB;
1843
- } else if (params.format == ARGB) {
1844
- glFormat = PGL.RGBA;
1845
- } else if (params.format == ALPHA) {
1846
- glFormat = PGL.ALPHA;
1847
- } else {
1848
- throw new RuntimeException("Unknown texture format");
1850
+ switch (params.format) {
1851
+ case RGB:
1852
+ glFormat = PGL.RGB;
1853
+ break;
1854
+ case ARGB:
1855
+ glFormat = PGL.RGBA;
1856
+ break;
1857
+ case ALPHA:
1858
+ glFormat = PGL.ALPHA;
1859
+ break;
1860
+ default:
1861
+ throw new RuntimeException("Unknown texture format");
1849
1862
  }
1850
1863
 
1851
1864
  boolean mipmaps = params.mipmaps && PGL.MIPMAPS_ENABLED;
@@ -1857,36 +1870,47 @@ public class Texture implements PConstants {
1857
1870
  mipmaps = false;
1858
1871
  }
1859
1872
 
1860
- if (params.sampling == POINT) {
1861
- glMagFilter = PGL.NEAREST;
1862
- glMinFilter = PGL.NEAREST;
1863
- } else if (params.sampling == LINEAR) {
1864
- glMagFilter = PGL.NEAREST;
1865
- glMinFilter = mipmaps ? PGL.LINEAR_MIPMAP_NEAREST : PGL.LINEAR;
1866
- } else if (params.sampling == BILINEAR) {
1867
- glMagFilter = PGL.LINEAR;
1868
- glMinFilter = mipmaps ? PGL.LINEAR_MIPMAP_NEAREST : PGL.LINEAR;
1869
- } else if (params.sampling == TRILINEAR) {
1870
- glMagFilter = PGL.LINEAR;
1871
- glMinFilter = mipmaps ? PGL.LINEAR_MIPMAP_LINEAR : PGL.LINEAR;
1872
- } else {
1873
- throw new RuntimeException("Unknown texture filtering mode");
1873
+ switch (params.sampling) {
1874
+ case POINT:
1875
+ glMagFilter = PGL.NEAREST;
1876
+ glMinFilter = PGL.NEAREST;
1877
+ break;
1878
+ case LINEAR:
1879
+ glMagFilter = PGL.NEAREST;
1880
+ glMinFilter = mipmaps ? PGL.LINEAR_MIPMAP_NEAREST : PGL.LINEAR;
1881
+ break;
1882
+ case BILINEAR:
1883
+ glMagFilter = PGL.LINEAR;
1884
+ glMinFilter = mipmaps ? PGL.LINEAR_MIPMAP_NEAREST : PGL.LINEAR;
1885
+ break;
1886
+ case TRILINEAR:
1887
+ glMagFilter = PGL.LINEAR;
1888
+ glMinFilter = mipmaps ? PGL.LINEAR_MIPMAP_LINEAR : PGL.LINEAR;
1889
+ break;
1890
+ default:
1891
+ throw new RuntimeException("Unknown texture filtering mode");
1874
1892
  }
1875
1893
 
1876
- if (params.wrapU == CLAMP) {
1877
- glWrapS = PGL.CLAMP_TO_EDGE;
1878
- } else if (params.wrapU == REPEAT) {
1879
- glWrapS = PGL.REPEAT;
1880
- } else {
1881
- throw new RuntimeException("Unknown wrapping mode");
1894
+ switch (params.wrapU) {
1895
+ case CLAMP:
1896
+ glWrapS = PGL.CLAMP_TO_EDGE;
1897
+ break;
1898
+ case REPEAT:
1899
+ glWrapS = PGL.REPEAT;
1900
+ break;
1901
+ default:
1902
+ throw new RuntimeException("Unknown wrapping mode");
1882
1903
  }
1883
1904
 
1884
- if (params.wrapV == CLAMP) {
1885
- glWrapT = PGL.CLAMP_TO_EDGE;
1886
- } else if (params.wrapV == REPEAT) {
1887
- glWrapT = PGL.REPEAT;
1888
- } else {
1889
- throw new RuntimeException("Unknown wrapping mode");
1905
+ switch (params.wrapV) {
1906
+ case CLAMP:
1907
+ glWrapT = PGL.CLAMP_TO_EDGE;
1908
+ break;
1909
+ case REPEAT:
1910
+ glWrapT = PGL.REPEAT;
1911
+ break;
1912
+ default:
1913
+ throw new RuntimeException("Unknown wrapping mode");
1890
1914
  }
1891
1915
 
1892
1916
  usingMipmaps = glMinFilter == PGL.LINEAR_MIPMAP_NEAREST ||
@@ -2103,7 +2127,7 @@ public class Texture implements PConstants {
2103
2127
  *
2104
2128
  * @param src
2105
2129
  */
2106
- public void set(Parameters src) {
2130
+ public final void set(Parameters src) {
2107
2131
  this.target = src.target;
2108
2132
  this.format = src.format;
2109
2133
  this.sampling = src.sampling;
@@ -2137,8 +2161,7 @@ public class Texture implements PConstants {
2137
2161
  disposeBufferMethod.invoke(bufferSource, new Object[] { natBuf });
2138
2162
  natBuf = null;
2139
2163
  rgbBuf = null;
2140
- } catch (Exception e) {
2141
- e.printStackTrace();
2164
+ } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
2142
2165
  }
2143
2166
  }
2144
2167
  }
@@ -1,6 +1,6 @@
1
1
  /* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2
2
 
3
- /*
3
+ /*
4
4
  Part of the Processing project - http://processing.org
5
5
 
6
6
  Copyright (c) 2012-15 The Processing Foundation
@@ -20,48 +20,46 @@
20
20
  Public License along with this library; if not, write to the
21
21
  Free Software Foundation, Inc., 59 Temple Place, Suite 330,
22
22
  Boston, MA 02111-1307 USA
23
- */
24
-
23
+ */
25
24
  package processing.opengl;
26
25
 
27
26
  import processing.opengl.PGraphicsOpenGL.GLResourceVertexBuffer;
28
27
 
29
28
  // TODO: need to combine with PGraphicsOpenGL.VertexAttribute
30
-
31
29
  /**
32
30
  *
33
31
  * @author Martin Prout
34
32
  */
35
33
  public class VertexBuffer {
36
34
 
37
- /**
38
- *
39
- */
40
- static protected final int INIT_VERTEX_BUFFER_SIZE = 256;
35
+ /**
36
+ *
37
+ */
38
+ static protected final int INIT_VERTEX_BUFFER_SIZE = 256;
41
39
 
42
- /**
43
- *
44
- */
45
- static protected final int INIT_INDEX_BUFFER_SIZE = 512;
40
+ /**
41
+ *
42
+ */
43
+ static protected final int INIT_INDEX_BUFFER_SIZE = 512;
46
44
 
47
- /**
48
- *
49
- */
50
- public int glId;
45
+ /**
46
+ *
47
+ */
48
+ public int glId;
51
49
  int target;
52
50
  int elementSize;
53
51
  int ncoords;
54
52
  boolean index;
55
53
 
56
- /**
57
- *
58
- */
59
- protected PGL pgl; // The interface between Processing and OpenGL.
54
+ /**
55
+ *
56
+ */
57
+ protected PGL pgl; // The interface between Processing and OpenGL.
60
58
 
61
- /**
62
- *
63
- */
64
- protected int context; // The context that created this texture.
59
+ /**
60
+ *
61
+ */
62
+ protected int context; // The context that created this texture.
65
63
  private GLResourceVertexBuffer glres;
66
64
 
67
65
  VertexBuffer(PGraphicsOpenGL pg, int target, int ncoords, int esize) {
@@ -80,28 +78,28 @@ public class VertexBuffer {
80
78
  init();
81
79
  }
82
80
 
83
- /**
84
- *
85
- */
86
- protected void create() {
81
+ /**
82
+ *
83
+ */
84
+ protected final void create() {
87
85
  context = pgl.getCurrentContext();
88
86
  glres = new GLResourceVertexBuffer(this);
89
87
  }
90
88
 
91
- /**
92
- *
93
- */
94
- protected void init() {
95
- int size = index ? ncoords * INIT_INDEX_BUFFER_SIZE * elementSize :
96
- ncoords * INIT_VERTEX_BUFFER_SIZE * elementSize;
89
+ /**
90
+ *
91
+ */
92
+ protected final void init() {
93
+ int size = index ? ncoords * INIT_INDEX_BUFFER_SIZE * elementSize
94
+ : ncoords * INIT_VERTEX_BUFFER_SIZE * elementSize;
97
95
  pgl.bindBuffer(target, glId);
98
96
  pgl.bufferData(target, size, null, PGL.STATIC_DRAW);
99
97
  }
100
98
 
101
- /**
102
- *
103
- */
104
- protected void dispose() {
99
+ /**
100
+ *
101
+ */
102
+ protected void dispose() {
105
103
  if (glres != null) {
106
104
  glres.dispose();
107
105
  glId = 0;
@@ -109,11 +107,11 @@ public class VertexBuffer {
109
107
  }
110
108
  }
111
109
 
112
- /**
113
- *
114
- * @return
115
- */
116
- protected boolean contextIsOutdated() {
110
+ /**
111
+ *
112
+ * @return
113
+ */
114
+ protected boolean contextIsOutdated() {
117
115
  boolean outdated = !pgl.contextIsCurrent(context);
118
116
  if (outdated) {
119
117
  dispose();
@@ -9,7 +9,7 @@ SOUND_VERSION = 'v1.3.2'
9
9
  GLVIDEO = 'processing-glvideo.zip'
10
10
  VIDEO = 'video-2.zip'
11
11
  VIDEO_VERSION = '2'
12
- EXAMPLES = '0.2.0'
12
+ EXAMPLES = '0.3.0'
13
13
  HOME_DIR = ENV['HOME']
14
14
  CLOBBER.include(EXAMPLES, SOUND, GLVIDEO, VIDEO)
15
15
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: picrate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.8.0
5
5
  platform: java
6
6
  authors:
7
7
  - monkstone
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-04-10 00:00:00.000000000 Z
11
+ date: 2019-05-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -70,6 +70,7 @@ extra_rdoc_files: []
70
70
  files:
71
71
  - ".gitignore"
72
72
  - ".mvn/extensions.xml"
73
+ - ".mvn/wrapper/MavenWrapperDownloader.java"
73
74
  - ".mvn/wrapper/maven-wrapper.properties"
74
75
  - ".travis.yml"
75
76
  - CHANGELOG.md
@@ -179,7 +180,7 @@ files:
179
180
  - lib/jogl-all-natives-linux-amd64.jar
180
181
  - lib/jogl-all-natives-linux-armv6hf.jar
181
182
  - lib/jogl-all.jar
182
- - lib/picrate-0.7.0.jar
183
+ - lib/picrate-0.8.0.jar
183
184
  - lib/picrate.rb
184
185
  - lib/picrate/app.rb
185
186
  - lib/picrate/creators/parameters.rb
@@ -204,6 +205,7 @@ files:
204
205
  - library/video_event/video_event.rb
205
206
  - license.txt
206
207
  - mvnw
208
+ - mvnw.cmd
207
209
  - picrate.gemspec
208
210
  - pom.rb
209
211
  - pom.xml
@@ -227,6 +229,7 @@ files:
227
229
  - src/main/java/monkstone/slider/SliderGroup.java
228
230
  - src/main/java/monkstone/slider/WheelHandler.java
229
231
  - src/main/java/monkstone/vecmath/AppRender.java
232
+ - src/main/java/monkstone/vecmath/GfxRender.java
230
233
  - src/main/java/monkstone/vecmath/JRender.java
231
234
  - src/main/java/monkstone/vecmath/ShapeRender.java
232
235
  - src/main/java/monkstone/vecmath/package-info.java
@@ -352,7 +355,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
352
355
  version: '0'
353
356
  requirements:
354
357
  - java runtime >= 1.8.0_161+
355
- rubygems_version: 3.0.1
358
+ rubygems_version: 3.0.3
356
359
  signing_key:
357
360
  specification_version: 4
358
361
  summary: ruby wrapper for processing-3.5.3 on raspberrypi and linux64