picrate 2.3.0-java → 2.4.0-java

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2e297a6447b346b596fdc87a909fe388a0cd42f7f8a7f4b2a48d523bba03a2e6
4
- data.tar.gz: 8d0ead8d48a2c9a05caa6e0e27674f433af3acea1c1fd9045f19aa00f45f08db
3
+ metadata.gz: 648440446709f65ab3078f0a76525114d496e740b9e6584869bfd7c975017096
4
+ data.tar.gz: d31bd972a3e7b362319bffbbd0a5374c9e0112a76be8cae66037217561353065
5
5
  SHA512:
6
- metadata.gz: e1f3cdf8c0d0e22193b6d2686a4b0d5bb2f37129e5df058086b5279ca2711fdd6eee91d6701cccc59c7c564db2012da86fad2cfd648df31ed6f091e1166b4409
7
- data.tar.gz: 7df4dfab9072b06f42190aa042fa47cb91979f323f3040b6697b799e31dfff79ca4f6b12f7998bd7909ca8dcb90566ab152fd1ab4e50f639b597671b6885e8a5
6
+ metadata.gz: 5baa9ec19140c192d992773b1f37618d67332ac5917ee0f14e6198612c380b4997908ce32ff8f2f81cabf9fd48b739bb40a2e4eccc3f7172388541599c7e4fb6
7
+ data.tar.gz: 828d1c8aa7e31cfd47c0f4a73307cbc7e962e1e1f8860e256d2e4591ab8933391841c8a3df9b22e3de1f0cf80d7d6c67fdc3234433e21c1c4f8de98b6f6db468
data/CHANGELOG.md CHANGED
@@ -1,3 +1,5 @@
1
+ v2.4.0 Refactor noise to two modules, FastNoise (default) & SmoothNoise, with terrain noise `:tnoise` option.
2
+
1
3
  v2.3.0 Abandon Processing Value Noise in favour of OpenSimplex2, with choosable options. Added pdf library using iText5.
2
4
 
3
5
  v2.2.0 Bump to latest JOGL-rc January 2021
data/README.md CHANGED
@@ -19,7 +19,7 @@ Requires java to build (and [jogl-2.4.0-rc jars][jogl_jars]), but uses a maven w
19
19
  ```bash
20
20
  cd PiCrate # or whatever you call it
21
21
  rake # assumes an installed version of vanilla processing
22
- jgem install picrate-2.2.0-java.gem
22
+ jgem install picrate-2.4.0-java.gem
23
23
 
24
24
  ```
25
25
  To create a template sketch:-
data/lib/picrate/app.rb CHANGED
@@ -16,10 +16,6 @@ module Processing
16
16
  java_import 'monkstone.vecmath.ShapeRender'
17
17
  end
18
18
 
19
- module NoiseModule
20
- java_import 'monkstone.noise.NoiseMode'
21
- end
22
-
23
19
  # This class is the base class the user should inherit from when making
24
20
  # their own sketch.
25
21
  #
@@ -59,7 +55,7 @@ module Processing
59
55
  include HelperMethods
60
56
  include MathTool
61
57
  include Math
62
- include NoiseModule
58
+ include FastNoise
63
59
  # Alias some methods for familiarity for Shoes coders.
64
60
  alias oval ellipse
65
61
  alias stroke_width stroke_weight
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PiCrate
4
- VERSION = '2.3.0'
4
+ VERSION = '2.4.0'
5
5
  end
data/library/pdf/pdf.rb CHANGED
@@ -2,5 +2,6 @@
2
2
 
3
3
  # @TODO usage
4
4
  class Processing::App
5
+ require_relative 'itextpdf-5.5.13.2.jar'
5
6
  java_import Java::ProcessingPdf::PGraphicsPDF
6
7
  end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ # @TODO usage
4
+ class Processing::App
5
+ require_relative 'batik-all-1.14.jar'
6
+ java_import Java::ProcessingSvg::PGraphicsSVG
7
+ end
data/picrate.gemspec CHANGED
@@ -27,10 +27,11 @@ Gem::Specification.new do |gem|
27
27
  gem.files << 'lib/jogl-all-natives-linux-amd64.jar'
28
28
  gem.files << 'lib/jogl-all-natives-linux-armv6hf.jar'
29
29
  gem.files << 'lib/jogl-all-natives-linux-aarch64.jar'
