propane 3.6.0-java → 3.10.0-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (161) hide show
  1. checksums.yaml +4 -4
  2. data/.mvn/extensions.xml +1 -1
  3. data/.travis.yml +1 -1
  4. data/CHANGELOG.md +5 -1
  5. data/README.md +6 -13
  6. data/Rakefile +7 -6
  7. data/lib/java/japplemenubar/JAppleMenuBar.java +88 -0
  8. data/lib/java/japplemenubar/libjAppleMenuBar.jnilib +0 -0
  9. data/lib/java/monkstone/ColorUtil.java +127 -0
  10. data/lib/java/monkstone/MathToolModule.java +287 -0
  11. data/lib/java/monkstone/PropaneLibrary.java +46 -0
  12. data/lib/java/monkstone/core/LibraryProxy.java +136 -0
  13. data/lib/java/monkstone/fastmath/DegLutTables.java +111 -0
  14. data/lib/java/monkstone/fastmath/Deglut.java +71 -0
  15. data/lib/java/monkstone/fastmath/package-info.java +6 -0
  16. data/lib/java/monkstone/filechooser/Chooser.java +39 -0
  17. data/lib/java/monkstone/noise/FastTerrain.java +874 -0
  18. data/lib/java/monkstone/noise/Noise.java +90 -0
  19. data/lib/java/monkstone/noise/NoiseGenerator.java +75 -0
  20. data/lib/java/monkstone/noise/NoiseMode.java +28 -0
  21. data/lib/java/monkstone/noise/OpenSimplex2F.java +881 -0
  22. data/lib/java/monkstone/noise/OpenSimplex2S.java +1106 -0
  23. data/lib/java/monkstone/noise/SmoothTerrain.java +1099 -0
  24. data/lib/java/monkstone/slider/CustomHorizontalSlider.java +164 -0
  25. data/lib/java/monkstone/slider/CustomVerticalSlider.java +178 -0
  26. data/lib/java/monkstone/slider/SimpleHorizontalSlider.java +145 -0
  27. data/lib/java/monkstone/slider/SimpleSlider.java +166 -0
  28. data/lib/java/monkstone/slider/SimpleVerticalSlider.java +157 -0
  29. data/lib/java/monkstone/slider/Slider.java +61 -0
  30. data/lib/java/monkstone/slider/SliderBar.java +245 -0
  31. data/lib/java/monkstone/slider/SliderGroup.java +56 -0
  32. data/lib/java/monkstone/slider/WheelHandler.java +35 -0
  33. data/lib/java/monkstone/vecmath/GfxRender.java +86 -0
  34. data/lib/java/monkstone/vecmath/JRender.java +56 -0
  35. data/lib/java/monkstone/vecmath/ShapeRender.java +87 -0
  36. data/lib/java/monkstone/vecmath/package-info.java +20 -0
  37. data/lib/java/monkstone/vecmath/vec2/Vec2.java +802 -0
  38. data/lib/java/monkstone/vecmath/vec2/package-info.java +6 -0
  39. data/lib/java/monkstone/vecmath/vec3/Vec3.java +727 -0
  40. data/lib/java/monkstone/vecmath/vec3/package-info.java +6 -0
  41. data/lib/java/monkstone/videoevent/CaptureEvent.java +27 -0
  42. data/lib/java/monkstone/videoevent/MovieEvent.java +32 -0
  43. data/lib/java/monkstone/videoevent/package-info.java +20 -0
  44. data/lib/java/processing/awt/PGraphicsJava2D.java +3040 -0
  45. data/lib/java/processing/awt/PImageAWT.java +377 -0
  46. data/lib/java/processing/awt/PShapeJava2D.java +387 -0
  47. data/lib/java/processing/awt/PSurfaceAWT.java +1581 -0
  48. data/lib/java/processing/awt/ShimAWT.java +581 -0
  49. data/lib/java/processing/core/PApplet.java +15156 -0
  50. data/lib/java/processing/core/PConstants.java +523 -0
  51. data/lib/java/processing/core/PFont.java +1126 -0
  52. data/lib/java/processing/core/PGraphics.java +8600 -0
  53. data/lib/java/processing/core/PImage.java +3377 -0
  54. data/lib/java/processing/core/PMatrix.java +208 -0
  55. data/lib/java/processing/core/PMatrix2D.java +562 -0
  56. data/lib/java/processing/core/PMatrix3D.java +890 -0
  57. data/lib/java/processing/core/PShape.java +3561 -0
  58. data/lib/java/processing/core/PShapeOBJ.java +483 -0
  59. data/lib/java/processing/core/PShapeSVG.java +2016 -0
  60. data/lib/java/processing/core/PStyle.java +63 -0
  61. data/lib/java/processing/core/PSurface.java +198 -0
  62. data/lib/java/processing/core/PSurfaceNone.java +431 -0
  63. data/lib/java/processing/core/PVector.java +1066 -0
  64. data/lib/java/processing/core/ThinkDifferent.java +115 -0
  65. data/lib/java/processing/data/DoubleDict.java +850 -0
  66. data/lib/java/processing/data/DoubleList.java +928 -0
  67. data/lib/java/processing/data/FloatDict.java +847 -0
  68. data/lib/java/processing/data/FloatList.java +936 -0
  69. data/lib/java/processing/data/IntDict.java +807 -0
  70. data/lib/java/processing/data/IntList.java +936 -0
  71. data/lib/java/processing/data/JSONArray.java +1260 -0
  72. data/lib/java/processing/data/JSONObject.java +2282 -0
  73. data/lib/java/processing/data/JSONTokener.java +435 -0
  74. data/lib/java/processing/data/LongDict.java +802 -0
  75. data/lib/java/processing/data/LongList.java +937 -0
  76. data/lib/java/processing/data/Sort.java +46 -0
  77. data/lib/java/processing/data/StringDict.java +613 -0
  78. data/lib/java/processing/data/StringList.java +800 -0
  79. data/lib/java/processing/data/Table.java +4936 -0
  80. data/lib/java/processing/data/TableRow.java +198 -0
  81. data/lib/java/processing/data/XML.java +1156 -0
  82. data/lib/java/processing/dxf/RawDXF.java +404 -0
  83. data/lib/java/processing/event/Event.java +125 -0
  84. data/lib/java/processing/event/KeyEvent.java +70 -0
  85. data/lib/java/processing/event/MouseEvent.java +114 -0
  86. data/lib/java/processing/event/TouchEvent.java +57 -0
  87. data/lib/java/processing/javafx/PGraphicsFX2D.java +32 -0
  88. data/lib/java/processing/javafx/PSurfaceFX.java +173 -0
  89. data/lib/java/processing/net/Client.java +744 -0
  90. data/lib/java/processing/net/Server.java +388 -0
  91. data/lib/java/processing/opengl/FontTexture.java +378 -0
  92. data/lib/java/processing/opengl/FrameBuffer.java +513 -0
  93. data/lib/java/processing/opengl/LinePath.java +627 -0
  94. data/lib/java/processing/opengl/LineStroker.java +681 -0
  95. data/lib/java/processing/opengl/PGL.java +3483 -0
  96. data/lib/java/processing/opengl/PGraphics2D.java +615 -0
  97. data/lib/java/processing/opengl/PGraphics3D.java +281 -0
  98. data/lib/java/processing/opengl/PGraphicsOpenGL.java +13753 -0
  99. data/lib/java/processing/opengl/PJOGL.java +2008 -0
  100. data/lib/java/processing/opengl/PShader.java +1484 -0
  101. data/lib/java/processing/opengl/PShapeOpenGL.java +5269 -0
  102. data/lib/java/processing/opengl/PSurfaceJOGL.java +1385 -0
  103. data/lib/java/processing/opengl/Texture.java +1696 -0
  104. data/lib/java/processing/opengl/VertexBuffer.java +88 -0
  105. data/lib/java/processing/opengl/cursors/arrow.png +0 -0
  106. data/lib/java/processing/opengl/cursors/cross.png +0 -0
  107. data/lib/java/processing/opengl/cursors/hand.png +0 -0
  108. data/lib/java/processing/opengl/cursors/license.txt +27 -0
  109. data/lib/java/processing/opengl/cursors/move.png +0 -0
  110. data/lib/java/processing/opengl/cursors/text.png +0 -0
  111. data/lib/java/processing/opengl/cursors/wait.png +0 -0
  112. data/lib/java/processing/opengl/shaders/ColorFrag.glsl +32 -0
  113. data/lib/java/processing/opengl/shaders/ColorVert.glsl +34 -0
  114. data/lib/java/processing/opengl/shaders/LightFrag.glsl +33 -0
  115. data/lib/java/processing/opengl/shaders/LightVert.glsl +151 -0
  116. data/lib/java/processing/opengl/shaders/LineFrag.glsl +32 -0
  117. data/lib/java/processing/opengl/shaders/LineVert.glsl +100 -0
  118. data/lib/java/processing/opengl/shaders/MaskFrag.glsl +40 -0
  119. data/lib/java/processing/opengl/shaders/PointFrag.glsl +32 -0
  120. data/lib/java/processing/opengl/shaders/PointVert.glsl +56 -0
  121. data/lib/java/processing/opengl/shaders/TexFrag.glsl +37 -0
  122. data/lib/java/processing/opengl/shaders/TexLightFrag.glsl +37 -0
  123. data/lib/java/processing/opengl/shaders/TexLightVert.glsl +157 -0
  124. data/lib/java/processing/opengl/shaders/TexVert.glsl +38 -0
  125. data/lib/java/processing/pdf/PGraphicsPDF.java +581 -0
  126. data/lib/java/processing/svg/PGraphicsSVG.java +378 -0
  127. data/lib/propane/app.rb +9 -10
  128. data/lib/propane/runner.rb +10 -12
  129. data/lib/propane/version.rb +1 -1
  130. data/library/pdf/pdf.rb +7 -0
  131. data/library/svg/svg.rb +7 -0
  132. data/mvnw +3 -3
  133. data/mvnw.cmd +2 -2
  134. data/pom.rb +30 -3
  135. data/pom.xml +54 -3
  136. data/propane.gemspec +7 -3
  137. data/src/main/java/monkstone/FastNoiseModuleJava.java +127 -0
  138. data/src/main/java/monkstone/MathToolModule.java +30 -30
  139. data/src/main/java/monkstone/PropaneLibrary.java +2 -0
  140. data/src/main/java/monkstone/SmoothNoiseModuleJava.java +127 -0
  141. data/src/main/java/monkstone/fastmath/DegLutTables.java +111 -0
  142. data/src/main/java/monkstone/fastmath/Deglut.java +6 -56
  143. data/src/main/java/monkstone/filechooser/Chooser.java +1 -1
  144. data/src/main/java/monkstone/noise/OpenSimplex2F.java +813 -0
  145. data/src/main/java/monkstone/noise/OpenSimplex2S.java +1138 -0
  146. data/src/main/java/monkstone/slider/WheelHandler.java +1 -1
  147. data/src/main/java/monkstone/vecmath/JRender.java +6 -6
  148. data/src/main/java/monkstone/vecmath/vec2/Vec2.java +20 -19
  149. data/src/main/java/monkstone/vecmath/vec3/Vec3.java +12 -12
  150. data/src/main/java/processing/awt/PGraphicsJava2D.java +11 -3
  151. data/src/main/java/processing/core/PApplet.java +13242 -13374
  152. data/src/main/java/processing/core/PConstants.java +155 -163
  153. data/src/main/java/processing/core/PGraphics.java +118 -111
  154. data/src/main/java/processing/opengl/PJOGL.java +6 -5
  155. data/src/main/java/processing/pdf/PGraphicsPDF.java +581 -0
  156. data/src/main/java/processing/svg/PGraphicsSVG.java +378 -0
  157. data/test/deglut_spec_test.rb +2 -2
  158. data/vendors/Rakefile +1 -1
  159. metadata +146 -17
  160. data/library/simplex_noise/simplex_noise.rb +0 -5
  161. data/src/main/java/monkstone/noise/SimplexNoise.java +0 -436
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Propane
4
- VERSION = '3.6.0'
4
+ VERSION = '3.10.0'
5
5
  end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ # @TODO usage
