Skip to content

Commit be64dd5

Browse files
committed
Update jruby
1 parent 7fbb680 commit be64dd5

14 files changed

Lines changed: 829 additions & 64 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
**v2.4.2** Update to use jruby-complete-9.2.14, regularise video/sound downloadswhen no processing ide.
1+
**v2.5.0** Update to use jruby-complete-9.2.15.
2+
3+
**v2.4.2** Update to use jruby-complete-9.2.14.0, regularise video/sound downloadswhen no processing ide.
24

35
**v2.4.1** Update to use jruby-complete-9.2.13.0
46

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ A new version for jdk11 use, does not require an installed `vanilla processing`,
66

77
## Requirements
88

9-
A clean start for `jruby_art` with custom processing core included, built for [jruby-9.2.14.0](http://jruby.org/download) see [wiki](https://github.com/ruby-processing/JRubyArt/wiki/Building-latest-gem) for building gem from this repo.
9+
A clean start for `jruby_art` with custom processing core included, built for [jruby-9.2.15.0](http://jruby.org/download) see [wiki](https://github.com/ruby-processing/JRubyArt/wiki/Building-latest-gem) for building gem from this repo.
1010

1111
## Requirements
1212

13-
A suitable version of ruby (MRI `ruby 2.5+` or `jruby-9.2.14.0`) to download gem. NB: avoid ruby 2.7, it is guaranteed to give you problems (you've been warned)
13+
A suitable version of ruby (MRI `ruby 2.5+` or `jruby-9.2.15.0`) to download gem. NB: avoid ruby 2.7, it is guaranteed to give you problems (you've been warned)
1414
Tested and working AdoptOpenJDK 11-13, OpenJ9 14, if you have any issues with opengl sketches with distro installed JDK use a JDK from AdoptOpenJDK.
1515

1616

Rakefile

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,13 @@ require 'erb'
55

66
MVN = Gem.win_platform? ? File.expand_path('mvnw.cmd') : File.expand_path('mvnw')
77

8-
task default: %i[compile install_jogl gem test]
8+
task default: %i[compile init gem test]
99

1010
# depends on installed processing, with processing on path
1111
desc 'Copy Jars'
12-
task :install_jogl do
13-
# Temporarily load jogl-2.4.0-rc2021011 from a local directory
14-
jogl24 = File.join(ENV['HOME'], 'jogl-2.4-rc2021011')
15-
opengl = Dir.entries(jogl24).grep(/amd64|macosx-universal/)
12+
task :init do
13+
jogl24 = File.join(ENV['HOME'], 'jogl24')
14+
opengl = Dir.entries(jogl24).grep(/amd64|universal|arm64/).select { |jar| jar =~ /linux|windows|macosx|ios|/ }
1615
opengl.concat %w[jogl-all.jar gluegen-rt.jar]
1716
opengl.each do |gl|
1817
FileUtils.cp(File.join(jogl24, gl), File.join('.', 'lib'))

jruby_art.gemspec

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,11 @@ Gem::Specification.new do |spec|
2626
spec.files << 'lib/jogl-all.jar'
2727
spec.files << 'lib/gluegen-rt-natives-linux-amd64.jar'
2828
spec.files << 'lib/gluegen-rt-natives-macosx-universal.jar'
29+
spec.files << 'lib/gluegen-rt-natives-ios-arm64.jar'
2930
spec.files << 'lib/gluegen-rt-natives-windows-amd64.jar'
3031
spec.files << 'lib/jogl-all-natives-linux-amd64.jar'
3132
spec.files << 'lib/jogl-all-natives-macosx-universal.jar'
33+
spec.files << 'lib/jogl-all-natives-ios-arm64.jar'
3234
spec.files << 'lib/jogl-all-natives-windows-amd64.jar'
3335
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
3436
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})

lib/jruby_art/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22

33
# A wrapper for version
44
module JRubyArt
5-
VERSION = '2.4.3'
5+
VERSION = '2.5.0'
66
end

pom.rb

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
project 'jruby_art', 'https://github.com/ruby-processing/JRubyArt' do
44
model_version '4.0.0'
5-
id 'ruby-processing:jruby_art:2.4.3'
5+
id 'ruby-processing:jruby_art:2.5.0'
66
packaging 'jar'
77

88
description 'Jar for JRubyArt'
@@ -20,52 +20,52 @@
2020
issue_management 'https://github.com/ruby-processing/JRubyArt/issues', 'Github'
2121

2222
source_control(url: 'https://github.com/ruby-processing/JRubyArt',
23-
connection: 'scm:git:git://github.com/ruby-processing/JRubyArt.git',
24-
developer_connection: 'scm:git:git@github.com/ruby-processing/JRubyArt.git')
23+
connection: 'scm:git:git://github.com/ruby-processing/JRubyArt.git',
24+
developer_connection: 'scm:git:git@github.com/ruby-processing/JRubyArt.git')
2525

26-
properties('processing.api' => 'http://processing.github.io/processing-javadocs/core/',
27-
'source.directory' => 'src',
28-
'polyglot.dump.pom' => 'pom.xml',
29-
'project.build.sourceEncoding' => 'UTF-8',
30-
'jogl.version' => '2.3.2',
31-
'jruby.api' => 'http://jruby.org/apidocs/')
26+
properties('processing.api' => 'http://processing.github.io/processing-javadocs/core/',
27+
'source.directory' => 'src',
28+
'polyglot.dump.pom' => 'pom.xml',
29+
'project.build.sourceEncoding' => 'UTF-8',
30+
'jogl.version' => '2.3.2',
31+
'jruby.api' => 'http://jruby.org/apidocs/')
3232

33-
pom 'org.jruby:jruby:9.2.14.0'
34-
jar 'org.jogamp.jogl:jogl-all:${jogl.version}'
35-
jar 'org.jogamp.gluegen:gluegen-rt-main:${jogl.version}'
36-
jar 'org.processing:video:3.0.2'
33+
pom 'org.jruby:jruby:9.2.15.0'
34+
jar 'org.jogamp.jogl:jogl-all:${jogl.version}'
35+
jar 'org.jogamp.gluegen:gluegen-rt-main:${jogl.version}'
36+
jar 'org.processing:video:3.0.2'
3737

38-
overrides do
39-
plugin :resources, '3.1.0'
40-
plugin :dependency, '3.1.2'
41-
plugin(:compiler, '3.8.1',
42-
'release' => '11')
43-
plugin(:javadoc, '2.10.4',
44-
'detectOfflineLinks' => 'false',
45-
'links' => ['${processing.api}',
46-
'${jruby.api}'])
47-
plugin(:jar, '3.2.0',
48-
'archive' => {
49-
'manifestEntries' => {
50-
'Class-Path' => 'gluegen-rt.jar jog-all.jar'
51-
}
52-
})
53-
plugin :jdeps, '3.1.2' do
54-
execute_goals 'jdkinternals', 'test-jdkinternals'
55-
end
56-
end
38+
overrides do
39+
plugin :resources, '3.1.0'
40+
plugin :dependency, '3.1.2'
41+
plugin(:compiler, '3.8.1',
42+
'release' => '11')
43+
plugin(:javadoc, '2.10.4',
44+
'detectOfflineLinks' => 'false',
45+
'links' => ['${processing.api}',
46+
'${jruby.api}'])
47+
plugin(:jar, '3.2.0',
48+
'archive' => {
49+
'manifestEntries' => {
50+
'Automatic-Module-Name' => 'processing.core'
51+
}
52+
})
53+
plugin :jdeps, '3.1.2' do
54+
execute_goals 'jdkinternals', 'test-jdkinternals'
55+
end
56+
end
5757

58-
build do
59-
resource do
60-
directory '${source.directory}/main/java'
61-
includes '**/**/*.glsl', '**/*.jnilib'
62-
excludes '**/**/*.java'
63-
end
58+
build do
59+
resource do
60+
directory '${source.directory}/main/java'
61+
includes '**/**/*.glsl', '**/*.jnilib'
62+
excludes '**/**/*.java'
63+
end
6464

65-
resource do
66-
directory '${source.directory}/main/resources'
67-
includes '**/*.png', '*.txt'
68-
excludes
65+
resource do
66+
directory '${source.directory}/main/resources'
67+
includes '**/*.png', '*.txt'
68+
excludes
69+
end
70+
end
6971
end
70-
end
71-
end

pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ DO NOT MODIFIY - GENERATED CODE
1111
<modelVersion>4.0.0</modelVersion>
1212
<groupId>ruby-processing</groupId>
1313
<artifactId>jruby_art</artifactId>
14-
<version>2.4.3</version>
14+
<version>2.5.0</version>
1515
<name>jruby_art</name>
1616
<description>Jar for JRubyArt</description>
1717
<url>https://github.com/ruby-processing/JRubyArt</url>
@@ -66,7 +66,7 @@ DO NOT MODIFIY - GENERATED CODE
6666
<dependency>
6767
<groupId>org.jruby</groupId>
6868
<artifactId>jruby</artifactId>
69-
<version>9.2.14.0</version>
69+
<version>9.2.15.0</version>
7070
<type>pom</type>
7171
</dependency>
7272
<dependency>
@@ -139,7 +139,7 @@ DO NOT MODIFIY - GENERATED CODE
139139
<configuration>
140140
<archive>
141141
<manifestEntries>
142-
<Class-Path>gluegen-rt.jar jog-all.jar</Class-Path>
142+
<Automatic-Module-Name>processing.core</Automatic-Module-Name>
143143
</manifestEntries>
144144
</archive>
145145
</configuration>
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
package monkstone.noise;
2+
3+
/**
4+
*
5+
* @author tux
6+
*/
7+
public interface NoiseGenerator {
8+
/**
9+
*
10+
* @param x
11+
* @return
12+
*/
13+
default float noise(float x){ return noise(x, 0); }
14+
15+
/**
16+
*
17+
* @param x
18+
* @param y
19+
* @return
20+
*/
21+
default float noise(float x, float y) { return noise(x, y, 0); }
22+
23+
/**
24+
* ( begin auto-generated from noise.xml )
25+
* <p>
26+
* Returns the Perlin noise value at specified coordinates. Perlin noise is
27+
* a random sequence generator producing a more natural ordered, harmonic
28+
* succession of numbers compared to the standard <b>random()</b> function.
29+
* It was invented by Ken Perlin in the 1980s and been used since in
30+
* graphical applications to produce procedural textures, natural motion,
31+
* shapes, terrains etc. The main difference to the
32+
* <b>random()</b> function is that Perlin noise is defined in an infinite
33+
* n-dimensional space where each pair of coordinates corresponds to a
34+
* fixed semi-random value (fixed only for the lifespan of the program).
35+
* The resulting value will always be between 0.0 and 1.0. Processing can
36+
* compute 1D, 2D and 3D noise, depending on the number of coordinates
37+
* given. The noise value can be animated by moving through the noise space
38+
* as demonstrated in the example above. The 2nd and 3rd dimension can also
39+
* be interpreted as time. The actual noise is structured
40+
* similar to an audio signal, in respect to the function's use of
41+
* frequencies. Similar to the concept of harmonics in physics, perlin
42+
* noise is computed over several octaves which are added together for the
43+
* final result. Another way to adjust the character of the
44+
* resulting sequence is the scale of the input coordinates. As the
45+
* function works within an infinite space the value of the coordinates
46+
* doesn't matter as such, only the distance between successive coordinates
47+
* does (eg. when using <b>noise()</b> within a loop). As a general rule
48+
* the smaller the difference between coordinates, the smoother the
49+
* resulting noise sequence will be. Steps of 0.005-0.03 work best for most
50+
* applications, but this will differ depending on use.
51+
* <p>
52+
* ( end auto-generated )
53+
*
54+
* @param x x-coordinate in noise space
55+
* @param y y-coordinate in noise space
56+
* @param z z-coordinate in noise space
57+
* @return
58+
* @webref math:random
59+
* @see PApplet#noiseSeed(long)
60+
* @see PApplet#noiseDetail(int, float)
61+
* @see PApplet#random(float, float)
62+
*/
63+
float noise(float x, float y, float z);
64+
65+
/**
66+
* ( begin auto-generated from noiseDetail.xml )
67+
*
68+
* Adjusts the character and level of detail produced by the Perlin noise
69+
* function. Similar to harmonics in physics, noise is computed over
70+
* several octaves. Lower octaves contribute more to the output signal and
71+
* as such define the overal intensity of the noise, whereas higher octaves
72+
* create finer grained details in the noise sequence. By default, noise is
73+
* computed over 4 octaves with each octave contributing exactly half than
74+
* its predecessor, starting at 50% strength for the 1st octave. This
75+
* falloff amount can be changed by adding an additional function
76+
* parameter. Eg. a falloff factor of 0.75 means each octave will now have
77+
* 75% impact (25% less) of the previous lower octave. Any value between
78+
* 0.0 and 1.0 is valid, however note that values greater than 0.5 might
79+
* result in greater than 1.0 values returned by <b>noise()</b>.
80+
* By changing these parameters, the signal created by the <b>noise()</b>
81+
* function can be adapted to fit very specific needs and characteristics.
82+
*
83+
* ( end auto-generated )
84+
* @webref math:random
85+
* @param lod number of octaves to be used by the noise
86+
* @see PApplet#noise(float, float, float)
87+
*/
88+
void noiseDetail(int lod);
89+
90+
/**
91+
* @param lod
92+
* @see #noiseDetail(int)
93+
* @param falloff falloff factor for each octave
94+
*/
95+
void noiseDetail(int lod, float falloff);
96+
97+
/**
98+
* ( begin auto-generated from noiseSeed.xml )
99+
*
100+
* Sets the seed value for <b>noise()</b>. By default, <b>noise()</b>
101+
* produces different results each time the program is run. Set the
102+
* <b>value</b> parameter to a constant to return the same pseudo-random
103+
* numbers each time the software is run.
104+
*
105+
* ( end auto-generated )
106+
* @webref math:random
107+
* @param seed seed value
108+
* @see PApplet#noise(float, float, float)
109+
* @see PApplet#noiseDetail(int, float)
110+
* @see PApplet#random(float,float)
111+
* @see PApplet#randomSeed(long)
112+
*/
113+
void noiseSeed(long seed);
114+
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
// JAVA REFERENCE IMPLEMENTATION OF IMPROVED NOISE - COPYRIGHT 2002 KEN PERLIN.
2+
3+
public final class PerlinNoise {
4+
static public double noise(double x, double y, double z) {
5+
int X = (int)Math.floor(x) & 255, // FIND UNIT CUBE THAT
6+
Y = (int)Math.floor(y) & 255, // CONTAINS POINT.
7+
Z = (int)Math.floor(z) & 255;
8+
x -= Math.floor(x); // FIND RELATIVE X,Y,Z
9+
y -= Math.floor(y); // OF POINT IN CUBE.
10+
z -= Math.floor(z);
11+
double u = fade(x), // COMPUTE FADE CURVES
12+
v = fade(y), // FOR EACH OF X,Y,Z.
13+
w = fade(z);
14+
int A = p[X ]+Y, AA = p[A]+Z, AB = p[A+1]+Z, // HASH COORDINATES OF
15+
B = p[X+1]+Y, BA = p[B]+Z, BB = p[B+1]+Z; // THE 8 CUBE CORNERS,
16+
17+
return lerp(w, lerp(v, lerp(u, grad(p[AA ], x , y , z ), // AND ADD
18+
grad(p[BA ], x-1, y , z )), // BLENDED
19+
lerp(u, grad(p[AB ], x , y-1, z ), // RESULTS
20+
grad(p[BB ], x-1, y-1, z ))),// FROM 8
21+
lerp(v, lerp(u, grad(p[AA+1], x , y , z-1 ), // CORNERS
22+
grad(p[BA+1], x-1, y , z-1 )), // OF CUBE
23+
lerp(u, grad(p[AB+1], x , y-1, z-1 ),
24+
grad(p[BB+1], x-1, y-1, z-1 ))));
25+
}
26+
static double fade(double t) { return t * t * t * (t * (t * 6 - 15) + 10); }
27+
static double lerp(double t, double a, double b) { return a + t * (b - a); }
28+
static double grad(int hash, double x, double y, double z) {
29+
int h = hash & 15; // CONVERT LO 4 BITS OF HASH CODE
30+
double u = h<8 ? x : y, // INTO 12 GRADIENT DIRECTIONS.
31+
v = h<4 ? y : h==12||h==14 ? x : z;
32+
return ((h&1) == 0 ? u : -u) + ((h&2) == 0 ? v : -v);
33+
}
34+
static final int p[] = new int[512], permutation[] = { 151,160,137,91,90,15,
35+
131,13,201,95,96,53,194,233,7,225,140,36,103,30,69,142,8,99,37,240,21,10,23,
36+
190, 6,148,247,120,234,75,0,26,197,62,94,252,219,203,117,35,11,32,57,177,33,
37+
88,237,149,56,87,174,20,125,136,171,168, 68,175,74,165,71,134,139,48,27,166,
38+
77,146,158,231,83,111,229,122,60,211,133,230,220,105,92,41,55,46,245,40,244,
39+
102,143,54, 65,25,63,161, 1,216,80,73,209,76,132,187,208, 89,18,169,200,196,
40+
135,130,116,188,159,86,164,100,109,198,173,186, 3,64,52,217,226,250,124,123,
41+
5,202,38,147,118,126,255,82,85,212,207,206,59,227,47,16,58,17,182,189,28,42,
42+
223,183,170,213,119,248,152, 2,44,154,163, 70,221,153,101,155,167, 43,172,9,
43+
129,22,39,253, 19,98,108,110,79,113,224,232,178,185, 112,104,218,246,97,228,
44+
251,34,242,193,238,210,144,12,191,179,162,241, 81,51,145,235,249,14,239,107,
45+
49,192,214, 31,181,199,106,157,184, 84,204,176,115,121,50,45,127, 4,150,254,
46+
138,236,205,93,222,114,67,29,24,72,243,141,128,195,78,66,215,61,156,180
47+
};
48+
static { for (int i=0; i < 256 ; i++) p[256+i] = p[i] = permutation[i]; }
49+
}

0 commit comments

Comments
 (0)