30
- gem.files << 'lib/itextpdf-5.5.13.2.jar'
30
+ gem.files << 'library/pdf/itextpdf-5.5.13.2.jar'
31
+ gem.files << 'library/svg/batik-all-1.14.jar'
31
32
  gem.executables = gem.files.grep(%r{^bin/}).map { |f| File.basename(f) }
32
33
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
33
- gem.add_development_dependency 'minitest', '~> 5.10'
34
+ gem.add_development_dependency 'minitest', '~> 5.14'
34
35
  gem.add_runtime_dependency 'rake', '~> 13.0'
35
36
  gem.add_runtime_dependency 'arcball', '~> 1.0', '>= 1.0.1'
36
37
  gem.require_paths = ['lib']
data/pom.rb CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  project 'picrate', 'http://maven.apache.org' do
4
4
  model_version '4.0.0'
5
- id 'ruby-processing:picrate:2.3.0'
5
+ id 'ruby-processing:picrate:2.4.0'
6
6
  packaging 'jar'
7
7
 
8
8
  description 'An integrated processing-core (somewhat hacked), with additional java code for a jruby version of processing.'
@@ -24,18 +24,20 @@ project 'picrate', 'http://maven.apache.org' do
24
24
  issue_management 'https://github.com/ruby-processing/PiCrate/issues', 'Github'
25
25
  # Need to update to jogl 2.4.1 as soon as available, then make a dependency
26
26
  properties('jogl.version' => '2.3.2',
27
+ 'batik.version' => '1.14',
27
28
  'itextpdf.version' => '5.5.13.2',
28
29
  'jruby.api' => 'http://jruby.org/apidocs/',
29
30
  'source.directory' => 'src',
30
31
  'processing.api' => 'http://processing.github.io/processing-javadocs/core/',
31
32
  'picrate.basedir' => '${project.basedir}',
32
- 'project.build.sourceEncoding' => 'utf-8',
33
+ 'project.build.sourceEncoding' => 'UTF-8',
33
34
  'polyglot.dump.pom' => 'pom.xml')
34
35
 
35
36
  pom 'org.jruby:jruby:9.2.16.0'
36
37
  jar 'org.jogamp.jogl:jogl-all:${jogl.version}'
37
38
  jar 'org.jogamp.gluegen:gluegen-rt-main:${jogl.version}'
38
39
  jar 'org.processing:video:3.0.2'
40
+ jar 'org.apache.xmlgraphics:batik-all:${batik.version}'
39
41
  jar 'com.itextpdf:itextpdf:${itextpdf.version}'
40
42
  end
41
43
 
@@ -44,13 +46,19 @@ overrides do
44
46
  plugin :dependency, '3.1.2' do
45
47
  execute_goals( id: 'default-cli',
46
48
  artifactItems:[
47
- { groupId: 'com.itextpdf',
48
- artifactId: 'itextpdf',
49
- version: '${itextpdf.version}',
50
- type: 'jar',
51
- outputDirectory: '${picrate.basedir}/lib'
52
- }
53
- ]
49
+ { groupId: 'com.itextpdf',
50
+ artifactId: 'itextpdf',
51
+ version: '${itextpdf.version}',
52
+ type: 'jar',
53
+ outputDirectory: '${picrate.basedir}/library/pdf'
54
+ },
55
+ { groupId: 'org.apache.xmlgraphics',
56
+ artifactId: 'batik-all',
57
+ version: '${batik.version}',
58
+ type: 'jar',
59
+ outputDirectory: '${picrate.basedir}/library/svg'
60
+ }
61
+ ]
54
62
  )
55
63
  end