4
+ class Propane::App
5
+ require_relative 'itextpdf-5.5.13.2.jar'
6
+ java_import Java::ProcessingPdf::PGraphicsPDF
7
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ # @TODO usage
4
+ class Propane::App
5
+ require_relative 'batik-all-1.14.jar'
6
+ java_import Java::ProcessingSvg::PGraphicsSVG
7
+ end
data/mvnw CHANGED
@@ -212,9 +212,9 @@ else
212
212
  echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..."
213
213
  fi
214
214
  if [ -n "$MVNW_REPOURL" ]; then
215
- jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.jar"
215
+ jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
216
216
  else
217
- jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.jar"
217
+ jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
218
218
  fi
219
219
  while IFS="=" read key value; do
220
220
  case "$key" in (wrapperUrl) jarUrl="$value"; break ;;
@@ -246,7 +246,7 @@ else
246
246
  else
247
247
  curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f
248
248
  fi
249
-
249
+
250
250
  else
251
251
  if [ "$MVNW_VERBOSE" = true ]; then
252
252
  echo "Falling back to using Java to download"
data/mvnw.cmd CHANGED
@@ -120,7 +120,7 @@ SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
120
120
  set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
121
121
  set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
122
122
 
123
- set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.jar"
123
+ set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
124
124
 
