picrate 2.3.0-java → 2.5.0-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/CHANGELOG.md +9 -1
- data/Gemfile +1 -1
- data/README.md +2 -2
- data/Rakefile +1 -1
- data/docs/.gitignore +1 -0
- data/docs/_classes/{app_render → gfx_render}/app_render.md +5 -5
- data/docs/_methods/{noise_mode.md → noise_modes.md} +9 -21
- data/docs/_posts/2018-05-06-install_jruby.md +5 -5
- data/docs/_posts/2019-11-11-getting_started_buster.md +1 -1
- data/lib/picrate/app.rb +3 -7
- data/lib/picrate/native_folder.rb +1 -1
- data/lib/picrate/version.rb +1 -1
- data/lib/{picrate-2.3.0.jar → picrate-2.5.0.jar} +0 -0
- data/{lib → library/pdf}/itextpdf-5.5.13.2.jar +0 -0
- data/library/pdf/pdf.rb +1 -0
- data/library/svg/batik-all-1.14.jar +0 -0
- data/library/svg/svg.rb +7 -0
- data/picrate.gemspec +4 -3
- data/pom.rb +19 -10
- data/pom.xml +19 -6
- data/src/main/java/monkstone/FastNoiseModuleJava.java +127 -0
- data/src/main/java/monkstone/PicrateLibrary.java +2 -0
- data/src/main/java/monkstone/SmoothNoiseModuleJava.java +127 -0
- data/src/main/java/monkstone/noise/OpenSimplex2F.java +62 -29
- data/src/main/java/monkstone/noise/OpenSimplex2S.java +1138 -1106
- data/src/main/java/monkstone/vecmath/GfxRender.java +10 -11
- data/src/main/java/monkstone/vecmath/JRender.java +7 -7
- data/src/main/java/monkstone/vecmath/ShapeRender.java +3 -4
- data/src/main/java/monkstone/vecmath/vec2/Vec2.java +28 -40
- data/src/main/java/monkstone/vecmath/vec3/Vec3.java +30 -45
- data/src/main/java/processing/awt/PImageAWT.java +1 -1
- data/src/main/java/processing/awt/ShimAWT.java +1 -1
- data/src/main/java/processing/core/PApplet.java +1 -92
- data/src/main/java/processing/core/PImage.java +14 -14
- data/src/main/java/processing/opengl/PShader.java +0 -6
- data/src/main/java/processing/pdf/PGraphicsPDF.java +61 -139
- data/src/main/java/processing/svg/PGraphicsSVG.java +378 -0
- data/test/noise_test.rb +17 -0
- data/test/respond_to_test.rb +0 -1
- data/test/test_helper.rb +1 -1
- data/vendors/Rakefile +1 -1
- metadata +21 -32
- data/src/main/java/japplemenubar/JAppleMenuBar.java +0 -96
- data/src/main/java/japplemenubar/libjAppleMenuBar.jnilib +0 -0
- data/src/main/java/monkstone/complex/JComplex.java +0 -252
- data/src/main/java/monkstone/noise/FastTerrain.java +0 -874
- data/src/main/java/monkstone/noise/Noise.java +0 -90
- data/src/main/java/monkstone/noise/NoiseGenerator.java +0 -75
- data/src/main/java/monkstone/noise/NoiseMode.java +0 -28
- data/src/main/java/monkstone/noise/SmoothTerrain.java +0 -1099
- data/src/main/java/monkstone/vecmath/AppRender.java +0 -88
- data/src/main/java/monkstone/vecmath/package-info.java +0 -20
- data/src/main/java/monkstone/vecmath/vec2/package-info.java +0 -6
- data/src/main/java/monkstone/vecmath/vec3/package-info.java +0 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1f42aa12e08e8589abee2166195d85e4a9c5797130f702c777935b2ed37053b2
|
4
|
+
data.tar.gz: 789b7c482d4dd2ba8dd602f0eceba29e9f80e9ebeef8786a822da365a31e51cc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f4fe171cfa023990fca7e853a28968b959abd0effcd234c458a07a4f2159f0c0f21806ddbbf193c1466dd7a1b2ee87ddacf6cd4bb3f4fd778d58e9db10a69ae0
|
7
|
+
data.tar.gz: fafaa739cf2efb9626e90459e3cd1c698c182bd1b0e79cd0757140c877698a5d84e44647d1fd3d38e3641c9d20fa576a502588cad596b8ff9a16e42ef577afda
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
v2.5.0 Update to JRuby-9.3.0.0.
|
2
|
+
|
3
|
+
v2.4.2 Update to JRuby-9.2.19, getting ready for JRuby-9.3+.
|
4
|
+
|
5
|
+
v2.4.1 patch library loader, add PGS library examples.
|
6
|
+
|
7
|
+
v2.4.0 Refactor noise to two modules, FastNoise (default) & SmoothNoise, with terrain noise `:tnoise` option.
|
8
|
+
|
1
9
|
v2.3.0 Abandon Processing Value Noise in favour of OpenSimplex2, with choosable options. Added pdf library using iText5.
|
2
10
|
|
3
11
|
v2.2.0 Bump to latest JOGL-rc January 2021
|
@@ -34,7 +42,7 @@ v0.8.0 Refactor processing code to jdk8 syntax, include lambda, switch on string
|
|
34
42
|
|
35
43
|
v0.7.1 Oops fix `GfxRender` had not been merged
|
36
44
|
|
37
|
-
v0.7.0 Refactor sketch_writer to load params from ~/.picrate/sketch.yml. `
|
45
|
+
v0.7.0 Refactor sketch_writer to load params from ~/.picrate/sketch.yml. `GfxRender => GfxRender` because we only need `PGraphics` in renderer.
|
38
46
|
|
39
47
|
v0.6.0 Re-branding with new 'pick'/'eight' svg for PiCrate
|
40
48
|
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
__C6H3N3O7__ [](https://badge.fury.io/rb/picrate)
|
2
2
|
|
3
3
|
# PiCrate
|
4
|
-
|
4
|
+
Version for `Raspberry Pi OS` on raspberryPI 3B+ works with jdk11 (reflective access warnings fixed for jdk11). That also works on 64 bit `ManjaroArm` distro on RaspberryPI4. Create processing sketches in ruby on raspberry-pi and linux (this project is a parallel development of [propane][propane] targetting the raspberry-pi, but will initially be developed on a regular linux box). The aim is to produce a gem installable app that can be run with jruby, with minimal dependencies. Drop the `C` and you get pirate, or and an `e` and get `PiCreate`, a happy coincidence?
|
5
5
|
|
6
6
|
|
7
7
|
### To install from rubygems ###
|
@@ -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.
|
22
|
+
jgem install picrate-2.5.0-java.gem
|
23
23
|
|
24
24
|
```
|
25
25
|
To create a template sketch:-
|
data/Rakefile
CHANGED
@@ -9,7 +9,7 @@ task default: %i[init compile install test gem]
|
|
9
9
|
# Currently depends on local jogl-2.4.0 jars on path ~/jogl24
|
10
10
|
desc 'Copy Jars'
|
11
11
|
task :init do
|
12
|
-
jogl24 = File.join(HOME_DIR, '
|
12
|
+
jogl24 = File.join(HOME_DIR, 'jogl24')
|
13
13
|
opengl = Dir.entries(jogl24).grep(/amd64|armv6hf|aarch64/).select { |jar| jar =~ /linux/ }
|
14
14
|
opengl.concat %w[jogl-all.jar gluegen-rt.jar]
|
15
15
|
opengl.each do |gl|
|
data/docs/.gitignore
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
---
|
2
2
|
layout: post
|
3
|
-
title: "
|
4
|
-
keywords: to_vertex, Vec3D, Vec2D,
|
3
|
+
title: "GfxRender and ShapeRender"
|
4
|
+
keywords: to_vertex, Vec3D, Vec2D, GfxRender, ShapeRender
|
5
5
|
---
|
6
|
-
Vec2D and Vec3D classes can be efficiently rendered as both PApplet vertices, and PShape vertices using
|
6
|
+
Vec2D and Vec3D classes can be efficiently rendered as both PApplet vertices, and PShape vertices using GfxRender and ShapeRender utility classes. To use the GfxRender renderer you should create a single instance in the processing setup see below example:-
|
7
7
|
|
8
|
-
###
|
8
|
+
### GfxRender
|
9
9
|
|
10
10
|
```ruby
|
11
11
|
attr_reader :renderer
|
12
12
|
...
|
13
13
|
def setup
|
14
|
-
@renderer =
|
14
|
+
@renderer = GfxRender.new(self)
|
15
15
|
end
|
16
16
|
...
|
17
17
|
```
|
@@ -1,11 +1,12 @@
|
|
1
1
|
---
|
2
2
|
layout: post
|
3
|
-
title: "
|
3
|
+
title: "Noise Modes"
|
4
4
|
---
|
5
5
|
|
6
6
|
### Name ###
|
7
7
|
|
8
|
-
|
8
|
+
There are two noise modes available in PiCrate, both base on KdotJPG java noise.
|
9
|
+
The default noise uses the FastNoise module, the SmoothNoise module can be used using the module name as a prefix see example below.
|
9
10
|
|
10
11
|
### Examples ###
|
11
12
|
|
@@ -25,24 +26,12 @@ class TestNoise < Processing::App
|
|
25
26
|
noise_scale = 0.01
|
26
27
|
background(0)
|
27
28
|
grid(width, height, 10, 10) do |x, y|
|
28
|
-
arrow(x, y, noise(x * noise_scale, y * noise_scale, z * noise_scale) * TWO_PI * 2)
|
29
|
+
arrow(x, y, SmoothNoise.noise(x * noise_scale, y * noise_scale, z * noise_scale) * TWO_PI * 2)
|
30
|
+
# arrow(x, y, noise(x * noise_scale, y * noise_scale, z * noise_scale) * TWO_PI * 2)
|
29
31
|
end
|
30
32
|
@z += 1
|
31
33
|
end
|
32
34
|
|
33
|
-
def mouse_pressed
|
34
|
-
mode = NoiseMode::OPEN_SMOOTH # Smooth classic OpenSimplex2
|
35
|
-
noise_mode mode
|
36
|
-
sketch_title mode.description
|
37
|
-
end
|
38
|
-
|
39
|
-
def mouse_released
|
40
|
-
mode = NoiseMode::DEFAULT # Fast classic OpenSimplex2
|
41
|
-
noise_mode(mode)
|
42
|
-
sketch_title mode.description
|
43
|
-
end
|
44
|
-
|
45
|
-
|
46
35
|
def arrow(x, y, ang)
|
47
36
|
push_matrix()
|
48
37
|
translate(x, y)
|
@@ -68,15 +57,14 @@ TestNoise.new
|
|
68
57
|
### Description ###
|
69
58
|
|
70
59
|
Currently supports four implementations of noise:-
|
71
|
-
1.
|
72
|
-
2.
|
73
|
-
3.
|
74
|
-
4. SMOOTH_TERRAIN # as above but smoother
|
60
|
+
1. Default is classic OpenSimplex2
|
61
|
+
2. SmoothNoise use smoother class OpenSimplex2F
|
62
|
+
3. Use tnoise instead of noise for a noise mode more suited to terrain
|
75
63
|
|
76
64
|
### Syntax ###
|
77
65
|
|
78
66
|
```ruby
|
79
|
-
|
67
|
+
SmoothNoise.noise(...) # no prefix for fast classic OpenSimplex2
|
80
68
|
```
|
81
69
|
|
82
70
|
### Related ###
|
@@ -14,7 +14,7 @@ Get the latest version from [http://jruby.org/download][download]
|
|
14
14
|
|
15
15
|
```bash
|
16
16
|
cd /opt
|
17
|
-
sudo tar xzvf /pathToDownload/jruby-bin-9.
|
17
|
+
sudo tar xzvf /pathToDownload/jruby-bin-9.3.0.0.tar.gz
|
18
18
|
```
|
19
19
|
|
20
20
|
Then use the excellent `update-alternatives` tool to provide symbolic links to `jruby`, `jgem`, `jirb` and `rake` especially if you haven't installed `mri` ruby.
|
@@ -31,16 +31,16 @@ You should prefer to install gems locally (no need for sudo). To do that it is c
|
|
31
31
|
```bash
|
32
32
|
alias jpry="jruby -e \"require 'pry'; binding.pry\""
|
33
33
|
# export JAVA_HOME="/opt/jdk1.8.0_151" # if using oracle java openjdk-8 is fine though
|
34
|
-
export GEM_HOME="$HOME/.gem/ruby/2.
|
35
|
-
export GEM_PATH="$HOME/tux/.gem/ruby/2.
|
34
|
+
export GEM_HOME="$HOME/.gem/ruby/2.6.0"
|
35
|
+
export GEM_PATH="$HOME/tux/.gem/ruby/2.6.0"
|
36
36
|
export PATH="${PATH}:${GEM_PATH}/bin"
|
37
37
|
```
|
38
38
|
|
39
39
|
### Automated install using bash ###
|
40
40
|
|
41
|
-
The [picrate2_install.sh][bash] script currently installs jruby-9.
|
41
|
+
The [picrate2_install.sh][bash] script currently installs jruby-9.3.0.0 and picrate-2.5.0.
|
42
42
|
|
43
43
|
If you know better please post on wiki
|
44
44
|
|
45
|
-
[download]:"https://repo1.maven.org/maven2/org/jruby/jruby-dist/9.
|
45
|
+
[download]:"https://repo1.maven.org/maven2/org/jruby/jruby-dist/9.3.0.0/jruby-dist-9.3.0.0-bin.tar.gz"
|
46
46
|
[bash]:https://gist.github.com/monkstone/6ae9840d7b7008c177b4a9f589d14ec6
|
@@ -5,7 +5,7 @@ date: 2019-11-11 07:34:13
|
|
5
5
|
categories: PiCrate update
|
6
6
|
permalink: /getting_buster/
|
7
7
|
---
|
8
|
-
|
8
|
+
RaspberryPI OS usually comes with a pre-installed jdk11. Before installing JRuby it might be worth setting the `JAVA_HOME` environmental variable (_to supress reflection warnings_).
|
9
9
|
|
10
10
|
__Otherwise follow these instructions in order as needed:-__
|
11
11
|
|
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
|
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
|
@@ -88,7 +84,7 @@ module Processing
|
|
88
84
|
class << self
|
89
85
|
# Handy getters and setters on the class go here:
|
90
86
|
attr_accessor :sketch_class, :library_loader, :arguments, :options
|
91
|
-
attr_reader :surface
|
87
|
+
attr_reader :surface, :width, :height, :mode
|
92
88
|
def load_libraries(*args)
|
93
89
|
library_loader ||= LibraryLoader.new
|
94
90
|
library_loader.load_library(*args)
|
@@ -139,7 +135,7 @@ module Processing
|
|
139
135
|
w, h, mode = *args
|
140
136
|
@width ||= w
|
141
137
|
@height ||= h
|
142
|
-
@
|
138
|
+
@mode ||= mode
|
143
139
|
import_opengl if /opengl/ =~ mode
|
144
140
|
super(*args)
|
145
141
|
end
|
data/lib/picrate/version.rb
CHANGED
Binary file
|
File without changes
|
data/library/pdf/pdf.rb
CHANGED
Binary file
|
data/library/svg/svg.rb
ADDED
data/picrate.gemspec
CHANGED
@@ -27,12 +27,13 @@ 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 << '
|
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.
|
34
|
+
gem.add_development_dependency 'minitest', '~> 5.14'
|
34
35
|
gem.add_runtime_dependency 'rake', '~> 13.0'
|
35
|
-
gem.add_runtime_dependency 'arcball', '~> 1.
|
36
|
+
gem.add_runtime_dependency 'arcball', '~> 1.2'
|
36
37
|
gem.require_paths = ['lib']
|
37
38
|
gem.platform = 'java'
|
38
39
|
gem.requirements << 'java runtime == 11+'
|
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.
|
5
|
+
id 'ruby-processing:picrate:2.5.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,21 @@ 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
|
+
'jruby.version' => '9.3.0.0',
|
28
|
+
'batik.version' => '1.14',
|
27
29
|
'itextpdf.version' => '5.5.13.2',
|
28
30
|
'jruby.api' => 'http://jruby.org/apidocs/',
|
29
31
|
'source.directory' => 'src',
|
30
32
|
'processing.api' => 'http://processing.github.io/processing-javadocs/core/',
|
31
33
|
'picrate.basedir' => '${project.basedir}',
|
32
|
-
'project.build.sourceEncoding' => '
|
34
|
+
'project.build.sourceEncoding' => 'UTF-8',
|
33
35
|
'polyglot.dump.pom' => 'pom.xml')
|
34
36
|
|
35
|
-
|
37
|
+
jar 'org.jruby:jruby-base:9.3.0.0'
|
36
38
|
jar 'org.jogamp.jogl:jogl-all:${jogl.version}'
|
37
39
|
jar 'org.jogamp.gluegen:gluegen-rt-main:${jogl.version}'
|
38
40
|
jar 'org.processing:video:3.0.2'
|
41
|
+
jar 'org.apache.xmlgraphics:batik-all:${batik.version}'
|
39
42
|
jar 'com.itextpdf:itextpdf:${itextpdf.version}'
|
40
43
|
end
|
41
44
|
|
@@ -44,13 +47,19 @@ overrides do
|
|
44
47
|
plugin :dependency, '3.1.2' do
|
45
48
|
execute_goals( id: 'default-cli',
|
46
49
|
artifactItems:[
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
50
|
+
{ groupId: 'com.itextpdf',
|
51
|
+
artifactId: 'itextpdf',
|
52
|
+
version: '${itextpdf.version}',
|
53
|
+
type: 'jar',
|
54
|
+
outputDirectory: '${picrate.basedir}/library/pdf'
|
55
|
+
},
|
56
|
+
{ groupId: 'org.apache.xmlgraphics',
|
57
|
+
artifactId: 'batik-all',
|
58
|
+
version: '${batik.version}',
|
59
|
+
type: 'jar',
|
60
|
+
outputDirectory: '${picrate.basedir}/library/svg'
|
61
|
+
}
|
62
|
+
]
|
54
63
|
)
|
55
64
|
end
|
56
65
|
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.
|
14
|
+
<version>2.5.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,21 +64,22 @@ 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>
|
71
|
+
<jruby.version>9.3.0.0</jruby.version>
|
70
72
|
<picrate.basedir>${project.basedir}</picrate.basedir>
|
71
73
|
<polyglot.dump.pom>pom.xml</polyglot.dump.pom>
|
72
74
|
<processing.api>http://processing.github.io/processing-javadocs/core/</processing.api>
|
73
|
-
<project.build.sourceEncoding>
|
75
|
+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
74
76
|
<source.directory>src</source.directory>
|
75
77
|
</properties>
|
76
78
|
<dependencies>
|
77
79
|
<dependency>
|
78
80
|
<groupId>org.jruby</groupId>
|
79
|
-
<artifactId>jruby</artifactId>
|
80
|
-
<version>9.
|
81
|
-
<type>pom</type>
|
81
|
+
<artifactId>jruby-base</artifactId>
|
82
|
+
<version>9.3.0.0</version>
|
82
83
|
</dependency>
|
83
84
|
<dependency>
|
84
85
|
<groupId>org.jogamp.jogl</groupId>
|
@@ -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}/
|
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);
|