56
64
  plugin(:compiler, '3.8.1',
data/pom.xml CHANGED
@@ -11,7 +11,7 @@ DO NOT MODIFY - GENERATED CODE
11
11
  <modelVersion>4.0.0</modelVersion>
12
12
  <groupId>ruby-processing</groupId>
13
13
  <artifactId>picrate</artifactId>
14
- <version>2.3.0</version>
14
+ <version>2.4.0</version>
15
15
  <name>picrate</name>
16
16
  <description>An integrated processing-core (somewhat hacked), with additional java code for a jruby version of processing.</description>
17
17
  <url>http://maven.apache.org</url>
@@ -64,13 +64,14 @@ DO NOT MODIFY - GENERATED CODE
64
64
  <url>https://github.com/ruby-processing/PiCrate/issues</url>
65
65
  </issueManagement>
66
66
  <properties>
67
+ <batik.version>1.14</batik.version>
67
68
  <itextpdf.version>5.5.13.2</itextpdf.version>
68
69
  <jogl.version>2.3.2</jogl.version>
69
70
  <jruby.api>http://jruby.org/apidocs/</jruby.api>
70
71
  <picrate.basedir>${project.basedir}</picrate.basedir>
71
72
  <polyglot.dump.pom>pom.xml</polyglot.dump.pom>
72
73
  <processing.api>http://processing.github.io/processing-javadocs/core/</processing.api>
73
- <project.build.sourceEncoding>utf-8</project.build.sourceEncoding>
74
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
74
75
  <source.directory>src</source.directory>
75
76
  </properties>
76
77
  <dependencies>
@@ -95,6 +96,11 @@ DO NOT MODIFY - GENERATED CODE
95
96
  <artifactId>video</artifactId>
96
97
  <version>3.0.2</version>
97
98
  </dependency>
99
+ <dependency>
100
+ <groupId>org.apache.xmlgraphics</groupId>
101
+ <artifactId>batik-all</artifactId>
102
+ <version>${batik.version}</version>
103
+ </dependency>
98
104
  <dependency>
99
105
  <groupId>com.itextpdf</groupId>
100
106
  <artifactId>itextpdf</artifactId>
@@ -140,7 +146,14 @@ DO NOT MODIFY - GENERATED CODE
140
146
  <artifactId>itextpdf</artifactId>
141
147
  <version>${itextpdf.version}</version>
142
148
  <type>jar</type>
143
- <outputDirectory>${picrate.basedir}/lib</outputDirectory>
149
+ <outputDirectory>${picrate.basedir}/library/pdf</outputDirectory>
150
+ </artifactItem>
151
+ <artifactItem>
152
+ <groupId>org.apache.xmlgraphics</groupId>
153
+ <artifactId>batik-all</artifactId>
154
+ <version>${batik.version}</version>
155
+ <type>jar</type>
156
+ <outputDirectory>${picrate.basedir}/library/svg</outputDirectory>
144
157
  </artifactItem>
145
158
  </artifactItems>
146
159
  </configuration>
@@ -0,0 +1,127 @@
1
+ /*
2
+ * To change this license header, choose License Headers in Project Properties.
3
+ * To change this template file, choose Tools | Templates
4
+ * and open the template in the editor.
5
+ */
6
+ package monkstone;
7
+
8
+ import monkstone.noise.OpenSimplex2F;
9
+ import org.jruby.Ruby;
10
+ import org.jruby.RubyFixnum;
11
+ import org.jruby.RubyFloat;
12
+ import org.jruby.RubyModule;
13
+ import org.jruby.anno.JRubyMethod;
14
+ import org.jruby.anno.JRubyModule;
15
+ import org.jruby.runtime.ThreadContext;
16
+ import org.jruby.runtime.builtin.IRubyObject;
17
+
18
+ /**
19
+ *
20
+ * @author Martin Prout
21
+ */
22
+ @JRubyModule(name = "FastNoise")
23
+ public class FastNoiseModuleJava {
24
+
25
+ static OpenSimplex2F ng = new OpenSimplex2F(System.currentTimeMillis());
26
+
27
+ /**
28
+ *
29
+ * @param runtime Ruby
30
+ */
31
+ public static void createNoiseModule(Ruby runtime) {
32
+ RubyModule noiseModule = runtime.defineModule("FastNoise");
33
+ noiseModule.defineAnnotatedMethods(FastNoiseModuleJava.class);
34
+ }
35
+
36
+ /**
37
+ *
38
+ * @param context ThreadContext
39
+ * @param recv IRubyObject
40
+ * @param args array of numeric values
41
+ * @return mapped value RubyFloat
42
+ */
43
+ @JRubyMethod(name = "tnoise", rest = true, module = true)
44
+ public static IRubyObject terrainNoiseImpl(ThreadContext context, IRubyObject recv, IRubyObject[] args) {
45
+ double result = 0;
46
+ double one;
47
+ double two;
48
+ double three;
49
+ double four;
50
+ switch (args.length) {
51
+ case 2:
52
+ two = (args[1] instanceof RubyFloat) ? ((RubyFloat) args[1]).getValue() : ((RubyFixnum) args[1]).getDoubleValue();
53
+ one = (args[0] instanceof RubyFloat) ? ((RubyFloat) args[0]).getValue() : ((RubyFixnum) args[0]).getDoubleValue();
54
+ result = ng.noise2_XBeforeY(one, two);
55
+ break;
56
+ case 3:
57
+ three = (args[2] instanceof RubyFloat) ? ((RubyFloat) args[2]).getValue() : ((RubyFixnum) args[2]).getDoubleValue();
58
+ two = (args[1] instanceof RubyFloat) ? ((RubyFloat) args[1]).getValue() : ((RubyFixnum) args[1]).getDoubleValue();
59
+ one = (args[0] instanceof RubyFloat) ? ((RubyFloat) args[0]).getValue() : ((RubyFixnum) args[0]).getDoubleValue();
60
+ result = ng.noise3_XYBeforeZ(one, two, three);
61
+ break;
62
+ case 4:
63
+ four = (args[3] instanceof RubyFloat) ? ((RubyFloat) args[3]).getValue() : ((RubyFixnum) args[3]).getDoubleValue();
64
+ three = (args[2] instanceof RubyFloat) ? ((RubyFloat) args[2]).getValue() : ((RubyFixnum) args[2]).getDoubleValue();
65
+ two = (args[1] instanceof RubyFloat) ? ((RubyFloat) args[1]).getValue() : ((RubyFixnum) args[1]).getDoubleValue();
66
+ one = (args[0] instanceof RubyFloat) ? ((RubyFloat) args[0]).getValue() : ((RubyFixnum) args[0]).getDoubleValue();
67
+ result = ng.noise4_XYBeforeZW(one, two, three, four);
68
+ break;
69
+ default:
70
+ throw new RuntimeException("Min 2D Max 4D Noise");
71
+ }
72
+ return RubyFloat.newFloat(context.runtime, result);
73
+ }
74
+
75
+ /**
76
+ *
77
+ * @param context ThreadContext
78
+ * @param recv IRubyObject
79
+ * @param args array of numeric values
80
+ * @return mapped value RubyFloat
81
+ */
82
+ @JRubyMethod(name = "noise", rest = true, module = true)
83
+ public static IRubyObject noiseImpl(ThreadContext context, IRubyObject recv, IRubyObject[] args) {
84
+ double result = 0;
85
+ double one;
86
+ double two;
87
+ double three;
88
+ double four;
89
+ switch (args.length) {
90
+ case 1:
91
+ one = (args[0] instanceof RubyFloat) ? ((RubyFloat) args[0]).getValue() : ((RubyFixnum) args[0]).getDoubleValue();
92
+ result = ng.noise2(one, 0);
93
+ break;
94
+ case 2:
95
+ two = (args[1] instanceof RubyFloat) ? ((RubyFloat) args[1]).getValue() : ((RubyFixnum) args[1]).getDoubleValue();
96
+ one = (args[0] instanceof RubyFloat) ? ((RubyFloat) args[0]).getValue() : ((RubyFixnum) args[0]).getDoubleValue();
97
+ result = ng.noise2(one, two);
98
+ break;
99
+ case 3:
100
+ three = (args[2] instanceof RubyFloat) ? ((RubyFloat) args[2]).getValue() : ((RubyFixnum) args[2]).getDoubleValue();
101
+ two = (args[1] instanceof RubyFloat) ? ((RubyFloat) args[1]).getValue() : ((RubyFixnum) args[1]).getDoubleValue();
102
+ one = (args[0] instanceof RubyFloat) ? ((RubyFloat) args[0]).getValue() : ((RubyFixnum) args[0]).getDoubleValue();
103
+ result = ng.noise3_Classic(one, two, three);
104
+ break;
105
+ case 4:
106
+ four = (args[3] instanceof RubyFloat) ? ((RubyFloat) args[3]).getValue() : ((RubyFixnum) args[3]).getDoubleValue();
107
+ three = (args[2] instanceof RubyFloat) ? ((RubyFloat) args[2]).getValue() : ((RubyFixnum) args[2]).getDoubleValue();
108
+ two = (args[1] instanceof RubyFloat) ? ((RubyFloat) args[1]).getValue() : ((RubyFixnum) args[1]).getDoubleValue();
109
+ one = (args[0] instanceof RubyFloat) ? ((RubyFloat) args[0]).getValue() : ((RubyFixnum) args[0]).getDoubleValue();
110
+ result = ng.noise4_Classic(one, two, three, four);
111
+ break;
112
+ default:
113
+ throw new RuntimeException("Maximum of 4D Noise");
114
+ }
115
+ return RubyFloat.newFloat(context.runtime, result);
116
+ }
117
+ // @JRubyMethod(name = "noise_seed", rest = true, module = true)
118
+ // public static IRubyObject noiseSeedImpl(ThreadContext context, IRubyObject recv, IRubyObject arg) {
119
+ // long seed;
120
+ // if (arg instanceof RubyNumeric) {
121
+ // seed = ((RubyNumeric) arg).getLongValue();
122
+ // ng = new OpenSimplex2F(seed);
123
+ // return RubyBoolean.newBoolean(context.runtime, true);
124
+ // }
125
+ // return RubyBoolean.newBoolean(context.runtime, false);
126
+ // }
127
+ }
@@ -30,6 +30,8 @@ public class PicrateLibrary implements Library{
30
30
  */
31
31
  public static void load(final Ruby runtime) {
32
32
  MathToolModule.createMathToolModule(runtime);
33
+ FastNoiseModuleJava.createNoiseModule(runtime);
34
+ SmoothNoiseModuleJava.createNoiseModule(runtime);
33
35
  Deglut.createDeglut(runtime);
34
36
  Vec2.createVec2(runtime);
35
37
  Vec3.createVec3(runtime);
@@ -0,0 +1,127 @@
1
+ /*
2
+ * To change this license header, choose License Headers in Project Properties.
3
+ * To change this template file, choose Tools | Templates
4
+ * and open the template in the editor.
5
+ */
6
+ package monkstone;
7
+
8
+ import monkstone.noise.OpenSimplex2S;
9
+ import org.jruby.Ruby;
10
+ import org.jruby.RubyFixnum;
11
+ import org.jruby.RubyFloat;
12
+ import org.jruby.RubyModule;
13
+ import org.jruby.anno.JRubyMethod;
14
+ import org.jruby.anno.JRubyModule;
15
+ import org.jruby.runtime.ThreadContext;
16
+ import org.jruby.runtime.builtin.IRubyObject;
17
+
18
+ /**
19
+ *
20
+ * @author Martin Prout
21
+ */
22
+ @JRubyModule(name = "SmoothNoise")
23
+ public class SmoothNoiseModuleJava {
24
+
25
+ static OpenSimplex2S ng = new OpenSimplex2S(System.currentTimeMillis());
26
+
27
+ /**
28
+ *
29
+ * @param runtime Ruby
30
+ */
31
+ public static void createNoiseModule(Ruby runtime) {
32
+ RubyModule noiseModule = runtime.defineModule("SmoothNoise");
33
+ noiseModule.defineAnnotatedMethods(SmoothNoiseModuleJava.class);
34
+ }
35
+
36
+ /**
37
+ *
38
+ * @param context ThreadContext
39
+ * @param recv IRubyObject
40
+ * @param args array of numeric values
41
+ * @return mapped value RubyFloat
42
+ */
43
+ @JRubyMethod(name = "tnoise", rest = true, module = true)
44
+ public static IRubyObject terrainNoiseImpl(ThreadContext context, IRubyObject recv, IRubyObject[] args) {
45
+ double result = 0;
46
+ double one;
47
+ double two;
48
+ double three;
49
+ double four;
50
+ switch (args.length) {
51
+ case 2:
52
+ two = (args[1] instanceof RubyFloat) ? ((RubyFloat) args[1]).getValue() : ((RubyFixnum) args[1]).getDoubleValue();
53
+ one = (args[0] instanceof RubyFloat) ? ((RubyFloat) args[0]).getValue() : ((RubyFixnum) args[0]).getDoubleValue();
54
+ result = ng.noise2_XBeforeY(one, two);
55
+ break;
56
+ case 3:
57
+ three = (args[2] instanceof RubyFloat) ? ((RubyFloat) args[2]).getValue() : ((RubyFixnum) args[2]).getDoubleValue();
58
+ two = (args[1] instanceof RubyFloat) ? ((RubyFloat) args[1]).getValue() : ((RubyFixnum) args[1]).getDoubleValue();
59
+ one = (args[0] instanceof RubyFloat) ? ((RubyFloat) args[0]).getValue() : ((RubyFixnum) args[0]).getDoubleValue();
60
+ result = ng.noise3_XYBeforeZ(one, two, three);
61
+ break;
62
+ case 4:
63
+ four = (args[3] instanceof RubyFloat) ? ((RubyFloat) args[3]).getValue() : ((RubyFixnum) args[3]).getDoubleValue();
64
+ three = (args[2] instanceof RubyFloat) ? ((RubyFloat) args[2]).getValue() : ((RubyFixnum) args[2]).getDoubleValue();
65
+ two = (args[1] instanceof RubyFloat) ? ((RubyFloat) args[1]).getValue() : ((RubyFixnum) args[1]).getDoubleValue();
66
+ one = (args[0] instanceof RubyFloat) ? ((RubyFloat) args[0]).getValue() : ((RubyFixnum) args[0]).getDoubleValue();
67
+ result = ng.noise4_XYBeforeZW(one, two, three, four);
68
+ break;
69
+ default:
70
+ throw new RuntimeException("Min 2D Max 4D Noise");
71
+ }
72
+ return RubyFloat.newFloat(context.runtime, result);
73
+ }
74
+
75
+ /**
76
+ *
77
+ * @param context ThreadContext
78
+ * @param recv IRubyObject
79
+ * @param args array of numeric values
80
+ * @return mapped value RubyFloat
81
+ */
82
+ @JRubyMethod(name = "noise", rest = true, module = true)
83
+ public static IRubyObject noiseImpl(ThreadContext context, IRubyObject recv, IRubyObject[] args) {
84
+ double result = 0;
85
+ double one;
86
+ double two;
87
+ double three;
88
+ double four;
89
+ switch (args.length) {
90
+ case 1:
91
+ one = (args[0] instanceof RubyFloat) ? ((RubyFloat) args[0]).getValue() : ((RubyFixnum) args[0]).getDoubleValue();
92
+ result = ng.noise2(one, 0);
93
+ break;
94
+ case 2:
95
+ two = (args[1] instanceof RubyFloat) ? ((RubyFloat) args[1]).getValue() : ((RubyFixnum) args[1]).getDoubleValue();
96
+ one = (args[0] instanceof RubyFloat) ? ((RubyFloat) args[0]).getValue() : ((RubyFixnum) args[0]).getDoubleValue();
97
+ result = ng.noise2(one, two);
98
+ break;
99
+ case 3:
100
+ three = (args[2] instanceof RubyFloat) ? ((RubyFloat) args[2]).getValue() : ((RubyFixnum) args[2]).getDoubleValue();
101
+ two = (args[1] instanceof RubyFloat) ? ((RubyFloat) args[1]).getValue() : ((RubyFixnum) args[1]).getDoubleValue();
102
+ one = (args[0] instanceof RubyFloat) ? ((RubyFloat) args[0]).getValue() : ((RubyFixnum) args[0]).getDoubleValue();
103
+ result = ng.noise3_Classic(one, two, three);
104
+ break;
105
+ case 4:
106
+ four = (args[3] instanceof RubyFloat) ? ((RubyFloat) args[3]).getValue() : ((RubyFixnum) args[3]).getDoubleValue();
107
+ three = (args[2] instanceof RubyFloat) ? ((RubyFloat) args[2]).getValue() : ((RubyFixnum) args[2]).getDoubleValue();
108
+ two = (args[1] instanceof RubyFloat) ? ((RubyFloat) args[1]).getValue() : ((RubyFixnum) args[1]).getDoubleValue();
109
+ one = (args[0] instanceof RubyFloat) ? ((RubyFloat) args[0]).getValue() : ((RubyFixnum) args[0]).getDoubleValue();
110
+ result = ng.noise4_Classic(one, two, three, four);
111
+ break;
112
+ default:
113
+ throw new RuntimeException("Maximum of 4D Noise");
114
+ }
115
+ return RubyFloat.newFloat(context.runtime, result);
116
+ }
117
+ // @JRubyMethod(name = "noise_seed", rest = true, module = true)
118
+ // public static IRubyObject noiseSeedImpl(ThreadContext context, IRubyObject recv, IRubyObject arg) {
119
+ // long seed;
120
+ // if (arg instanceof RubyNumeric) {
121
+ // seed = ((RubyNumeric) arg).getLongValue();
122
+ // ng = new OpenSimplex2S(seed);
123
+ // return RubyBoolean.newBoolean(context.runtime, true);
124
+ // }
125
+ // return RubyBoolean.newBoolean(context.runtime, false);
126
+ // }
127
+ }