125
125
  FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
126
126
  IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B
@@ -134,7 +134,7 @@ if exist %WRAPPER_JAR% (
134
134
  )
135
135
  ) else (
136
136
  if not "%MVNW_REPOURL%" == "" (
137
- SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.jar"
137
+ SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
138
138
  )
139
139
  if "%MVNW_VERBOSE%" == "true" (
140
140
  echo Couldn't find %WRAPPER_JAR%, downloading it ...
data/pom.rb CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  project 'propane', 'https://github.com/monkstone/propane' do
4
4
  model_version '4.0.0'
5
- id 'propane:propane:3.6.0'
5
+ id 'propane:propane:3.10.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.'
@@ -44,18 +44,41 @@ project 'propane', 'https://github.com/monkstone/propane' do
44
44
  'polyglot.dump.pom' => 'pom.xml',
45
45
  'project.build.sourceEncoding' => 'utf-8',
46
46
  'jogl.version' => '2.3.2', # for compiling actual included 2.4.0-rc
47
+ 'batik.version' => '1.14',
48
+ 'itextpdf.version' => '5.5.13.2',
47
49
  'jruby.api' => 'http://jruby.org/apidocs/')
48
50
 
49
- pom 'org.jruby:jruby:9.2.14.0'
51
+ pom 'org.jruby:jruby:9.2.17.0'
52
+ jar 'org.apache.xmlgraphics:batik-all:${batik.version}'
53
+ jar 'com.itextpdf:itextpdf:${itextpdf.version}'
50
54
  jar 'org.processing:video:3.3.7' # only for compiling
51
55
  jar 'org.jogamp.jogl:jogl-all:${jogl.version}'
52
56
  jar 'org.jogamp.gluegen:gluegen-rt-main:${jogl.version}'
53
57
 
54
58
  overrides do
59
+
55
60
  plugin('org.codehaus.mojo:versions-maven-plugin:2.7',
56
61
  'generateBackupPoms' => 'false')
57
62
  plugin(:compiler, '3.8.1',
58
63
  'release' => '11')
64
+ plugin :dependency, '3.1.2' do
65
+ execute_goals( id: 'default-cli',
66
+ artifactItems:[
67
+ { groupId: 'com.itextpdf',
68
+ artifactId: 'itextpdf',
69
+ version: '${itextpdf.version}',
70
+ type: 'jar',
71
+ outputDirectory: '${propane.basedir}/library/pdf'
72
+ },
73
+ { groupId: 'org.apache.xmlgraphics',
74
+ artifactId: 'batik-all',
75
+ version: '${batik.version}',
76
+ type: 'jar',
77
+ outputDirectory: '${propane.basedir}/library/svg'
78
+ }
79
+ ]
80
+ )
81
+ end
59
82
  plugin(:javadoc, '3.2.0',
60
83
  'detectOfflineLinks' => 'false',
61
84
  'links' => ['${jruby.api}',
@@ -65,7 +88,8 @@ project 'propane', 'https://github.com/monkstone/propane' do
65
88
  'manifestEntries' => {
66
89
  'Automatic-Module-Name' => 'processing.core'
67
90
  }
68
- })
91
+ })
92
+ plugin('org.apache.maven.plugins:maven-pmd-plugin:3.14.0')
69
93
  end
