picrate 1.3.0-java → 2.1.2-java
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.mvn/wrapper/MavenWrapperDownloader.java +1 -1
- data/CHANGELOG.md +10 -1
- data/Gemfile +3 -1
- data/README.md +9 -6
- data/Rakefile +8 -3
- data/bin/picrate +3 -1
- data/docs/_config.yml +1 -1
- data/docs/_editors/geany.md +1 -0
- data/docs/_gems/gems/gems.md +1 -1
- data/docs/_methods/alternative_methods.md +2 -1
- data/docs/_posts/2018-05-06-getting_started.md +4 -4
- data/docs/_posts/2018-05-06-install_jruby.md +5 -11
- data/docs/_posts/2018-05-11-arch-linux-arm.md +1 -11
- data/docs/_posts/2018-11-18-building-gem.md +2 -2
- data/docs/_posts/2018-11-27-getting_started_geany.md +1 -1
- data/docs/_posts/2019-11-11-getting_started_buster.md +3 -6
- data/docs/_posts/{2018-06-26-auto_install_picrate.md → 2020-03-09-auto_install_picrate.md} +9 -6
- data/docs/_posts/2020-05-11-getting_started_manjaro.md +106 -0
- data/docs/about.md +1 -1
- data/lib/picrate.rb +3 -2
- data/lib/picrate/app.rb +11 -3
- data/lib/picrate/creators/parameters.rb +8 -8
- data/lib/picrate/creators/sketch_factory.rb +5 -3
- data/lib/picrate/helper_methods.rb +22 -22
- data/lib/picrate/helpers/numeric.rb +2 -0
- data/lib/picrate/library.rb +5 -1
- data/lib/picrate/library_loader.rb +2 -0
- data/lib/picrate/native_folder.rb +2 -1
- data/lib/picrate/native_loader.rb +3 -0
- data/lib/picrate/runner.rb +5 -4
- data/lib/picrate/version.rb +1 -1
- data/library/boids/boids.rb +17 -8
- data/library/chooser/chooser.rb +10 -9
- data/library/color_group/color_group.rb +2 -0
- data/library/control_panel/control_panel.rb +7 -4
- data/library/dxf/dxf.rb +2 -0
- data/library/jcomplex/jcomplex.rb +1 -0
- data/library/library_proxy/library_proxy.rb +2 -0
- data/library/net/net.rb +2 -0
- data/library/slider/slider.rb +24 -23
- data/library/vector_utils/vector_utils.rb +4 -0
- data/library/video_event/video_event.rb +2 -0
- data/mvnw +2 -2
- data/mvnw.cmd +2 -2
- data/picrate.gemspec +13 -13
- data/pom.rb +26 -23
- data/pom.xml +19 -7
- data/src/main/java/monkstone/ColorUtil.java +1 -1
- data/src/main/java/monkstone/MathToolModule.java +1 -1
- data/src/main/java/monkstone/PicrateLibrary.java +8 -8
- data/src/main/java/monkstone/complex/JComplex.java +252 -0
- data/src/main/java/monkstone/fastmath/Deglut.java +16 -16
- data/src/main/java/monkstone/filechooser/Chooser.java +1 -1
- 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 +12 -12
- data/src/main/java/monkstone/slider/SimpleVerticalSlider.java +1 -1
- 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/slider/WheelHandler.java +1 -1
- data/src/main/java/monkstone/vecmath/package-info.java +1 -1
- data/src/main/java/monkstone/vecmath/vec2/Vec2.java +1 -1
- data/src/main/java/monkstone/vecmath/vec3/Vec3.java +1 -1
- data/src/main/java/monkstone/videoevent/CaptureEvent.java +1 -1
- data/src/main/java/monkstone/videoevent/MovieEvent.java +1 -1
- data/src/main/java/monkstone/videoevent/package-info.java +1 -1
- data/src/main/java/processing/awt/PGraphicsJava2D.java +33 -36
- data/src/main/java/processing/awt/PImageAWT.java +377 -0
- data/src/main/java/processing/awt/PSurfaceAWT.java +0 -20
- data/src/main/java/processing/awt/ShimAWT.java +545 -0
- data/src/main/java/processing/core/PApplet.java +699 -1523
- data/src/main/java/processing/core/PConstants.java +180 -180
- data/src/main/java/processing/core/PFont.java +2 -2
- data/src/main/java/processing/core/PGraphics.java +190 -176
- data/src/main/java/processing/core/PImage.java +1536 -1721
- data/src/main/java/processing/core/PMatrix.java +39 -39
- data/src/main/java/processing/core/PSurface.java +69 -103
- data/src/main/java/processing/core/PSurfaceNone.java +29 -0
- data/src/main/java/processing/core/PVector.java +2 -2
- data/src/main/java/processing/data/FloatDict.java +251 -284
- data/src/main/java/processing/data/TableRow.java +32 -32
- data/src/main/java/processing/dxf/RawDXF.java +3 -3
- data/src/main/java/processing/net/Client.java +1 -1
- data/src/main/java/processing/opengl/PGL.java +1016 -4132
- data/src/main/java/processing/opengl/PGraphicsOpenGL.java +232 -176
- data/src/main/java/processing/opengl/PJOGL.java +374 -1526
- data/src/main/java/processing/opengl/PShapeOpenGL.java +5 -6
- data/src/main/java/processing/opengl/PSurfaceJOGL.java +262 -147
- data/test/color_group_test.rb +4 -4
- data/test/deglut_spec_test.rb +2 -0
- data/test/helper_methods_test.rb +41 -13
- data/test/math_tool_test.rb +46 -37
- data/test/respond_to_test.rb +5 -3
- data/test/sketches/key_event.rb +2 -2
- data/test/sketches/library/my_library/my_library.rb +3 -0
- data/test/test_helper.rb +2 -0
- data/test/vecmath_spec_test.rb +30 -19
- data/vendors/Rakefile +33 -21
- data/vendors/{picrate_sketches.geany → geany.rb} +32 -7
- metadata +27 -46
- data/src/main/java/processing/opengl/shaders/LightVert-brcm.glsl +0 -154
- data/src/main/java/processing/opengl/shaders/LightVert-vc4.glsl +0 -154
- data/src/main/java/processing/opengl/shaders/TexLightVert-brcm.glsl +0 -160
- data/src/main/java/processing/opengl/shaders/TexLightVert-vc4.glsl +0 -160
|
@@ -47,13 +47,17 @@ public class PGraphicsOpenGL extends PGraphics {
|
|
|
47
47
|
/** Font cache for texture objects. */
|
|
48
48
|
protected WeakHashMap<PFont, FontTexture> fontMap;
|
|
49
49
|
|
|
50
|
+
// Blocking save
|
|
51
|
+
protected volatile Object saveBlocker;
|
|
52
|
+
private volatile Optional<String> saveTargetMaybe;
|
|
53
|
+
|
|
50
54
|
// ........................................................
|
|
51
55
|
|
|
52
56
|
// Disposal of native resources
|
|
53
57
|
// Using the technique alternative to finalization described in:
|
|
54
58
|
// http://www.oracle.com/technetwork/articles/java/finalization-137655.html
|
|
55
59
|
private static final ReferenceQueue<Object> refQueue = new ReferenceQueue<>();
|
|
56
|
-
private static final List<Disposable
|
|
60
|
+
private static final List<Disposable<?>> reachableWeakReferences =
|
|
57
61
|
new LinkedList<>();
|
|
58
62
|
|
|
59
63
|
static final private int MAX_DRAIN_GLRES_ITERATIONS = 10;
|
|
@@ -61,8 +65,8 @@ public class PGraphicsOpenGL extends PGraphics {
|
|
|
61
65
|
static void drainRefQueueBounded() {
|
|
62
66
|
int iterations = 0;
|
|
63
67
|
while (iterations < MAX_DRAIN_GLRES_ITERATIONS) {
|
|
64
|
-
Disposable
|
|
65
|
-
(Disposable
|
|
68
|
+
Disposable<?> res =
|
|
69
|
+
(Disposable<?>) refQueue.poll();
|
|
66
70
|
if (res == null) {
|
|
67
71
|
break;
|
|
68
72
|
}
|
|
@@ -568,6 +572,9 @@ public class PGraphicsOpenGL extends PGraphics {
|
|
|
568
572
|
public PGraphicsOpenGL() {
|
|
569
573
|
pgl = createPGL(this);
|
|
570
574
|
|
|
575
|
+
saveTargetMaybe = Optional.empty();
|
|
576
|
+
saveBlocker = new Object();
|
|
577
|
+
|
|
571
578
|
if (intBuffer == null) {
|
|
572
579
|
intBuffer = PGL.allocateIntBuffer(2);
|
|
573
580
|
floatBuffer = PGL.allocateFloatBuffer(2);
|
|
@@ -709,7 +716,7 @@ public class PGraphicsOpenGL extends PGraphics {
|
|
|
709
716
|
|
|
710
717
|
// Factory method
|
|
711
718
|
protected PGL createPGL(PGraphicsOpenGL pg) {
|
|
712
|
-
return new PJOGL(pg);
|
|
719
|
+
return new PJOGL(pg, () -> { onRender(); });
|
|
713
720
|
// return new PGLES(pg);
|
|
714
721
|
}
|
|
715
722
|
|
|
@@ -751,22 +758,35 @@ public class PGraphicsOpenGL extends PGraphics {
|
|
|
751
758
|
}
|
|
752
759
|
|
|
753
760
|
|
|
761
|
+
@Override
|
|
754
762
|
public boolean saveImpl(String filename) {
|
|
755
763
|
// return super.save(filename); // ASYNC save frame using PBOs not yet available on Android
|
|
756
764
|
|
|
757
765
|
if (getHint(DISABLE_ASYNC_SAVEFRAME)) {
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
boolean result = super.save(filename);
|
|
763
|
-
format = prevFormat;
|
|
764
|
-
return result;
|
|
766
|
+
saveTargetMaybe = Optional.of(filename);
|
|
767
|
+
|
|
768
|
+
if (!drawing) {
|
|
769
|
+
beginDraw();
|
|
765
770
|
}
|
|
771
|
+
flush();
|
|
772
|
+
updatePixelSize();
|
|
773
|
+
endDraw(); // Briefly stop drawing
|
|
766
774
|
|
|
767
|
-
|
|
775
|
+
synchronized(saveBlocker) {
|
|
776
|
+
try {
|
|
777
|
+
while (saveTargetMaybe.isPresent()) {
|
|
778
|
+
saveBlocker.wait();
|
|
779
|
+
}
|
|
780
|
+
beginDraw(); // Resume drawing
|
|
781
|
+
return true;
|
|
782
|
+
} catch (InterruptedException e) {
|
|
783
|
+
return false;
|
|
784
|
+
}
|
|
785
|
+
}
|
|
768
786
|
}
|
|
769
787
|
|
|
788
|
+
boolean needEndDraw = false;
|
|
789
|
+
|
|
770
790
|
if (asyncImageSaver == null) {
|
|
771
791
|
asyncImageSaver = new AsyncImageSaver();
|
|
772
792
|
}
|
|
@@ -780,7 +800,6 @@ public class PGraphicsOpenGL extends PGraphics {
|
|
|
780
800
|
}
|
|
781
801
|
|
|
782
802
|
if (asyncPixelReader != null && !loaded) {
|
|
783
|
-
boolean needEndDraw = false;
|
|
784
803
|
if (!drawing) {
|
|
785
804
|
beginDraw();
|
|
786
805
|
needEndDraw = true;
|
|
@@ -809,6 +828,21 @@ public class PGraphicsOpenGL extends PGraphics {
|
|
|
809
828
|
}
|
|
810
829
|
|
|
811
830
|
|
|
831
|
+
private void onRender() {
|
|
832
|
+
if (saveTargetMaybe.isEmpty()) {
|
|
833
|
+
return; // Nothing to save
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
PImage outputImage = pgl.screenshot();
|
|
837
|
+
outputImage.save(saveTargetMaybe.get());
|
|
838
|
+
saveTargetMaybe = Optional.empty();
|
|
839
|
+
|
|
840
|
+
synchronized(saveBlocker) {
|
|
841
|
+
saveBlocker.notify();
|
|
842
|
+
}
|
|
843
|
+
}
|
|
844
|
+
|
|
845
|
+
|
|
812
846
|
//////////////////////////////////////////////////////////////
|
|
813
847
|
|
|
814
848
|
// IMAGE METADATA FOR THIS RENDERER
|
|
@@ -919,7 +953,7 @@ public class PGraphicsOpenGL extends PGraphics {
|
|
|
919
953
|
int glId;
|
|
920
954
|
|
|
921
955
|
private PGL pgl;
|
|
922
|
-
private int context;
|
|
956
|
+
private final int context;
|
|
923
957
|
|
|
924
958
|
public GLResourceVertexBuffer(VertexBuffer vbo) {
|
|
925
959
|
super(vbo);
|
|
@@ -970,7 +1004,7 @@ public class PGraphicsOpenGL extends PGraphics {
|
|
|
970
1004
|
int glFragment;
|
|
971
1005
|
|
|
972
1006
|
private PGL pgl;
|
|
973
|
-
private int context;
|
|
1007
|
+
private final int context;
|
|
974
1008
|
|
|
975
1009
|
public GLResourceShader(PShader sh) {
|
|
976
1010
|
super(sh);
|
|
@@ -1190,7 +1224,7 @@ public class PGraphicsOpenGL extends PGraphics {
|
|
|
1190
1224
|
if (!polyBuffersCreated || polyBuffersContextIsOutdated()) {
|
|
1191
1225
|
polyBuffersContext = pgl.getCurrentContext();
|
|
1192
1226
|
|
|
1193
|
-
bufPolyVertex = new VertexBuffer(this, PGL.ARRAY_BUFFER,
|
|
1227
|
+
bufPolyVertex = new VertexBuffer(this, PGL.ARRAY_BUFFER, 4, PGL.SIZEOF_FLOAT);
|
|
1194
1228
|
bufPolyColor = new VertexBuffer(this, PGL.ARRAY_BUFFER, 1, PGL.SIZEOF_INT);
|
|
1195
1229
|
bufPolyNormal = new VertexBuffer(this, PGL.ARRAY_BUFFER, 3, PGL.SIZEOF_FLOAT);
|
|
1196
1230
|
bufPolyTexcoord = new VertexBuffer(this, PGL.ARRAY_BUFFER, 2, PGL.SIZEOF_FLOAT);
|
|
@@ -2390,8 +2424,8 @@ public class PGraphicsOpenGL extends PGraphics {
|
|
|
2390
2424
|
|
|
2391
2425
|
protected void flushPolys() {
|
|
2392
2426
|
boolean customShader = polyShader != null;
|
|
2393
|
-
boolean needNormals = customShader
|
|
2394
|
-
boolean needTexCoords = customShader
|
|
2427
|
+
boolean needNormals = customShader && polyShader.accessNormals();
|
|
2428
|
+
boolean needTexCoords = customShader && polyShader.accessTexCoords();
|
|
2395
2429
|
|
|
2396
2430
|
updatePolyBuffers(lights, texCache.hasTextures, needNormals, needTexCoords);
|
|
2397
2431
|
|
|
@@ -2464,8 +2498,8 @@ public class PGraphicsOpenGL extends PGraphics {
|
|
|
2464
2498
|
|
|
2465
2499
|
protected void flushSortedPolys() {
|
|
2466
2500
|
boolean customShader = polyShader != null;
|
|
2467
|
-
boolean needNormals = customShader
|
|
2468
|
-
boolean needTexCoords = customShader
|
|
2501
|
+
boolean needNormals = customShader && polyShader.accessNormals();
|
|
2502
|
+
boolean needTexCoords = customShader && polyShader.accessTexCoords();
|
|
2469
2503
|
|
|
2470
2504
|
sorter.sort(tessGeo);
|
|
2471
2505
|
|
|
@@ -3516,7 +3550,7 @@ public class PGraphicsOpenGL extends PGraphics {
|
|
|
3516
3550
|
|
|
3517
3551
|
|
|
3518
3552
|
@Override
|
|
3519
|
-
protected float textWidthImpl(char buffer
|
|
3553
|
+
protected float textWidthImpl(char[] buffer, int start, int stop) {
|
|
3520
3554
|
if (textFont == null) defaultFontOrDeath("textWidth");
|
|
3521
3555
|
Object font = textFont.getNative();
|
|
3522
3556
|
float twidth = 0;
|
|
@@ -3541,7 +3575,7 @@ public class PGraphicsOpenGL extends PGraphics {
|
|
|
3541
3575
|
* Implementation of actual drawing for a line of text.
|
|
3542
3576
|
*/
|
|
3543
3577
|
@Override
|
|
3544
|
-
protected void textLineImpl(char buffer
|
|
3578
|
+
protected void textLineImpl(char[] buffer, int start, int stop,
|
|
3545
3579
|
float x, float y) {
|
|
3546
3580
|
|
|
3547
3581
|
if (textMode == SHAPE && textFont.getNative() == null) {
|
|
@@ -3651,7 +3685,7 @@ public class PGraphicsOpenGL extends PGraphics {
|
|
|
3651
3685
|
* Ported from the implementation of textCharShapeImpl() in 1.5.1
|
|
3652
3686
|
*
|
|
3653
3687
|
* <EM>No attempt has been made to optimize this code</EM>
|
|
3654
|
-
*
|
|
3688
|
+
*
|
|
3655
3689
|
* TODO: Implement a FontShape class where each glyph is tessellated and
|
|
3656
3690
|
* stored inside a larger PShapeOpenGL object (which needs to be expanded as
|
|
3657
3691
|
* new glyphs are added and exceed the initial capacity in a similar way as
|
|
@@ -3659,18 +3693,18 @@ public class PGraphicsOpenGL extends PGraphics {
|
|
|
3659
3693
|
* in shape mode, then the correct sequences of vertex indices are computed
|
|
3660
3694
|
* (akin to the texcoords in the texture case) and used to draw only those
|
|
3661
3695
|
* parts of the PShape object that are required for the text.
|
|
3662
|
-
*
|
|
3696
|
+
*
|
|
3663
3697
|
*
|
|
3664
3698
|
* Some issues of the original implementation probably remain, so they are
|
|
3665
3699
|
* reproduced below:
|
|
3666
|
-
*
|
|
3700
|
+
*
|
|
3667
3701
|
* Also a problem where some fonts seem to be a bit slight, as if the
|
|
3668
3702
|
* control points aren't being mapped quite correctly. Probably doing
|
|
3669
3703
|
* something dumb that the control points don't map to P5's control
|
|
3670
3704
|
* points. Perhaps it's returning b-spline data from the TrueType font?
|
|
3671
3705
|
* Though it seems like that would make a lot of garbage rather than
|
|
3672
3706
|
* just a little flattening.
|
|
3673
|
-
*
|
|
3707
|
+
*
|
|
3674
3708
|
* There also seems to be a bug that is causing a line (but not a filled
|
|
3675
3709
|
* triangle) back to the origin on some letters (i.e. a capital L when
|
|
3676
3710
|
* tested with Akzidenz Grotesk Light). But this won't be visible
|
|
@@ -3685,7 +3719,7 @@ public class PGraphicsOpenGL extends PGraphics {
|
|
|
3685
3719
|
PGL.FontOutline outline = pgl.createFontOutline(ch, textFont.getNative());
|
|
3686
3720
|
|
|
3687
3721
|
// six element array received from the Java2D path iterator
|
|
3688
|
-
float
|
|
3722
|
+
float[] textPoints = new float[6];
|
|
3689
3723
|
float lastX = 0;
|
|
3690
3724
|
float lastY = 0;
|
|
3691
3725
|
|
|
@@ -3803,6 +3837,13 @@ public class PGraphicsOpenGL extends PGraphics {
|
|
|
3803
3837
|
}
|
|
3804
3838
|
|
|
3805
3839
|
|
|
3840
|
+
static protected void invTranslate(PMatrix2D matrix,
|
|
3841
|
+
float tx, float ty) {
|
|
3842
|
+
matrix.preApply(1, 0, -tx,
|
|
3843
|
+
0, 1, -ty);
|
|
3844
|
+
}
|
|
3845
|
+
|
|
3846
|
+
|
|
3806
3847
|
static protected float matrixScale(PMatrix matrix) {
|
|
3807
3848
|
// Volumetric scaling factor that is associated to the given
|
|
3808
3849
|
// transformation matrix, which is given by the absolute value of its
|
|
@@ -3888,8 +3929,8 @@ public class PGraphicsOpenGL extends PGraphics {
|
|
|
3888
3929
|
}
|
|
3889
3930
|
|
|
3890
3931
|
|
|
3891
|
-
static
|
|
3892
|
-
|
|
3932
|
+
static protected void invRotate(PMatrix3D matrix, float angle,
|
|
3933
|
+
float v0, float v1, float v2) {
|
|
3893
3934
|
float c = PApplet.cos(-angle);
|
|
3894
3935
|
float s = PApplet.sin(-angle);
|
|
3895
3936
|
float t = 1.0f - c;
|
|
@@ -3901,6 +3942,11 @@ public class PGraphicsOpenGL extends PGraphics {
|
|
|
3901
3942
|
}
|
|
3902
3943
|
|
|
3903
3944
|
|
|
3945
|
+
static protected void invRotate(PMatrix2D matrix, float angle) {
|
|
3946
|
+
matrix.rotate(-angle);
|
|
3947
|
+
}
|
|
3948
|
+
|
|
3949
|
+
|
|
3904
3950
|
/**
|
|
3905
3951
|
* Same as scale(s, s, s).
|
|
3906
3952
|
*/
|
|
@@ -3942,6 +3988,11 @@ public class PGraphicsOpenGL extends PGraphics {
|
|
|
3942
3988
|
}
|
|
3943
3989
|
|
|
3944
3990
|
|
|
3991
|
+
static protected void invScale(PMatrix2D matrix, float x, float y) {
|
|
3992
|
+
matrix.preApply(1/x, 0, 0, 1/y, 0, 0);
|
|
3993
|
+
}
|
|
3994
|
+
|
|
3995
|
+
|
|
3945
3996
|
@Override
|
|
3946
3997
|
public void shearX(float angle) {
|
|
3947
3998
|
float t = (float) Math.tan(angle);
|
|
@@ -4580,6 +4631,8 @@ public class PGraphicsOpenGL extends PGraphics {
|
|
|
4580
4631
|
* against) the current perspective matrix.
|
|
4581
4632
|
* <P>
|
|
4582
4633
|
* Implementation based on the explanation in the OpenGL blue book.
|
|
4634
|
+
* @param znear
|
|
4635
|
+
* @param zfar
|
|
4583
4636
|
*/
|
|
4584
4637
|
@Override
|
|
4585
4638
|
public void frustum(float left, float right, float bottom, float top,
|
|
@@ -5352,9 +5405,9 @@ public class PGraphicsOpenGL extends PGraphics {
|
|
|
5352
5405
|
// showWarning() and showException() available from PGraphics.
|
|
5353
5406
|
|
|
5354
5407
|
/**
|
|
5355
|
-
* Report on anything from glError().
|
|
5356
|
-
* otherwise it'll
|
|
5357
|
-
*
|
|
5408
|
+
* Report on anything from glError().
|
|
5409
|
+
* Don't use this inside glBegin/glEnd otherwise it'll
|
|
5410
|
+
* throw an GL_INVALID_OPERATION error.
|
|
5358
5411
|
*/
|
|
5359
5412
|
protected void report(String where) {
|
|
5360
5413
|
if (!hints[DISABLE_OPENGL_ERRORS]) {
|
|
@@ -6366,11 +6419,10 @@ public class PGraphicsOpenGL extends PGraphics {
|
|
|
6366
6419
|
|
|
6367
6420
|
|
|
6368
6421
|
/**
|
|
6369
|
-
* Not an approved function, this will change or be removed in the future.
|
|
6370
|
-
* utility method returns the texture associated to the renderer's.
|
|
6371
|
-
* surface, making sure is updated to reflect the current contents
|
|
6372
|
-
* screen (or offscreen drawing surface).
|
|
6373
|
-
* @return
|
|
6422
|
+
* Not an approved function, this will change or be removed in the future.
|
|
6423
|
+
* This utility method returns the texture associated to the renderer's.
|
|
6424
|
+
* drawing surface, making sure is updated to reflect the current contents
|
|
6425
|
+
* off the screen (or offscreen drawing surface).
|
|
6374
6426
|
*/
|
|
6375
6427
|
public Texture getTexture() {
|
|
6376
6428
|
return getTexture(true);
|
|
@@ -6379,8 +6431,6 @@ public class PGraphicsOpenGL extends PGraphics {
|
|
|
6379
6431
|
|
|
6380
6432
|
/**
|
|
6381
6433
|
* Not an approved function either, don't use it.
|
|
6382
|
-
* @param load
|
|
6383
|
-
* @return
|
|
6384
6434
|
*/
|
|
6385
6435
|
public Texture getTexture(boolean load) {
|
|
6386
6436
|
if (load) loadTexture();
|
|
@@ -6389,11 +6439,11 @@ public class PGraphicsOpenGL extends PGraphics {
|
|
|
6389
6439
|
|
|
6390
6440
|
|
|
6391
6441
|
/**
|
|
6392
|
-
* Not an approved function, this will change or be removed in the future.
|
|
6442
|
+
* Not an approved function, this will change or be removed in the future.
|
|
6443
|
+
* This utility method returns the texture associated to the image.
|
|
6393
6444
|
* creating and/or updating it if needed.
|
|
6394
6445
|
*
|
|
6395
6446
|
* @param img the image to have a texture metadata associated to it
|
|
6396
|
-
* @return
|
|
6397
6447
|
*/
|
|
6398
6448
|
public Texture getTexture(PImage img) {
|
|
6399
6449
|
Texture tex = (Texture)initCache(img);
|
|
@@ -6419,7 +6469,6 @@ public class PGraphicsOpenGL extends PGraphics {
|
|
|
6419
6469
|
/**
|
|
6420
6470
|
* Not an approved function, test its use in libraries to grab the FB objects
|
|
6421
6471
|
* for offscreen PGraphics.
|
|
6422
|
-
* @return
|
|
6423
6472
|
*/
|
|
6424
6473
|
public FrameBuffer getFrameBuffer() {
|
|
6425
6474
|
return getFrameBuffer(false);
|
|
@@ -6444,9 +6493,16 @@ public class PGraphicsOpenGL extends PGraphics {
|
|
|
6444
6493
|
if (tex == null || tex.contextIsOutdated()) {
|
|
6445
6494
|
tex = addTexture(img);
|
|
6446
6495
|
if (tex != null) {
|
|
6496
|
+
boolean dispose = img.pixels == null;
|
|
6447
6497
|
img.loadPixels();
|
|
6448
6498
|
tex.set(img.pixels, img.format);
|
|
6449
6499
|
img.setModified();
|
|
6500
|
+
if (dispose) {
|
|
6501
|
+
// We only used the pixels to load the image into the texture and the user did not request
|
|
6502
|
+
// to load the pixels, so we should dispose the pixels array to avoid wasting memory
|
|
6503
|
+
img.pixels = null;
|
|
6504
|
+
img.loaded = false;
|
|
6505
|
+
}
|
|
6450
6506
|
}
|
|
6451
6507
|
}
|
|
6452
6508
|
return tex;
|
|
@@ -6478,7 +6534,6 @@ public class PGraphicsOpenGL extends PGraphics {
|
|
|
6478
6534
|
* This utility method creates a texture for the provided image, and adds it
|
|
6479
6535
|
* to the metadata cache of the image.
|
|
6480
6536
|
* @param img the image to have a texture metadata associated to it
|
|
6481
|
-
* @return
|
|
6482
6537
|
*/
|
|
6483
6538
|
protected Texture addTexture(PImage img) {
|
|
6484
6539
|
Texture.Parameters params =
|
|
@@ -6830,6 +6885,9 @@ public class PGraphicsOpenGL extends PGraphics {
|
|
|
6830
6885
|
} else {
|
|
6831
6886
|
// offscreen surfaces are transparent by default.
|
|
6832
6887
|
background((backgroundColor & 0xFFFFFF));
|
|
6888
|
+
|
|
6889
|
+
// Recreate offscreen FBOs
|
|
6890
|
+
restartPGL();
|
|
6833
6891
|
}
|
|
6834
6892
|
|
|
6835
6893
|
// Sets the default projection and camera (initializes modelview).
|
|
@@ -6892,6 +6950,7 @@ public class PGraphicsOpenGL extends PGraphics {
|
|
|
6892
6950
|
OPENGL_VERSION = pgl.getString(PGL.VERSION);
|
|
6893
6951
|
OPENGL_EXTENSIONS = pgl.getString(PGL.EXTENSIONS);
|
|
6894
6952
|
GLSL_VERSION = pgl.getString(PGL.SHADING_LANGUAGE_VERSION);
|
|
6953
|
+
|
|
6895
6954
|
npotTexSupported = pgl.hasNpotTexSupport();
|
|
6896
6955
|
autoMipmapGenSupported = pgl.hasAutoMipmapGenSupport();
|
|
6897
6956
|
fboMultisampleSupported = pgl.hasFboMultisampleSupport();
|
|
@@ -6899,28 +6958,31 @@ public class PGraphicsOpenGL extends PGraphics {
|
|
|
6899
6958
|
anisoSamplingSupported = pgl.hasAnisoSamplingSupport();
|
|
6900
6959
|
readBufferSupported = pgl.hasReadBuffer();
|
|
6901
6960
|
drawBufferSupported = pgl.hasDrawBuffer();
|
|
6961
|
+
|
|
6902
6962
|
try {
|
|
6903
6963
|
pgl.blendEquation(PGL.FUNC_ADD);
|
|
6904
6964
|
blendEqSupported = true;
|
|
6905
6965
|
} catch (Exception e) {
|
|
6906
6966
|
blendEqSupported = false;
|
|
6907
6967
|
}
|
|
6968
|
+
|
|
6908
6969
|
depthBits = pgl.getDepthBits();
|
|
6909
6970
|
stencilBits = pgl.getStencilBits();
|
|
6971
|
+
|
|
6910
6972
|
pgl.getIntegerv(PGL.MAX_TEXTURE_SIZE, intBuffer);
|
|
6911
6973
|
maxTextureSize = intBuffer.get(0);
|
|
6974
|
+
|
|
6975
|
+
// work around runtime exceptions in Broadcom's VC IV driver
|
|
6976
|
+
// if (false == OPENGL_RENDERER.equals("VideoCore IV HW")) {
|
|
6912
6977
|
pgl.getIntegerv(PGL.MAX_SAMPLES, intBuffer);
|
|
6913
6978
|
maxSamples = intBuffer.get(0);
|
|
6979
|
+
// }
|
|
6980
|
+
|
|
6914
6981
|
if (anisoSamplingSupported) {
|
|
6915
6982
|
pgl.getFloatv(PGL.MAX_TEXTURE_MAX_ANISOTROPY, floatBuffer);
|
|
6916
6983
|
maxAnisoAmount = floatBuffer.get(0);
|
|
6917
6984
|
}
|
|
6918
|
-
|
|
6919
|
-
if (OPENGL_RENDERER.equals("VideoCore IV HW")) {
|
|
6920
|
-
pgl.dispose();
|
|
6921
|
-
System.out.println("Use FakeKMS or FullKMS video driver for P2D and P3D sketches");
|
|
6922
|
-
super.dispose();
|
|
6923
|
-
}
|
|
6985
|
+
|
|
6924
6986
|
glParamsRead = true;
|
|
6925
6987
|
}
|
|
6926
6988
|
|
|
@@ -7925,61 +7987,61 @@ public class PGraphicsOpenGL extends PGraphics {
|
|
|
7925
7987
|
// Expand arrays
|
|
7926
7988
|
|
|
7927
7989
|
void expandVertices(int n) {
|
|
7928
|
-
float
|
|
7990
|
+
float[] temp = new float[3 * n];
|
|
7929
7991
|
PApplet.arrayCopy(vertices, 0, temp, 0, 3 * vertexCount);
|
|
7930
7992
|
vertices = temp;
|
|
7931
7993
|
}
|
|
7932
7994
|
|
|
7933
7995
|
void expandColors(int n) {
|
|
7934
|
-
int
|
|
7996
|
+
int[] temp = new int[n];
|
|
7935
7997
|
PApplet.arrayCopy(colors, 0, temp, 0, vertexCount);
|
|
7936
7998
|
colors = temp;
|
|
7937
7999
|
}
|
|
7938
8000
|
|
|
7939
8001
|
void expandNormals(int n) {
|
|
7940
|
-
float
|
|
8002
|
+
float[] temp = new float[3 * n];
|
|
7941
8003
|
PApplet.arrayCopy(normals, 0, temp, 0, 3 * vertexCount);
|
|
7942
8004
|
normals = temp;
|
|
7943
8005
|
}
|
|
7944
8006
|
|
|
7945
8007
|
void expandTexCoords(int n) {
|
|
7946
|
-
float
|
|
8008
|
+
float[] temp = new float[2 * n];
|
|
7947
8009
|
PApplet.arrayCopy(texcoords, 0, temp, 0, 2 * vertexCount);
|
|
7948
8010
|
texcoords = temp;
|
|
7949
8011
|
}
|
|
7950
8012
|
|
|
7951
8013
|
void expandStrokeColors(int n) {
|
|
7952
|
-
int
|
|
8014
|
+
int[] temp = new int[n];
|
|
7953
8015
|
PApplet.arrayCopy(strokeColors, 0, temp, 0, vertexCount);
|
|
7954
8016
|
strokeColors = temp;
|
|
7955
8017
|
}
|
|
7956
8018
|
|
|
7957
8019
|
void expandStrokeWeights(int n) {
|
|
7958
|
-
float
|
|
8020
|
+
float[] temp = new float[n];
|
|
7959
8021
|
PApplet.arrayCopy(strokeWeights, 0, temp, 0, vertexCount);
|
|
7960
8022
|
strokeWeights = temp;
|
|
7961
8023
|
}
|
|
7962
8024
|
|
|
7963
8025
|
void expandAmbient(int n) {
|
|
7964
|
-
int
|
|
8026
|
+
int[] temp = new int[n];
|
|
7965
8027
|
PApplet.arrayCopy(ambient, 0, temp, 0, vertexCount);
|
|
7966
8028
|
ambient = temp;
|
|
7967
8029
|
}
|
|
7968
8030
|
|
|
7969
8031
|
void expandSpecular(int n) {
|
|
7970
|
-
int
|
|
8032
|
+
int[] temp = new int[n];
|
|
7971
8033
|
PApplet.arrayCopy(specular, 0, temp, 0, vertexCount);
|
|
7972
8034
|
specular = temp;
|
|
7973
8035
|
}
|
|
7974
8036
|
|
|
7975
8037
|
void expandEmissive(int n) {
|
|
7976
|
-
int
|
|
8038
|
+
int[] temp = new int[n];
|
|
7977
8039
|
PApplet.arrayCopy(emissive, 0, temp, 0, vertexCount);
|
|
7978
8040
|
emissive = temp;
|
|
7979
8041
|
}
|
|
7980
8042
|
|
|
7981
8043
|
void expandShininess(int n) {
|
|
7982
|
-
float
|
|
8044
|
+
float[] temp = new float[n];
|
|
7983
8045
|
PApplet.arrayCopy(shininess, 0, temp, 0, vertexCount);
|
|
7984
8046
|
shininess = temp;
|
|
7985
8047
|
}
|
|
@@ -7998,33 +8060,33 @@ public class PGraphicsOpenGL extends PGraphics {
|
|
|
7998
8060
|
|
|
7999
8061
|
void expandFloatAttrib(VertexAttribute attrib, int n) {
|
|
8000
8062
|
float[] values = fattribs.get(attrib.name);
|
|
8001
|
-
float
|
|
8063
|
+
float[] temp = new float[attrib.size * n];
|
|
8002
8064
|
PApplet.arrayCopy(values, 0, temp, 0, attrib.size * vertexCount);
|
|
8003
8065
|
fattribs.put(attrib.name, temp);
|
|
8004
8066
|
}
|
|
8005
8067
|
|
|
8006
8068
|
void expandIntAttrib(VertexAttribute attrib, int n) {
|
|
8007
8069
|
int[] values = iattribs.get(attrib.name);
|
|
8008
|
-
int
|
|
8070
|
+
int[] temp = new int[attrib.size * n];
|
|
8009
8071
|
PApplet.arrayCopy(values, 0, temp, 0, attrib.size * vertexCount);
|
|
8010
8072
|
iattribs.put(attrib.name, temp);
|
|
8011
8073
|
}
|
|
8012
8074
|
|
|
8013
8075
|
void expandBoolAttrib(VertexAttribute attrib, int n) {
|
|
8014
8076
|
byte[] values = battribs.get(attrib.name);
|
|
8015
|
-
byte
|
|
8077
|
+
byte[] temp = new byte[attrib.size * n];
|
|
8016
8078
|
PApplet.arrayCopy(values, 0, temp, 0, attrib.size * vertexCount);
|
|
8017
8079
|
battribs.put(attrib.name, temp);
|
|
8018
8080
|
}
|
|
8019
8081
|
|
|
8020
8082
|
void expandCodes(int n) {
|
|
8021
|
-
int
|
|
8083
|
+
int[] temp = new int[n];
|
|
8022
8084
|
PApplet.arrayCopy(codes, 0, temp, 0, codeCount);
|
|
8023
8085
|
codes = temp;
|
|
8024
8086
|
}
|
|
8025
8087
|
|
|
8026
8088
|
void expandEdges(int n) {
|
|
8027
|
-
int
|
|
8089
|
+
int[][] temp = new int[n][3];
|
|
8028
8090
|
PApplet.arrayCopy(edges, 0, temp, 0, edgeCount);
|
|
8029
8091
|
edges = temp;
|
|
8030
8092
|
}
|
|
@@ -8058,73 +8120,73 @@ public class PGraphicsOpenGL extends PGraphics {
|
|
|
8058
8120
|
}
|
|
8059
8121
|
|
|
8060
8122
|
void trimVertices() {
|
|
8061
|
-
float
|
|
8123
|
+
float[] temp = new float[3 * vertexCount];
|
|
8062
8124
|
PApplet.arrayCopy(vertices, 0, temp, 0, 3 * vertexCount);
|
|
8063
8125
|
vertices = temp;
|
|
8064
8126
|
}
|
|
8065
8127
|
|
|
8066
8128
|
void trimColors() {
|
|
8067
|
-
int
|
|
8129
|
+
int[] temp = new int[vertexCount];
|
|
8068
8130
|
PApplet.arrayCopy(colors, 0, temp, 0, vertexCount);
|
|
8069
8131
|
colors = temp;
|
|
8070
8132
|
}
|
|
8071
8133
|
|
|
8072
8134
|
void trimNormals() {
|
|
8073
|
-
float
|
|
8135
|
+
float[] temp = new float[3 * vertexCount];
|
|
8074
8136
|
PApplet.arrayCopy(normals, 0, temp, 0, 3 * vertexCount);
|
|
8075
8137
|
normals = temp;
|
|
8076
8138
|
}
|
|
8077
8139
|
|
|
8078
8140
|
void trimTexCoords() {
|
|
8079
|
-
float
|
|
8141
|
+
float[] temp = new float[2 * vertexCount];
|
|
8080
8142
|
PApplet.arrayCopy(texcoords, 0, temp, 0, 2 * vertexCount);
|
|
8081
8143
|
texcoords = temp;
|
|
8082
8144
|
}
|
|
8083
8145
|
|
|
8084
8146
|
void trimStrokeColors() {
|
|
8085
|
-
int
|
|
8147
|
+
int[] temp = new int[vertexCount];
|
|
8086
8148
|
PApplet.arrayCopy(strokeColors, 0, temp, 0, vertexCount);
|
|
8087
8149
|
strokeColors = temp;
|
|
8088
8150
|
}
|
|
8089
8151
|
|
|
8090
8152
|
void trimStrokeWeights() {
|
|
8091
|
-
float
|
|
8153
|
+
float[] temp = new float[vertexCount];
|
|
8092
8154
|
PApplet.arrayCopy(strokeWeights, 0, temp, 0, vertexCount);
|
|
8093
8155
|
strokeWeights = temp;
|
|
8094
8156
|
}
|
|
8095
8157
|
|
|
8096
8158
|
void trimAmbient() {
|
|
8097
|
-
int
|
|
8159
|
+
int[] temp = new int[vertexCount];
|
|
8098
8160
|
PApplet.arrayCopy(ambient, 0, temp, 0, vertexCount);
|
|
8099
8161
|
ambient = temp;
|
|
8100
8162
|
}
|
|
8101
8163
|
|
|
8102
8164
|
void trimSpecular() {
|
|
8103
|
-
int
|
|
8165
|
+
int[] temp = new int[vertexCount];
|
|
8104
8166
|
PApplet.arrayCopy(specular, 0, temp, 0, vertexCount);
|
|
8105
8167
|
specular = temp;
|
|
8106
8168
|
}
|
|
8107
8169
|
|
|
8108
8170
|
void trimEmissive() {
|
|
8109
|
-
int
|
|
8171
|
+
int[] temp = new int[vertexCount];
|
|
8110
8172
|
PApplet.arrayCopy(emissive, 0, temp, 0, vertexCount);
|
|
8111
8173
|
emissive = temp;
|
|
8112
8174
|
}
|
|
8113
8175
|
|
|
8114
8176
|
void trimShininess() {
|
|
8115
|
-
float
|
|
8177
|
+
float[] temp = new float[vertexCount];
|
|
8116
8178
|
PApplet.arrayCopy(shininess, 0, temp, 0, vertexCount);
|
|
8117
8179
|
shininess = temp;
|
|
8118
8180
|
}
|
|
8119
8181
|
|
|
8120
8182
|
void trimCodes() {
|
|
8121
|
-
int
|
|
8183
|
+
int[] temp = new int[codeCount];
|
|
8122
8184
|
PApplet.arrayCopy(codes, 0, temp, 0, codeCount);
|
|
8123
8185
|
codes = temp;
|
|
8124
8186
|
}
|
|
8125
8187
|
|
|
8126
8188
|
void trimEdges() {
|
|
8127
|
-
int
|
|
8189
|
+
int[][] temp = new int[edgeCount][3];
|
|
8128
8190
|
PApplet.arrayCopy(edges, 0, temp, 0, edgeCount);
|
|
8129
8191
|
edges = temp;
|
|
8130
8192
|
}
|
|
@@ -8143,21 +8205,21 @@ public class PGraphicsOpenGL extends PGraphics {
|
|
|
8143
8205
|
|
|
8144
8206
|
void trimFloatAttrib(VertexAttribute attrib) {
|
|
8145
8207
|
float[] values = fattribs.get(attrib.name);
|
|
8146
|
-
float
|
|
8208
|
+
float[] temp = new float[attrib.size * vertexCount];
|
|
8147
8209
|
PApplet.arrayCopy(values, 0, temp, 0, attrib.size * vertexCount);
|
|
8148
8210
|
fattribs.put(attrib.name, temp);
|
|
8149
8211
|
}
|
|
8150
8212
|
|
|
8151
8213
|
void trimIntAttrib(VertexAttribute attrib) {
|
|
8152
8214
|
int[] values = iattribs.get(attrib.name);
|
|
8153
|
-
int
|
|
8215
|
+
int[] temp = new int[attrib.size * vertexCount];
|
|
8154
8216
|
PApplet.arrayCopy(values, 0, temp, 0, attrib.size * vertexCount);
|
|
8155
8217
|
iattribs.put(attrib.name, temp);
|
|
8156
8218
|
}
|
|
8157
8219
|
|
|
8158
8220
|
void trimBoolAttrib(VertexAttribute attrib) {
|
|
8159
8221
|
byte[] values = battribs.get(attrib.name);
|
|
8160
|
-
byte
|
|
8222
|
+
byte[] temp = new byte[attrib.size * vertexCount];
|
|
8161
8223
|
PApplet.arrayCopy(values, 0, temp, 0, attrib.size * vertexCount);
|
|
8162
8224
|
battribs.put(attrib.name, temp);
|
|
8163
8225
|
}
|
|
@@ -8376,7 +8438,7 @@ public class PGraphicsOpenGL extends PGraphics {
|
|
|
8376
8438
|
|
|
8377
8439
|
vert[SR] = ((strokeColors[i] >> 16) & 0xFF) / 255.0f;
|
|
8378
8440
|
vert[SG] = ((strokeColors[i] >> 8) & 0xFF) / 255.0f;
|
|
8379
|
-
vert[SB] = ((strokeColors[i]) & 0xFF) / 255.0f;
|
|
8441
|
+
vert[SB] = ((strokeColors[i] >> 0) & 0xFF) / 255.0f;
|
|
8380
8442
|
vert[SA] = ((strokeColors[i] >> 24) & 0xFF) / 255.0f;
|
|
8381
8443
|
|
|
8382
8444
|
vert[SW] = strokeWeights[i];
|
|
@@ -8779,8 +8841,8 @@ public class PGraphicsOpenGL extends PGraphics {
|
|
|
8779
8841
|
idx0 = pidx = idx = 0;
|
|
8780
8842
|
float val = 0;
|
|
8781
8843
|
for (int i = 0; i < accuracy; i++) {
|
|
8782
|
-
idx = addVertex(centerX +
|
|
8783
|
-
centerY +
|
|
8844
|
+
idx = addVertex(centerX + cosLUT[(int) val] * radiusH,
|
|
8845
|
+
centerY + sinLUT[(int) val] * radiusV,
|
|
8784
8846
|
VERTEX, i == 0 && !fill);
|
|
8785
8847
|
val = (val + inc) % SINCOS_LENGTH;
|
|
8786
8848
|
|
|
@@ -8793,8 +8855,8 @@ public class PGraphicsOpenGL extends PGraphics {
|
|
|
8793
8855
|
pidx = idx;
|
|
8794
8856
|
}
|
|
8795
8857
|
// Back to the beginning
|
|
8796
|
-
addVertex(centerX +
|
|
8797
|
-
centerY +
|
|
8858
|
+
addVertex(centerX + cosLUT[0] * radiusH,
|
|
8859
|
+
centerY + sinLUT[0] * radiusV,
|
|
8798
8860
|
VERTEX, false);
|
|
8799
8861
|
if (stroke) {
|
|
8800
8862
|
addEdge(idx, idx0, false, false);
|
|
@@ -8839,8 +8901,8 @@ public class PGraphicsOpenGL extends PGraphics {
|
|
|
8839
8901
|
if (arcMode == CHORD || arcMode == OPEN) {
|
|
8840
8902
|
// move center to the middle of flat side
|
|
8841
8903
|
// to properly display arcs smaller than PI
|
|
8842
|
-
float relX = (
|
|
8843
|
-
float relY = (
|
|
8904
|
+
float relX = (cosLUT[startLUT] + cosLUT[stopLUT]) * 0.5f * hr;
|
|
8905
|
+
float relY = (sinLUT[startLUT] + sinLUT[stopLUT]) * 0.5f * vr;
|
|
8844
8906
|
idx0 = addVertex(centerX + relX, centerY + relY, VERTEX, true);
|
|
8845
8907
|
} else {
|
|
8846
8908
|
idx0 = addVertex(centerX, centerY, VERTEX, true);
|
|
@@ -8877,8 +8939,8 @@ public class PGraphicsOpenGL extends PGraphics {
|
|
|
8877
8939
|
if (ii >= SINCOS_LENGTH) ii -= SINCOS_LENGTH;
|
|
8878
8940
|
|
|
8879
8941
|
pidx = idx;
|
|
8880
|
-
idx = addVertex(centerX +
|
|
8881
|
-
centerY +
|
|
8942
|
+
idx = addVertex(centerX + cosLUT[ii] * hr,
|
|
8943
|
+
centerY + sinLUT[ii] * vr,
|
|
8882
8944
|
VERTEX, i == 0 && !fill);
|
|
8883
8945
|
|
|
8884
8946
|
if (stroke) {
|
|
@@ -9232,7 +9294,7 @@ public class PGraphicsOpenGL extends PGraphics {
|
|
|
9232
9294
|
//
|
|
9233
9295
|
// Allocate/dispose
|
|
9234
9296
|
|
|
9235
|
-
|
|
9297
|
+
void allocate() {
|
|
9236
9298
|
polyVertices = new float[4 * PGL.DEFAULT_TESS_VERTICES];
|
|
9237
9299
|
polyColors = new int[PGL.DEFAULT_TESS_VERTICES];
|
|
9238
9300
|
polyNormals = new float[3 * PGL.DEFAULT_TESS_VERTICES];
|
|
@@ -9699,56 +9761,56 @@ public class PGraphicsOpenGL extends PGraphics {
|
|
|
9699
9761
|
// Expand arrays
|
|
9700
9762
|
|
|
9701
9763
|
void expandPolyVertices(int n) {
|
|
9702
|
-
float
|
|
9764
|
+
float[] temp = new float[4 * n];
|
|
9703
9765
|
PApplet.arrayCopy(polyVertices, 0, temp, 0, 4 * polyVertexCount);
|
|
9704
9766
|
polyVertices = temp;
|
|
9705
9767
|
polyVerticesBuffer = PGL.allocateFloatBuffer(polyVertices);
|
|
9706
9768
|
}
|
|
9707
9769
|
|
|
9708
9770
|
void expandPolyColors(int n) {
|
|
9709
|
-
int
|
|
9771
|
+
int[] temp = new int[n];
|
|
9710
9772
|
PApplet.arrayCopy(polyColors, 0, temp, 0, polyVertexCount);
|
|
9711
9773
|
polyColors = temp;
|
|
9712
9774
|
polyColorsBuffer = PGL.allocateIntBuffer(polyColors);
|
|
9713
9775
|
}
|
|
9714
9776
|
|
|
9715
9777
|
void expandPolyNormals(int n) {
|
|
9716
|
-
float
|
|
9778
|
+
float[] temp = new float[3 * n];
|
|
9717
9779
|
PApplet.arrayCopy(polyNormals, 0, temp, 0, 3 * polyVertexCount);
|
|
9718
9780
|
polyNormals = temp;
|
|
9719
9781
|
polyNormalsBuffer = PGL.allocateFloatBuffer(polyNormals);
|
|
9720
9782
|
}
|
|
9721
9783
|
|
|
9722
9784
|
void expandPolyTexCoords(int n) {
|
|
9723
|
-
float
|
|
9785
|
+
float[] temp = new float[2 * n];
|
|
9724
9786
|
PApplet.arrayCopy(polyTexCoords, 0, temp, 0, 2 * polyVertexCount);
|
|
9725
9787
|
polyTexCoords = temp;
|
|
9726
9788
|
polyTexCoordsBuffer = PGL.allocateFloatBuffer(polyTexCoords);
|
|
9727
9789
|
}
|
|
9728
9790
|
|
|
9729
9791
|
void expandPolyAmbient(int n) {
|
|
9730
|
-
int
|
|
9792
|
+
int[] temp = new int[n];
|
|
9731
9793
|
PApplet.arrayCopy(polyAmbient, 0, temp, 0, polyVertexCount);
|
|
9732
9794
|
polyAmbient = temp;
|
|
9733
9795
|
polyAmbientBuffer = PGL.allocateIntBuffer(polyAmbient);
|
|
9734
9796
|
}
|
|
9735
9797
|
|
|
9736
9798
|
void expandPolySpecular(int n) {
|
|
9737
|
-
int
|
|
9799
|
+
int[] temp = new int[n];
|
|
9738
9800
|
PApplet.arrayCopy(polySpecular, 0, temp, 0, polyVertexCount);
|
|
9739
9801
|
polySpecular = temp;
|
|
9740
9802
|
polySpecularBuffer = PGL.allocateIntBuffer(polySpecular);
|
|
9741
9803
|
}
|
|
9742
9804
|
|
|
9743
9805
|
void expandPolyEmissive(int n) {
|
|
9744
|
-
int
|
|
9806
|
+
int[] temp = new int[n];
|
|
9745
9807
|
PApplet.arrayCopy(polyEmissive, 0, temp, 0, polyVertexCount);
|
|
9746
9808
|
polyEmissive = temp;
|
|
9747
9809
|
polyEmissiveBuffer = PGL.allocateIntBuffer(polyEmissive);
|
|
9748
9810
|
}
|
|
9749
9811
|
|
|
9750
9812
|
void expandPolyShininess(int n) {
|
|
9751
|
-
float
|
|
9813
|
+
float[] temp = new float[n];
|
|
9752
9814
|
PApplet.arrayCopy(polyShininess, 0, temp, 0, polyVertexCount);
|
|
9753
9815
|
polyShininess = temp;
|
|
9754
9816
|
polyShininessBuffer = PGL.allocateFloatBuffer(polyShininess);
|
|
@@ -9768,7 +9830,7 @@ public class PGraphicsOpenGL extends PGraphics {
|
|
|
9768
9830
|
|
|
9769
9831
|
void expandFloatAttribute(VertexAttribute attrib, int n) {
|
|
9770
9832
|
float[] array = fpolyAttribs.get(attrib.name);
|
|
9771
|
-
float
|
|
9833
|
+
float[] temp = new float[attrib.tessSize * n];
|
|
9772
9834
|
PApplet.arrayCopy(array, 0, temp, 0, attrib.tessSize * polyVertexCount);
|
|
9773
9835
|
fpolyAttribs.put(attrib.name, temp);
|
|
9774
9836
|
polyAttribBuffers.put(attrib.name, PGL.allocateFloatBuffer(temp));
|
|
@@ -9776,7 +9838,7 @@ public class PGraphicsOpenGL extends PGraphics {
|
|
|
9776
9838
|
|
|
9777
9839
|
void expandIntAttribute(VertexAttribute attrib, int n) {
|
|
9778
9840
|
int[] array = ipolyAttribs.get(attrib.name);
|
|
9779
|
-
int
|
|
9841
|
+
int[] temp = new int[attrib.tessSize * n];
|
|
9780
9842
|
PApplet.arrayCopy(array, 0, temp, 0, attrib.tessSize * polyVertexCount);
|
|
9781
9843
|
ipolyAttribs.put(attrib.name, temp);
|
|
9782
9844
|
polyAttribBuffers.put(attrib.name, PGL.allocateIntBuffer(temp));
|
|
@@ -9784,70 +9846,70 @@ public class PGraphicsOpenGL extends PGraphics {
|
|
|
9784
9846
|
|
|
9785
9847
|
void expandBoolAttribute(VertexAttribute attrib, int n) {
|
|
9786
9848
|
byte[] array = bpolyAttribs.get(attrib.name);
|
|
9787
|
-
byte
|
|
9849
|
+
byte[] temp = new byte[attrib.tessSize * n];
|
|
9788
9850
|
PApplet.arrayCopy(array, 0, temp, 0, attrib.tessSize * polyVertexCount);
|
|
9789
9851
|
bpolyAttribs.put(attrib.name, temp);
|
|
9790
9852
|
polyAttribBuffers.put(attrib.name, PGL.allocateByteBuffer(temp));
|
|
9791
9853
|
}
|
|
9792
9854
|
|
|
9793
9855
|
void expandPolyIndices(int n) {
|
|
9794
|
-
short
|
|
9856
|
+
short[] temp = new short[n];
|
|
9795
9857
|
PApplet.arrayCopy(polyIndices, 0, temp, 0, polyIndexCount);
|
|
9796
9858
|
polyIndices = temp;
|
|
9797
9859
|
polyIndicesBuffer = PGL.allocateShortBuffer(polyIndices);
|
|
9798
9860
|
}
|
|
9799
9861
|
|
|
9800
9862
|
void expandLineVertices(int n) {
|
|
9801
|
-
float
|
|
9863
|
+
float[] temp = new float[4 * n];
|
|
9802
9864
|
PApplet.arrayCopy(lineVertices, 0, temp, 0, 4 * lineVertexCount);
|
|
9803
9865
|
lineVertices = temp;
|
|
9804
9866
|
lineVerticesBuffer = PGL.allocateFloatBuffer(lineVertices);
|
|
9805
9867
|
}
|
|
9806
9868
|
|
|
9807
9869
|
void expandLineColors(int n) {
|
|
9808
|
-
int
|
|
9870
|
+
int[] temp = new int[n];
|
|
9809
9871
|
PApplet.arrayCopy(lineColors, 0, temp, 0, lineVertexCount);
|
|
9810
9872
|
lineColors = temp;
|
|
9811
9873
|
lineColorsBuffer = PGL.allocateIntBuffer(lineColors);
|
|
9812
9874
|
}
|
|
9813
9875
|
|
|
9814
9876
|
void expandLineDirections(int n) {
|
|
9815
|
-
float
|
|
9877
|
+
float[] temp = new float[4 * n];
|
|
9816
9878
|
PApplet.arrayCopy(lineDirections, 0, temp, 0, 4 * lineVertexCount);
|
|
9817
9879
|
lineDirections = temp;
|
|
9818
9880
|
lineDirectionsBuffer = PGL.allocateFloatBuffer(lineDirections);
|
|
9819
9881
|
}
|
|
9820
9882
|
|
|
9821
9883
|
void expandLineIndices(int n) {
|
|
9822
|
-
short
|
|
9884
|
+
short[] temp = new short[n];
|
|
9823
9885
|
PApplet.arrayCopy(lineIndices, 0, temp, 0, lineIndexCount);
|
|
9824
9886
|
lineIndices = temp;
|
|
9825
9887
|
lineIndicesBuffer = PGL.allocateShortBuffer(lineIndices);
|
|
9826
9888
|
}
|
|
9827
9889
|
|
|
9828
9890
|
void expandPointVertices(int n) {
|
|
9829
|
-
float
|
|
9891
|
+
float[] temp = new float[4 * n];
|
|
9830
9892
|
PApplet.arrayCopy(pointVertices, 0, temp, 0, 4 * pointVertexCount);
|
|
9831
9893
|
pointVertices = temp;
|
|
9832
9894
|
pointVerticesBuffer = PGL.allocateFloatBuffer(pointVertices);
|
|
9833
9895
|
}
|
|
9834
9896
|
|
|
9835
9897
|
void expandPointColors(int n) {
|
|
9836
|
-
int
|
|
9898
|
+
int[] temp = new int[n];
|
|
9837
9899
|
PApplet.arrayCopy(pointColors, 0, temp, 0, pointVertexCount);
|
|
9838
9900
|
pointColors = temp;
|
|
9839
9901
|
pointColorsBuffer = PGL.allocateIntBuffer(pointColors);
|
|
9840
9902
|
}
|
|
9841
9903
|
|
|
9842
9904
|
void expandPointOffsets(int n) {
|
|
9843
|
-
float
|
|
9905
|
+
float[] temp = new float[2 * n];
|
|
9844
9906
|
PApplet.arrayCopy(pointOffsets, 0, temp, 0, 2 * pointVertexCount);
|
|
9845
9907
|
pointOffsets = temp;
|
|
9846
9908
|
pointOffsetsBuffer = PGL.allocateFloatBuffer(pointOffsets);
|
|
9847
9909
|
}
|
|
9848
9910
|
|
|
9849
9911
|
void expandPointIndices(int n) {
|
|
9850
|
-
short
|
|
9912
|
+
short[] temp = new short[n];
|
|
9851
9913
|
PApplet.arrayCopy(pointIndices, 0, temp, 0, pointIndexCount);
|
|
9852
9914
|
pointIndices = temp;
|
|
9853
9915
|
pointIndicesBuffer = PGL.allocateShortBuffer(pointIndices);
|
|
@@ -9896,56 +9958,56 @@ public class PGraphicsOpenGL extends PGraphics {
|
|
|
9896
9958
|
}
|
|
9897
9959
|
|
|
9898
9960
|
void trimPolyVertices() {
|
|
9899
|
-
float
|
|
9961
|
+
float[] temp = new float[4 * polyVertexCount];
|
|
9900
9962
|
PApplet.arrayCopy(polyVertices, 0, temp, 0, 4 * polyVertexCount);
|
|
9901
9963
|
polyVertices = temp;
|
|
9902
9964
|
polyVerticesBuffer = PGL.allocateFloatBuffer(polyVertices);
|
|
9903
9965
|
}
|
|
9904
9966
|
|
|
9905
9967
|
void trimPolyColors() {
|
|
9906
|
-
int
|
|
9968
|
+
int[] temp = new int[polyVertexCount];
|
|
9907
9969
|
PApplet.arrayCopy(polyColors, 0, temp, 0, polyVertexCount);
|
|
9908
9970
|
polyColors = temp;
|
|
9909
9971
|
polyColorsBuffer = PGL.allocateIntBuffer(polyColors);
|
|
9910
9972
|
}
|
|
9911
9973
|
|
|
9912
9974
|
void trimPolyNormals() {
|
|
9913
|
-
float
|
|
9975
|
+
float[] temp = new float[3 * polyVertexCount];
|
|
9914
9976
|
PApplet.arrayCopy(polyNormals, 0, temp, 0, 3 * polyVertexCount);
|
|
9915
9977
|
polyNormals = temp;
|
|
9916
9978
|
polyNormalsBuffer = PGL.allocateFloatBuffer(polyNormals);
|
|
9917
9979
|
}
|
|
9918
9980
|
|
|
9919
9981
|
void trimPolyTexCoords() {
|
|
9920
|
-
float
|
|
9982
|
+
float[] temp = new float[2 * polyVertexCount];
|
|
9921
9983
|
PApplet.arrayCopy(polyTexCoords, 0, temp, 0, 2 * polyVertexCount);
|
|
9922
9984
|
polyTexCoords = temp;
|
|
9923
9985
|
polyTexCoordsBuffer = PGL.allocateFloatBuffer(polyTexCoords);
|
|
9924
9986
|
}
|
|
9925
9987
|
|
|
9926
9988
|
void trimPolyAmbient() {
|
|
9927
|
-
int
|
|
9989
|
+
int[] temp = new int[polyVertexCount];
|
|
9928
9990
|
PApplet.arrayCopy(polyAmbient, 0, temp, 0, polyVertexCount);
|
|
9929
9991
|
polyAmbient = temp;
|
|
9930
9992
|
polyAmbientBuffer = PGL.allocateIntBuffer(polyAmbient);
|
|
9931
9993
|
}
|
|
9932
9994
|
|
|
9933
9995
|
void trimPolySpecular() {
|
|
9934
|
-
int
|
|
9996
|
+
int[] temp = new int[polyVertexCount];
|
|
9935
9997
|
PApplet.arrayCopy(polySpecular, 0, temp, 0, polyVertexCount);
|
|
9936
9998
|
polySpecular = temp;
|
|
9937
9999
|
polySpecularBuffer = PGL.allocateIntBuffer(polySpecular);
|
|
9938
10000
|
}
|
|
9939
10001
|
|
|
9940
10002
|
void trimPolyEmissive() {
|
|
9941
|
-
int
|
|
10003
|
+
int[] temp = new int[polyVertexCount];
|
|
9942
10004
|
PApplet.arrayCopy(polyEmissive, 0, temp, 0, polyVertexCount);
|
|
9943
10005
|
polyEmissive = temp;
|
|
9944
10006
|
polyEmissiveBuffer = PGL.allocateIntBuffer(polyEmissive);
|
|
9945
10007
|
}
|
|
9946
10008
|
|
|
9947
10009
|
void trimPolyShininess() {
|
|
9948
|
-
float
|
|
10010
|
+
float[] temp = new float[polyVertexCount];
|
|
9949
10011
|
PApplet.arrayCopy(polyShininess, 0, temp, 0, polyVertexCount);
|
|
9950
10012
|
polyShininess = temp;
|
|
9951
10013
|
polyShininessBuffer = PGL.allocateFloatBuffer(polyShininess);
|
|
@@ -9965,7 +10027,7 @@ public class PGraphicsOpenGL extends PGraphics {
|
|
|
9965
10027
|
|
|
9966
10028
|
void trimFloatAttribute(VertexAttribute attrib) {
|
|
9967
10029
|
float[] array = fpolyAttribs.get(attrib.name);
|
|
9968
|
-
float
|
|
10030
|
+
float[] temp = new float[attrib.tessSize * polyVertexCount];
|
|
9969
10031
|
PApplet.arrayCopy(array, 0, temp, 0, attrib.tessSize * polyVertexCount);
|
|
9970
10032
|
fpolyAttribs.put(attrib.name, temp);
|
|
9971
10033
|
polyAttribBuffers.put(attrib.name, PGL.allocateFloatBuffer(temp));
|
|
@@ -9973,7 +10035,7 @@ public class PGraphicsOpenGL extends PGraphics {
|
|
|
9973
10035
|
|
|
9974
10036
|
void trimIntAttribute(VertexAttribute attrib) {
|
|
9975
10037
|
int[] array = ipolyAttribs.get(attrib.name);
|
|
9976
|
-
int
|
|
10038
|
+
int[] temp = new int[attrib.tessSize * polyVertexCount];
|
|
9977
10039
|
PApplet.arrayCopy(array, 0, temp, 0, attrib.tessSize * polyVertexCount);
|
|
9978
10040
|
ipolyAttribs.put(attrib.name, temp);
|
|
9979
10041
|
polyAttribBuffers.put(attrib.name, PGL.allocateIntBuffer(temp));
|
|
@@ -9981,70 +10043,70 @@ public class PGraphicsOpenGL extends PGraphics {
|
|
|
9981
10043
|
|
|
9982
10044
|
void trimBoolAttribute(VertexAttribute attrib) {
|
|
9983
10045
|
byte[] array = bpolyAttribs.get(attrib.name);
|
|
9984
|
-
byte
|
|
10046
|
+
byte[] temp = new byte[attrib.tessSize * polyVertexCount];
|
|
9985
10047
|
PApplet.arrayCopy(array, 0, temp, 0, attrib.tessSize * polyVertexCount);
|
|
9986
10048
|
bpolyAttribs.put(attrib.name, temp);
|
|
9987
10049
|
polyAttribBuffers.put(attrib.name, PGL.allocateByteBuffer(temp));
|
|
9988
10050
|
}
|
|
9989
10051
|
|
|
9990
10052
|
void trimPolyIndices() {
|
|
9991
|
-
short
|
|
10053
|
+
short[] temp = new short[polyIndexCount];
|
|
9992
10054
|
PApplet.arrayCopy(polyIndices, 0, temp, 0, polyIndexCount);
|
|
9993
10055
|
polyIndices = temp;
|
|
9994
10056
|
polyIndicesBuffer = PGL.allocateShortBuffer(polyIndices);
|
|
9995
10057
|
}
|
|
9996
10058
|
|
|
9997
10059
|
void trimLineVertices() {
|
|
9998
|
-
float
|
|
10060
|
+
float[] temp = new float[4 * lineVertexCount];
|
|
9999
10061
|
PApplet.arrayCopy(lineVertices, 0, temp, 0, 4 * lineVertexCount);
|
|
10000
10062
|
lineVertices = temp;
|
|
10001
10063
|
lineVerticesBuffer = PGL.allocateFloatBuffer(lineVertices);
|
|
10002
10064
|
}
|
|
10003
10065
|
|
|
10004
10066
|
void trimLineColors() {
|
|
10005
|
-
int
|
|
10067
|
+
int[] temp = new int[lineVertexCount];
|
|
10006
10068
|
PApplet.arrayCopy(lineColors, 0, temp, 0, lineVertexCount);
|
|
10007
10069
|
lineColors = temp;
|
|
10008
10070
|
lineColorsBuffer = PGL.allocateIntBuffer(lineColors);
|
|
10009
10071
|
}
|
|
10010
10072
|
|
|
10011
10073
|
void trimLineDirections() {
|
|
10012
|
-
float
|
|
10074
|
+
float[] temp = new float[4 * lineVertexCount];
|
|
10013
10075
|
PApplet.arrayCopy(lineDirections, 0, temp, 0, 4 * lineVertexCount);
|
|
10014
10076
|
lineDirections = temp;
|
|
10015
10077
|
lineDirectionsBuffer = PGL.allocateFloatBuffer(lineDirections);
|
|
10016
10078
|
}
|
|
10017
10079
|
|
|
10018
10080
|
void trimLineIndices() {
|
|
10019
|
-
short
|
|
10081
|
+
short[] temp = new short[lineIndexCount];
|
|
10020
10082
|
PApplet.arrayCopy(lineIndices, 0, temp, 0, lineIndexCount);
|
|
10021
10083
|
lineIndices = temp;
|
|
10022
10084
|
lineIndicesBuffer = PGL.allocateShortBuffer(lineIndices);
|
|
10023
10085
|
}
|
|
10024
10086
|
|
|
10025
10087
|
void trimPointVertices() {
|
|
10026
|
-
float
|
|
10088
|
+
float[] temp = new float[4 * pointVertexCount];
|
|
10027
10089
|
PApplet.arrayCopy(pointVertices, 0, temp, 0, 4 * pointVertexCount);
|
|
10028
10090
|
pointVertices = temp;
|
|
10029
10091
|
pointVerticesBuffer = PGL.allocateFloatBuffer(pointVertices);
|
|
10030
10092
|
}
|
|
10031
10093
|
|
|
10032
10094
|
void trimPointColors() {
|
|
10033
|
-
int
|
|
10095
|
+
int[] temp = new int[pointVertexCount];
|
|
10034
10096
|
PApplet.arrayCopy(pointColors, 0, temp, 0, pointVertexCount);
|
|
10035
10097
|
pointColors = temp;
|
|
10036
10098
|
pointColorsBuffer = PGL.allocateIntBuffer(pointColors);
|
|
10037
10099
|
}
|
|
10038
10100
|
|
|
10039
10101
|
void trimPointOffsets() {
|
|
10040
|
-
float
|
|
10102
|
+
float[] temp = new float[2 * pointVertexCount];
|
|
10041
10103
|
PApplet.arrayCopy(pointOffsets, 0, temp, 0, 2 * pointVertexCount);
|
|
10042
10104
|
pointOffsets = temp;
|
|
10043
10105
|
pointOffsetsBuffer = PGL.allocateFloatBuffer(pointOffsets);
|
|
10044
10106
|
}
|
|
10045
10107
|
|
|
10046
10108
|
void trimPointIndices() {
|
|
10047
|
-
short
|
|
10109
|
+
short[] temp = new short[pointIndexCount];
|
|
10048
10110
|
PApplet.arrayCopy(pointIndices, 0, temp, 0, pointIndexCount);
|
|
10049
10111
|
pointIndices = temp;
|
|
10050
10112
|
pointIndicesBuffer = PGL.allocateShortBuffer(pointIndices);
|
|
@@ -10598,28 +10660,26 @@ public class PGraphicsOpenGL extends PGraphics {
|
|
|
10598
10660
|
polyVertices, 4 * tessIdx, 3);
|
|
10599
10661
|
polyVertices[4 * tessIdx + 3] = 1;
|
|
10600
10662
|
|
|
10601
|
-
polyAttribs.keySet()
|
|
10663
|
+
for (String name: polyAttribs.keySet()) {
|
|
10602
10664
|
VertexAttribute attrib = polyAttribs.get(name);
|
|
10603
|
-
if (!
|
|
10604
|
-
|
|
10605
|
-
|
|
10606
|
-
|
|
10607
|
-
|
|
10608
|
-
|
|
10609
|
-
|
|
10610
|
-
});
|
|
10665
|
+
if (!attrib.isPosition()) continue;
|
|
10666
|
+
float[] inValues = in.fattribs.get(name);
|
|
10667
|
+
float[] tessValues = fpolyAttribs.get(name);
|
|
10668
|
+
PApplet.arrayCopy(inValues, 3 * inIdx,
|
|
10669
|
+
tessValues, 4 * tessIdx, 3);
|
|
10670
|
+
tessValues[4 * tessIdx + 3] = 1;
|
|
10671
|
+
}
|
|
10611
10672
|
}
|
|
10612
10673
|
PApplet.arrayCopy(in.normals, 3 * i0,
|
|
10613
10674
|
polyNormals, 3 * firstPolyVertex, 3 * nvert);
|
|
10614
|
-
polyAttribs.keySet()
|
|
10675
|
+
for (String name: polyAttribs.keySet()) {
|
|
10615
10676
|
VertexAttribute attrib = polyAttribs.get(name);
|
|
10616
|
-
if (!
|
|
10617
|
-
|
|
10618
|
-
|
|
10619
|
-
|
|
10620
|
-
|
|
10621
|
-
|
|
10622
|
-
});
|
|
10677
|
+
if (!attrib.isNormal()) continue;
|
|
10678
|
+
float[] inValues = in.fattribs.get(name);
|
|
10679
|
+
float[] tessValues = fpolyAttribs.get(name);
|
|
10680
|
+
PApplet.arrayCopy(inValues, 3 * i0,
|
|
10681
|
+
tessValues, 3 * firstPolyVertex, 3 * nvert);
|
|
10682
|
+
}
|
|
10623
10683
|
}
|
|
10624
10684
|
|
|
10625
10685
|
// Just copy attributes one by one.
|
|
@@ -11158,9 +11218,9 @@ public class PGraphicsOpenGL extends PGraphics {
|
|
|
11158
11218
|
float inc = (float) SINCOS_LENGTH / perim;
|
|
11159
11219
|
for (int k = 0; k < perim; k++) {
|
|
11160
11220
|
tess.pointOffsets[2 * attribIdx + 0] =
|
|
11161
|
-
0.5f *
|
|
11221
|
+
0.5f * cosLUT[(int) val] * transformScale() * strokeWeight;
|
|
11162
11222
|
tess.pointOffsets[2 * attribIdx + 1] =
|
|
11163
|
-
0.5f *
|
|
11223
|
+
0.5f * sinLUT[(int) val] * transformScale() * strokeWeight;
|
|
11164
11224
|
val = (val + inc) % SINCOS_LENGTH;
|
|
11165
11225
|
attribIdx++;
|
|
11166
11226
|
}
|
|
@@ -11210,8 +11270,8 @@ public class PGraphicsOpenGL extends PGraphics {
|
|
|
11210
11270
|
vertIdx++;
|
|
11211
11271
|
for (int k = 0; k < perim; k++) {
|
|
11212
11272
|
tess.setPolyVertex(vertIdx,
|
|
11213
|
-
x0 + 0.5f *
|
|
11214
|
-
y0 + 0.5f *
|
|
11273
|
+
x0 + 0.5f * cosLUT[(int) val] * strokeWeight,
|
|
11274
|
+
y0 + 0.5f * sinLUT[(int) val] * strokeWeight,
|
|
11215
11275
|
0, rgba, false);
|
|
11216
11276
|
vertIdx++;
|
|
11217
11277
|
val = (val + inc) % SINCOS_LENGTH;
|
|
@@ -12474,7 +12534,7 @@ public class PGraphicsOpenGL extends PGraphics {
|
|
|
12474
12534
|
if (dupIndices.length == dupCount) {
|
|
12475
12535
|
int n = dupCount << 1;
|
|
12476
12536
|
|
|
12477
|
-
int
|
|
12537
|
+
int[] temp = new int[n];
|
|
12478
12538
|
PApplet.arrayCopy(dupIndices, 0, temp, 0, dupCount);
|
|
12479
12539
|
dupIndices = temp;
|
|
12480
12540
|
}
|
|
@@ -12521,7 +12581,7 @@ public class PGraphicsOpenGL extends PGraphics {
|
|
|
12521
12581
|
}
|
|
12522
12582
|
|
|
12523
12583
|
void expandRawIndices(int n) {
|
|
12524
|
-
int
|
|
12584
|
+
int[] temp = new int[n];
|
|
12525
12585
|
PApplet.arrayCopy(rawIndices, 0, temp, 0, rawSize);
|
|
12526
12586
|
rawIndices = temp;
|
|
12527
12587
|
}
|
|
@@ -12624,23 +12684,18 @@ public class PGraphicsOpenGL extends PGraphics {
|
|
|
12624
12684
|
}
|
|
12625
12685
|
}
|
|
12626
12686
|
|
|
12627
|
-
|
|
12628
|
-
|
|
12629
|
-
|
|
12630
|
-
|
|
12631
|
-
|
|
12632
|
-
|
|
12633
|
-
|
|
12634
|
-
|
|
12635
|
-
|
|
12636
|
-
|
|
12637
|
-
|
|
12638
|
-
|
|
12639
|
-
break;
|
|
12640
|
-
default:
|
|
12641
|
-
addVertex(i);
|
|
12642
|
-
i++;
|
|
12643
|
-
break;
|
|
12687
|
+
if (code == BEZIER_VERTEX) {
|
|
12688
|
+
addBezierVertex(i);
|
|
12689
|
+
i += 3;
|
|
12690
|
+
} else if (code == QUADRATIC_VERTEX) {
|
|
12691
|
+
addQuadraticVertex(i);
|
|
12692
|
+
i += 2;
|
|
12693
|
+
} else if (code == CURVE_VERTEX) {
|
|
12694
|
+
addCurveVertex(i);
|
|
12695
|
+
i++;
|
|
12696
|
+
} else {
|
|
12697
|
+
addVertex(i);
|
|
12698
|
+
i++;
|
|
12644
12699
|
}
|
|
12645
12700
|
}
|
|
12646
12701
|
if (stroke) {
|
|
@@ -12898,7 +12953,7 @@ public class PGraphicsOpenGL extends PGraphics {
|
|
|
12898
12953
|
r[j++] = (fcol >> 24) & 0xFF; // fa
|
|
12899
12954
|
r[j++] = (fcol >> 16) & 0xFF; // fr
|
|
12900
12955
|
r[j++] = (fcol >> 8) & 0xFF; // fg
|
|
12901
|
-
r[j++] = (fcol
|
|
12956
|
+
r[j++] = (fcol) & 0xFF; // fb
|
|
12902
12957
|
|
|
12903
12958
|
r[j++] = in.normals[3*i + 0]; // nx
|
|
12904
12959
|
r[j++] = in.normals[3*i + 1]; // ny
|
|
@@ -12911,19 +12966,19 @@ public class PGraphicsOpenGL extends PGraphics {
|
|
|
12911
12966
|
r[j++] = (acol >> 24) & 0xFF; // aa
|
|
12912
12967
|
r[j++] = (acol >> 16) & 0xFF; // ar
|
|
12913
12968
|
r[j++] = (acol >> 8) & 0xFF; // ag
|
|
12914
|
-
r[j++] = (acol
|
|
12969
|
+
r[j++] = (acol) & 0xFF; // ab
|
|
12915
12970
|
|
|
12916
12971
|
int scol = in.specular[i];
|
|
12917
12972
|
r[j++] = (scol >> 24) & 0xFF; // sa
|
|
12918
12973
|
r[j++] = (scol >> 16) & 0xFF; // sr
|
|
12919
12974
|
r[j++] = (scol >> 8) & 0xFF; // sg
|
|
12920
|
-
r[j++] = (scol
|
|
12975
|
+
r[j++] = (scol) & 0xFF; // sb
|
|
12921
12976
|
|
|
12922
12977
|
int ecol = in.emissive[i];
|
|
12923
12978
|
r[j++] = (ecol >> 24) & 0xFF; // ea
|
|
12924
12979
|
r[j++] = (ecol >> 16) & 0xFF; // er
|
|
12925
12980
|
r[j++] = (ecol >> 8) & 0xFF; // eg
|
|
12926
|
-
r[j++] = (ecol
|
|
12981
|
+
r[j++] = (ecol) & 0xFF; // eb
|
|
12927
12982
|
|
|
12928
12983
|
r[j++] = in.shininess[i]; // sh
|
|
12929
12984
|
|
|
@@ -12971,15 +13026,15 @@ public class PGraphicsOpenGL extends PGraphics {
|
|
|
12971
13026
|
if (pathVertexCount == pathVertices.length / 3) {
|
|
12972
13027
|
int newSize = pathVertexCount << 1;
|
|
12973
13028
|
|
|
12974
|
-
float
|
|
13029
|
+
float[] vtemp = new float[3 * newSize];
|
|
12975
13030
|
PApplet.arrayCopy(pathVertices, 0, vtemp, 0, 3 * pathVertexCount);
|
|
12976
13031
|
pathVertices = vtemp;
|
|
12977
13032
|
|
|
12978
|
-
int
|
|
13033
|
+
int[] ctemp = new int[newSize];
|
|
12979
13034
|
PApplet.arrayCopy(pathColors, 0, ctemp, 0, pathVertexCount);
|
|
12980
13035
|
pathColors = ctemp;
|
|
12981
13036
|
|
|
12982
|
-
float
|
|
13037
|
+
float[] wtemp = new float[newSize];
|
|
12983
13038
|
PApplet.arrayCopy(pathWeights, 0, wtemp, 0, pathVertexCount);
|
|
12984
13039
|
pathWeights = wtemp;
|
|
12985
13040
|
}
|
|
@@ -13218,6 +13273,7 @@ public class PGraphicsOpenGL extends PGraphics {
|
|
|
13218
13273
|
vertFirst + vertOffset + tessIdx2);
|
|
13219
13274
|
}
|
|
13220
13275
|
|
|
13276
|
+
@Override
|
|
13221
13277
|
public void vertex(Object data) {
|
|
13222
13278
|
if (data instanceof double[]) {
|
|
13223
13279
|
double[] d = (double[]) data;
|