70
94
  build do
71
95
  resource do
@@ -80,3 +104,6 @@ project 'propane', 'https://github.com/monkstone/propane' do
80
104
  end
81
105
  end
82
106
  end
107
+ reporting do
108
+ plugin('org.apache.maven.plugins:maven-jxr-plugin:2.3')
109
+ end
data/pom.xml CHANGED
@@ -2,7 +2,7 @@
2
2
  <!--
3
3
 
4
4
 
5
- DO NOT MODIFIY - GENERATED CODE
5
+ DO NOT MODIFY - GENERATED CODE
6
6
 
7
7
 
8
8
  -->
@@ -11,7 +11,7 @@ DO NOT MODIFIY - GENERATED CODE
11
11
  <modelVersion>4.0.0</modelVersion>
12
12
  <groupId>propane</groupId>
13
13
  <artifactId>propane</artifactId>
14
- <version>3.6.0</version>
14
+ <version>3.10.0</version>
15
15
  <name>propane</name>
16
16
  <description>An integrated processing-core (somewhat hacked), with additional java code for a jruby version of processing.</description>
17
17
  <url>https://github.com/monkstone/propane</url>
@@ -62,6 +62,8 @@ DO NOT MODIFIY - GENERATED CODE
62
62
  <url>https://github.com/ruby-processing/propane/issues</url>
63
63
  </issueManagement>
64
64
  <properties>
65
+ <batik.version>1.14</batik.version>
66
+ <itextpdf.version>5.5.13.2</itextpdf.version>
65
67
  <jogl.version>2.3.2</jogl.version>
66
68
  <jruby.api>http://jruby.org/apidocs/</jruby.api>
67
69
  <polyglot.dump.pom>pom.xml</polyglot.dump.pom>
@@ -74,9 +76,19 @@ DO NOT MODIFIY - GENERATED CODE
74
76
  <dependency>
75
77
  <groupId>org.jruby</groupId>
76
78
  <artifactId>jruby</artifactId>
77
- <version>9.2.14.0</version>
79
+ <version>9.2.17.0</version>
78
80
  <type>pom</type>
79
81
  </dependency>
82
+ <dependency>
83
+ <groupId>org.apache.xmlgraphics</groupId>
84
+ <artifactId>batik-all</artifactId>
85
+ <version>${batik.version}</version>
86
+ </dependency>
87
+ <dependency>
88
+ <groupId>com.itextpdf</groupId>
89
+ <artifactId>itextpdf</artifactId>
90
+ <version>${itextpdf.version}</version>
91
+ </dependency>
80
92
  <dependency>
81
93
  <groupId>org.processing</groupId>
82
94
  <artifactId>video</artifactId>
@@ -130,6 +142,33 @@ DO NOT MODIFIY - GENERATED CODE
130
142
  <release>11</release>
131
143
  </configuration>
132
144
  </plugin>
145
+ <plugin>
146
+ <artifactId>maven-dependency-plugin</artifactId>
147
+ <version>3.1.2</version>
148
+ <executions>
149
+ <execution>
150
+ <id>default-cli</id>
151
+ <configuration>
152
+ <artifactItems>
153
+ <artifactItem>
154
+ <groupId>com.itextpdf</groupId>
155
+ <artifactId>itextpdf</artifactId>
156
+ <version>${itextpdf.version}</version>
157
+ <type>jar</type>
158
+ <outputDirectory>${propane.basedir}/library/pdf</outputDirectory>
159
+ </artifactItem>
160
+ <artifactItem>
161
+ <groupId>org.apache.xmlgraphics</groupId>
162
+ <artifactId>batik-all</artifactId>
163
+ <version>${batik.version}</version>
164
+ <type>jar</type>
165
+ <outputDirectory>${propane.basedir}/library/svg</outputDirectory>
166
+ </artifactItem>
167
+ </artifactItems>
168
+ </configuration>
169
+ </execution>
170
+ </executions>
171
+ </plugin>
133
172
  <plugin>
134
173
  <artifactId>maven-javadoc-plugin</artifactId>
135
174
  <version>3.2.0</version>
@@ -152,7 +191,19 @@ DO NOT MODIFIY - GENERATED CODE
152
191
  </archive>
153
192
  </configuration>
154
193
  </plugin>
194
+ <plugin>
195
+ <artifactId>maven-pmd-plugin</artifactId>
196
+ <version>3.14.0</version>
197
+ </plugin>
155
198
  </plugins>
156
199
  </pluginManagement>
157
200
  </build>
201
+ <reporting>
202
+ <plugins>
203
+ <plugin>
204
+ <artifactId>maven-jxr-plugin</artifactId>
205
+ <version>2.3</version>
206
+ </plugin>
207
+ </plugins>
208
+ </reporting>
158
209
  </project>
data/propane.gemspec CHANGED
@@ -11,7 +11,7 @@ Gem::Specification.new do |gem|
11
11
  gem.email = ['mamba2928@yahoo.co.uk']
12
12
  gem.licenses = %w[GPL-3.0 LGPL-2.0]
13
13
  gem.description = <<-EOS
14
- A batteries included version of processing in ruby targetting jdk11.
14
+ A batteries included version of processing in ruby targetting jdk11+.
15
15
  EOS
16
16
  gem.summary = 'ruby implementation of processing-4.0 on MacOS, linux and windows (64bit only)'
17
17
  gem.homepage = 'https://ruby-processing.github.io/propane/'
@@ -21,15 +21,19 @@ Gem::Specification.new do |gem|
21
21
  gem.files << 'lib/jogl-all.jar'
22
22
  gem.files << 'lib/gluegen-rt-natives-linux-amd64.jar'
23
23
  gem.files << 'lib/gluegen-rt-natives-macosx-universal.jar'
24
+ # gem.files << 'lib/gluegen-rt-natives-ios-arm64.jar'
24
25
  gem.files << 'lib/gluegen-rt-natives-windows-amd64.jar'
25
26
  gem.files << 'lib/jogl-all-natives-linux-amd64.jar'
26
27
  gem.files << 'lib/jogl-all-natives-macosx-universal.jar'
28
+ # gem.files << 'lib/jogl-all-natives-ios-arm64.jar'
27
29
  gem.files << 'lib/jogl-all-natives-windows-amd64.jar'
30
+ gem.files << 'library/pdf/itextpdf-5.5.13.2.jar'
31
+ gem.files << 'library/svg/batik-all-1.14.jar'
28
32
  gem.executables = gem.files.grep(%r{^bin/}).map { |f| File.basename(f) }
29
33
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
30
- gem.add_development_dependency 'jruby-openssl', '~> 0.1.0', '>=0.1.3'
34
+ gem.add_development_dependency 'jruby-openssl', '~> 0.10', '>=0.10.5'
31
35
  gem.add_development_dependency 'minitest', '~> 5.14'
32
- gem.add_runtime_dependency 'rake', '~> 12.3'
36
+ gem.add_runtime_dependency 'rake', '~> 13.0'
33
37
  gem.add_runtime_dependency 'arcball', '~> 1.0', '>= 1.0.2'
34
38
  gem.require_paths = ['lib']
35
39
  gem.platform = 'java'
@@ -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
+ }
@@ -47,17 +47,17 @@ public class MathToolModule {
47
47
  */
48
48
  @JRubyMethod(name = "map1d", rest = true, module = true)
49
49
  public static IRubyObject mapOneD(ThreadContext context, IRubyObject recv, IRubyObject[] args) {
50
- double value = (args[0] instanceof RubyFloat)
50
+ double value = args[0] instanceof RubyFloat
51
51
  ? ((RubyFloat) args[0]).getValue() : ((RubyFixnum) args[0]).getDoubleValue();
52
52
  RubyRange r1 = (RubyRange) args[1];
53
53
  RubyRange r2 = (RubyRange) args[2];
54
- double first1 = (r1.first(context) instanceof RubyFloat)
54
+ double first1 = r1.first(context) instanceof RubyFloat
55
55
  ? ((RubyFloat) r1.first(context)).getValue() : ((RubyFixnum) r1.first(context)).getDoubleValue();
56
- double first2 = (r2.first(context) instanceof RubyFloat)
56
+ double first2 = r2.first(context) instanceof RubyFloat
57
57
  ? ((RubyFloat) r2.first(context)).getValue() : ((RubyFixnum) r2.first(context)).getDoubleValue();
58
- double last1 = (r1.last(context) instanceof RubyFloat)
58
+ double last1 = r1.last(context) instanceof RubyFloat
59
59
  ? ((RubyFloat) r1.last(context)).getValue() : ((RubyFixnum) r1.last(context)).getDoubleValue();
60
- double last2 = (r2.last(context) instanceof RubyFloat)
60
+ double last2 = r2.last(context) instanceof RubyFloat
61
61
  ? ((RubyFloat) r2.last(context)).getValue() : ((RubyFixnum) r2.last(context)).getDoubleValue();
62
62
  return mapMt(context, value, first1, last1, first2, last2);
63
63
  }
@@ -71,16 +71,16 @@ public class MathToolModule {
71
71
  */
72
72
  @JRubyMethod(name = "constrained_map", rest = true, module = true)
73
73
  public static IRubyObject constrainedMap(ThreadContext context, IRubyObject recv, IRubyObject[] args) {
74
- double value = (args[0] instanceof RubyFloat) ? ((RubyFloat) args[0]).getValue() : ((RubyFixnum) args[0]).getDoubleValue();
74
+ double value = args[0] instanceof RubyFloat ? ((RubyFloat) args[0]).getValue() : ((RubyFixnum) args[0]).getDoubleValue();
75
75
  RubyRange r1 = (RubyRange) args[1];
76
76
  RubyRange r2 = (RubyRange) args[2];
77
- double first1 = (r1.first(context) instanceof RubyFloat)
77
+ double first1 = r1.first(context) instanceof RubyFloat
78
78
  ? ((RubyFloat) r1.first(context)).getValue() : ((RubyFixnum) r1.first(context)).getDoubleValue();
79
- double first2 = (r2.first(context) instanceof RubyFloat)
79
+ double first2 = r2.first(context) instanceof RubyFloat
80
80
  ? ((RubyFloat) r2.first(context)).getValue() : ((RubyFixnum) r2.first(context)).getDoubleValue();
81
- double last1 = (r1.last(context) instanceof RubyFloat)
81
+ double last1 = r1.last(context) instanceof RubyFloat
82
82
  ? ((RubyFloat) r1.last(context)).getValue() : ((RubyFixnum) r1.last(context)).getDoubleValue();
83
- double last2 = (r2.last(context) instanceof RubyFloat)
83
+ double last2 = r2.last(context) instanceof RubyFloat
84
84
  ? ((RubyFloat) r2.last(context)).getValue() : ((RubyFixnum) r2.last(context)).getDoubleValue();
85
85
  double max = Math.max(first1, last1);
86
86
  double min = Math.min(first1, last1);
@@ -102,11 +102,11 @@ public class MathToolModule {
102
102
  */
103
103
  @JRubyMethod(name = "p5map", rest = true, module = true)
104
104
  public static IRubyObject mapProcessing(ThreadContext context, IRubyObject recv, IRubyObject[] args) {
105
- double value = (args[0] instanceof RubyFloat) ? ((RubyFloat) args[0]).getValue() : ((RubyFixnum) args[0]).getDoubleValue();
106
- double first1 = (args[1] instanceof RubyFloat) ? ((RubyFloat) args[1]).getValue() : ((RubyFixnum) args[1]).getDoubleValue();
107
- double first2 = (args[3] instanceof RubyFloat) ? ((RubyFloat) args[3]).getValue() : ((RubyFixnum) args[3]).getDoubleValue();
108
- double last1 = (args[2] instanceof RubyFloat) ? ((RubyFloat) args[2]).getValue() : ((RubyFixnum) args[2]).getDoubleValue();
109
- double last2 = (args[4] instanceof RubyFloat) ? ((RubyFloat) args[4]).getValue() : ((RubyFixnum) args[4]).getDoubleValue();
105
+ double value = args[0] instanceof RubyFloat ? ((RubyFloat) args[0]).getValue() : ((RubyFixnum) args[0]).getDoubleValue();
106
+ double first1 = args[1] instanceof RubyFloat ? ((RubyFloat) args[1]).getValue() : ((RubyFixnum) args[1]).getDoubleValue();
107
+ double first2 = args[3] instanceof RubyFloat ? ((RubyFloat) args[3]).getValue() : ((RubyFixnum) args[3]).getDoubleValue();
108
+ double last1 = args[2] instanceof RubyFloat ? ((RubyFloat) args[2]).getValue() : ((RubyFixnum) args[2]).getDoubleValue();
109
+ double last2 = args[4] instanceof RubyFloat ? ((RubyFloat) args[4]).getValue() : ((RubyFixnum) args[4]).getDoubleValue();
110
110
  return mapMt(context, value, first1, last1, first2, last2);
111
111
  }
112
112
 
@@ -121,16 +121,16 @@ public class MathToolModule {
121
121
  */
122
122
  @JRubyMethod(name = "lerp", rest = true, module = true)
123
123
  public static IRubyObject lerpP(ThreadContext context, IRubyObject recv, IRubyObject[] args) {
124
- double start = (args[0] instanceof RubyFloat) ? ((RubyFloat) args[0]).getValue() : ((RubyFixnum) args[0]).getDoubleValue();
125
- double stop = (args[1] instanceof RubyFloat) ? ((RubyFloat) args[1]).getValue() : ((RubyFixnum) args[1]).getDoubleValue();
126
- double amount = (args[2] instanceof RubyFloat) ? ((RubyFloat) args[2]).getValue() : ((RubyFixnum) args[2]).getDoubleValue();
124
+ double start = args[0] instanceof RubyFloat ? ((RubyFloat) args[0]).getValue() : ((RubyFixnum) args[0]).getDoubleValue();
125
+ double stop = args[1] instanceof RubyFloat ? ((RubyFloat) args[1]).getValue() : ((RubyFixnum) args[1]).getDoubleValue();
126
+ double amount = args[2] instanceof RubyFloat ? ((RubyFloat) args[2]).getValue() : ((RubyFixnum) args[2]).getDoubleValue();
127
127
  if (amount <= 0) {
128
128
  return args[0];
129
129
  }
130
130
  if (amount >= 1.0) {
131
131
  return args[1];
132
132
  }
133
- return context.runtime.newFloat((1 - amount) * start + (stop * amount));
133
+ return context.runtime.newFloat((1 - amount) * start + stop * amount);
134
134
  }
135
135
 
136
136
  /**
@@ -145,9 +145,9 @@ public class MathToolModule {
145
145
  */
146
146
  @JRubyMethod(name = "norm", rest = true, module = true)
147
147
  public static IRubyObject normP(ThreadContext context, IRubyObject recv, IRubyObject[] args) {
148
- double value = (args[0] instanceof RubyFloat) ? ((RubyFloat) args[0]).getValue() : ((RubyFixnum) args[0]).getDoubleValue();
149
- double start = (args[1] instanceof RubyFloat) ? ((RubyFloat) args[1]).getValue() : ((RubyFixnum) args[1]).getDoubleValue();
150
- double stop = (args[2] instanceof RubyFloat) ? ((RubyFloat) args[2]).getValue() : ((RubyFixnum) args[2]).getDoubleValue();
148
+ double value = args[0] instanceof RubyFloat ? ((RubyFloat) args[0]).getValue() : ((RubyFixnum) args[0]).getDoubleValue();
149
+ double start = args[1] instanceof RubyFloat ? ((RubyFloat) args[1]).getValue() : ((RubyFixnum) args[1]).getDoubleValue();
150
+ double stop = args[2] instanceof RubyFloat ? ((RubyFloat) args[2]).getValue() : ((RubyFixnum) args[2]).getDoubleValue();
151
151
  return mapMt(context, value, start, stop, 0, 1.0);
152
152
  }
153
153
 
@@ -163,9 +163,9 @@ public class MathToolModule {
163
163
  @JRubyMethod(name = "norm_strict", rest = true, module = true)
164
164
  public static IRubyObject norm_strict(ThreadContext context, IRubyObject recv, IRubyObject[] args) {
165
165
 
166
- double value = (args[0] instanceof RubyFloat) ? ((RubyFloat) args[0]).getValue() : ((RubyFixnum) args[0]).getDoubleValue();
167
- double start = (args[1] instanceof RubyFloat) ? ((RubyFloat) args[1]).getValue() : ((RubyFixnum) args[1]).getDoubleValue();
168
- double stop = (args[2] instanceof RubyFloat) ? ((RubyFloat) args[2]).getValue() : ((RubyFixnum) args[2]).getDoubleValue();
166
+ double value = args[0] instanceof RubyFloat ? ((RubyFloat) args[0]).getValue() : ((RubyFixnum) args[0]).getDoubleValue();
167
+ double start = args[1] instanceof RubyFloat ? ((RubyFloat) args[1]).getValue() : ((RubyFixnum) args[1]).getDoubleValue();
168
+ double stop = args[2] instanceof RubyFloat ? ((RubyFloat) args[2]).getValue() : ((RubyFixnum) args[2]).getDoubleValue();
169
169
  double max = Math.max(start, stop);
170
170
  double min = Math.min(start, stop);
171
171
  if (value < min) {
@@ -266,14 +266,14 @@ public class MathToolModule {
266
266
  int xDim = (int) args[0].toJava(Integer.class);
267
267
  int yDim = (int) args[1].toJava(Integer.class);
268
268
  int zDim = (int) args[2].toJava(Integer.class);
269
- int xStep = (args.length > 3) ? (int) args[3].toJava(Integer.class) : 1;
270
- int yStep = (args.length > 4) ? (int) args[4].toJava(Integer.class) : 1;
271
- int zStep = (args.length == 6) ? (int) args[5].toJava(Integer.class) : 1;
272
- int dimX = xDim / xStep;
269
+ int xStep = args.length > 3 ? (int) args[3].toJava(Integer.class) : 1;
270
+ int yStep = args.length > 4 ? (int) args[4].toJava(Integer.class) : 1;
271
+ int zStep = args.length == 6 ? (int) args[5].toJava(Integer.class) : 1;
272
+ // int dimX = xDim / xStep;
273
273
  int dimY = yDim / yStep;
274
274
  int dimZ = zDim / zStep;
275
275
  if (block.isGiven()) {
276
- int count = dimX * dimY * dimZ;
276
+ // int count = dimX * dimY * dimZ;
277
277
  for (int x = 0; x < xDim; x += xStep){
278
278
  for (int j = 0; j < (dimZ * dimY); j++){
279
279
  int z = j % dimZ;