propane 2.2.0.pre-java → 2.3.0-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -12
- data/CHANGELOG.md +5 -1
- data/README.md +6 -6
- data/lib/propane/helper_methods.rb +2 -7
- data/lib/propane/version.rb +1 -1
- data/pom.rb +20 -6
- data/pom.xml +22 -6
- data/propane.gemspec +8 -6
- data/src/monkstone/MathToolModule.java +32 -0
- data/test/test_create.rb +91 -0
- data/test/test_deglut_spec.rb +25 -0
- data/test/test_helper.rb +5 -0
- data/test/test_math_tool.rb +89 -0
- data/test/test_respond_to.rb +213 -0
- data/vendors/Rakefile +4 -4
- metadata +22 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 78bff0b5d57b0dee23e593ad9f56a9274d52c356
|
4
|
+
data.tar.gz: 03a86ec3a4553087f88aacc31e9da390f3dd4730
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7f5729c71279d34d05b7c10ac2c8f656ce15bd0d70014bef40c8a942a22a77e8eaee209a23e1cfd92ae55a467cd66b547d1319530d1d1a8ac6ccd94391452e3d
|
7
|
+
data.tar.gz: 288bf7e78b70ec116a2967c8b6240909b10d69cd450833df4436ff0c3d1cff35ff8a8b466fb722d4c513ae51ca2172a49d9cf3dc4c8181ed01b65ce3c279459f
|
data/.travis.yml
CHANGED
@@ -1,21 +1,10 @@
|
|
1
1
|
language: ruby
|
2
2
|
sudo: false
|
3
|
-
addons:
|
4
|
-
apt:
|
5
|
-
packages:
|
6
|
-
-oracle-java8-installer
|
7
|
-
-xvfb
|
8
|
-
-libxrender1
|
9
|
-
-libxtst6
|
10
|
-
-libxi6
|
11
3
|
|
12
4
|
rvm:
|
13
|
-
- jruby-9.1.
|
5
|
+
- jruby-9.1.6.0
|
14
6
|
jdk:
|
15
7
|
- oraclejdk8
|
16
8
|
os:
|
17
9
|
- linux
|
18
|
-
env:
|
19
|
-
- Xvfb :1 -screen 0 1024x768x24
|
20
|
-
- export DISPLAY=":1"
|
21
10
|
|
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,8 @@
|
|
1
|
-
**v2.
|
1
|
+
**v2.3.0** Update to core processing-3.3 `grid` method now implemented in java, bump examples to include WOVNS
|
2
|
+
|
3
|
+
**v2.1.1** Update to core processing-3.2.4 and JRuby-9.1.7.0
|
4
|
+
|
5
|
+
**v2.1.0** Add missing method to ColorUtil.java, `include HelperMethods, PConstants, Math, MathTool` in `Propane::Proxy`, it is just simpler that way. Mixin Renderer for AppRender and ShapeRender. Changes to `Propane::Proxy` are significant enough to warrant versioning bump, samples making use of new code will not be runable by earlier versions.
|
2
6
|
|
3
7
|
**v2.0.6** Update to core processing-3.2.3
|
4
8
|
|
data/README.md
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
# Propane
|
2
2
|
[![Gem Version](https://badge.fury.io/rb/propane.svg)](https://badge.fury.io/rb/propane)
|
3
3
|
|
4
|
-
A slim layer to communicate with Processing from JRuby, features a polyglot maven build. We have created a configuration free version of ruby processing, for processing-3.
|
4
|
+
A slim layer to communicate with Processing from JRuby, features a polyglot maven build. We have created a configuration free version of ruby processing, for processing-3.3, where we include processing core (from a local maven repository and opengl etc from maven central). These jars are small enough to include in a gem distribution, and hence we do not require configuration. This has created a scriptable version, ie files get run direct from jruby, but you could use jruby-complete if you used the propane script (avoids need to give the absolute data path for the data folder, but would also be needed for a watch mode). See guide to [building ruby-processing projects][building].
|
5
5
|
|
6
6
|
## Requirements
|
7
7
|
|
8
|
-
- jdk8+
|
9
|
-
- jruby-9.1.
|
8
|
+
- jdk8+
|
9
|
+
- jruby-9.1.7.0+
|
10
10
|
- mvn-3.3.1+ (development only)
|
11
|
-
- core.jar processing-3.
|
11
|
+
- core.jar processing-3.3.0 (development only until processing.org is available at maven central)
|
12
12
|
|
13
13
|
## Building and testing
|
14
14
|
|
@@ -20,8 +20,8 @@ rake javadoc
|
|
20
20
|
|
21
21
|
## Installation
|
22
22
|
```bash
|
23
|
-
jgem install propane
|
24
|
-
jgem install propane #
|
23
|
+
jgem install propane # from rubygems
|
24
|
+
jgem install propane-2.3.0-java.gem # for local install
|
25
25
|
```
|
26
26
|
|
27
27
|
## Usage
|
@@ -36,13 +36,8 @@ module Propane
|
|
36
36
|
|
37
37
|
# A nice method to run a given block for a grid.
|
38
38
|
# Lifted from action_coding/Nodebox.
|
39
|
-
def grid(cols, rows, col_size = 1, row_size = 1)
|
40
|
-
|
41
|
-
x = col_size * (i % cols)
|
42
|
-
y = row_size * i.div(cols)
|
43
|
-
yield x, y
|
44
|
-
end
|
45
|
-
end
|
39
|
+
# def grid(cols, rows, col_size = 1, row_size = 1) { |x, y| block_stuff }
|
40
|
+
# NB: now implemented in java
|
46
41
|
|
47
42
|
# lerp_color takes three or four arguments, in Java that's two
|
48
43
|
# different methods, one regular and one static, so:
|
data/lib/propane/version.rb
CHANGED
data/pom.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'fileutils'
|
2
2
|
project 'rp5extras', 'https://github.com/monkstone/propane' do
|
3
3
|
model_version '4.0.0'
|
4
|
-
id 'propane:propane', '2.
|
4
|
+
id 'propane:propane', '2.3.0'
|
5
5
|
packaging 'jar'
|
6
6
|
description 'rp5extras for propane'
|
7
7
|
organization 'ruby-processing', 'https://ruby-processing.github.io'
|
@@ -32,8 +32,8 @@ project 'rp5extras', 'https://github.com/monkstone/propane' do
|
|
32
32
|
'jogl.version' => '2.3.2'
|
33
33
|
)
|
34
34
|
|
35
|
-
pom 'org.jruby:jruby:9.1.
|
36
|
-
jar 'org.processing:core:3.
|
35
|
+
pom 'org.jruby:jruby:9.1.7.0'
|
36
|
+
jar 'org.processing:core:3.3.0'
|
37
37
|
jar 'org.processing:video:3.0.2'
|
38
38
|
jar('org.jogamp.jogl:jogl-all:${jogl.version}')
|
39
39
|
jar('org.jogamp.gluegen:gluegen-rt-main:${jogl.version}')
|
@@ -44,7 +44,7 @@ project 'rp5extras', 'https://github.com/monkstone/propane' do
|
|
44
44
|
execute_goals( id: 'default-cli',
|
45
45
|
artifactItems: [ { groupId: 'org.processing',
|
46
46
|
artifactId: 'core',
|
47
|
-
version: '3.
|
47
|
+
version: '3.3.0',
|
48
48
|
type: 'jar',
|
49
49
|
outputDirectory: '${propane.basedir}/lib'
|
50
50
|
},
|
@@ -63,7 +63,7 @@ project 'rp5extras', 'https://github.com/monkstone/propane' do
|
|
63
63
|
{ groupId: 'org.jogamp.jogl',
|
64
64
|
artifactId: 'jogl-all',
|
65
65
|
version: '${jogl.version}',
|
66
|
-
classifier: 'natives-
|
66
|
+
classifier: 'natives-linux-amd64',
|
67
67
|
type: 'jar',
|
68
68
|
outputDirectory: '${propane.basedir}/lib'
|
69
69
|
},
|
@@ -71,7 +71,21 @@ project 'rp5extras', 'https://github.com/monkstone/propane' do
|
|
71
71
|
artifactId: 'gluegen-rt',
|
72
72
|
version: '${jogl.version}',
|
73
73
|
type: 'jar',
|
74
|
-
classifier: 'natives-
|
74
|
+
classifier: 'natives-linux-amd64',
|
75
|
+
outputDirectory: '${propane.basedir}/lib'
|
76
|
+
},
|
77
|
+
{ groupId: 'org.jogamp.jogl',
|
78
|
+
artifactId: 'jogl-all',
|
79
|
+
version: '${jogl.version}',
|
80
|
+
classifier: 'natives-macosx-universal',
|
81
|
+
type: 'jar',
|
82
|
+
outputDirectory: '${propane.basedir}/lib'
|
83
|
+
},
|
84
|
+
{ groupId: 'org.jogamp.gluegen',
|
85
|
+
artifactId: 'gluegen-rt',
|
86
|
+
version: '${jogl.version}',
|
87
|
+
type: 'jar',
|
88
|
+
classifier: 'natives-macosx-universal',
|
75
89
|
outputDirectory: '${propane.basedir}/lib'
|
76
90
|
}
|
77
91
|
]
|
data/pom.xml
CHANGED
@@ -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>2.
|
14
|
+
<version>2.3.0</version>
|
15
15
|
<name>rp5extras</name>
|
16
16
|
<description>rp5extras for propane</description>
|
17
17
|
<url>https://github.com/monkstone/propane</url>
|
@@ -58,13 +58,13 @@ DO NOT MODIFIY - GENERATED CODE
|
|
58
58
|
<dependency>
|
59
59
|
<groupId>org.jruby</groupId>
|
60
60
|
<artifactId>jruby</artifactId>
|
61
|
-
<version>9.1.
|
61
|
+
<version>9.1.7.0</version>
|
62
62
|
<type>pom</type>
|
63
63
|
</dependency>
|
64
64
|
<dependency>
|
65
65
|
<groupId>org.processing</groupId>
|
66
66
|
<artifactId>core</artifactId>
|
67
|
-
<version>3.
|
67
|
+
<version>3.3.0</version>
|
68
68
|
</dependency>
|
69
69
|
<dependency>
|
70
70
|
<groupId>org.processing</groupId>
|
@@ -103,7 +103,7 @@ DO NOT MODIFIY - GENERATED CODE
|
|
103
103
|
<artifactItem>
|
104
104
|
<groupId>org.processing</groupId>
|
105
105
|
<artifactId>core</artifactId>
|
106
|
-
<version>3.
|
106
|
+
<version>3.3.0</version>
|
107
107
|
<type>jar</type>
|
108
108
|
<outputDirectory>${propane.basedir}/lib</outputDirectory>
|
109
109
|
</artifactItem>
|
@@ -125,7 +125,7 @@ DO NOT MODIFIY - GENERATED CODE
|
|
125
125
|
<groupId>org.jogamp.jogl</groupId>
|
126
126
|
<artifactId>jogl-all</artifactId>
|
127
127
|
<version>${jogl.version}</version>
|
128
|
-
<classifier>natives-
|
128
|
+
<classifier>natives-linux-amd64</classifier>
|
129
129
|
<type>jar</type>
|
130
130
|
<outputDirectory>${propane.basedir}/lib</outputDirectory>
|
131
131
|
</artifactItem>
|
@@ -134,7 +134,23 @@ DO NOT MODIFIY - GENERATED CODE
|
|
134
134
|
<artifactId>gluegen-rt</artifactId>
|
135
135
|
<version>${jogl.version}</version>
|
136
136
|
<type>jar</type>
|
137
|
-
<classifier>natives-
|
137
|
+
<classifier>natives-linux-amd64</classifier>
|
138
|
+
<outputDirectory>${propane.basedir}/lib</outputDirectory>
|
139
|
+
</artifactItem>
|
140
|
+
<artifactItem>
|
141
|
+
<groupId>org.jogamp.jogl</groupId>
|
142
|
+
<artifactId>jogl-all</artifactId>
|
143
|
+
<version>${jogl.version}</version>
|
144
|
+
<classifier>natives-macosx-universal</classifier>
|
145
|
+
<type>jar</type>
|
146
|
+
<outputDirectory>${propane.basedir}/lib</outputDirectory>
|
147
|
+
</artifactItem>
|
148
|
+
<artifactItem>
|
149
|
+
<groupId>org.jogamp.gluegen</groupId>
|
150
|
+
<artifactId>gluegen-rt</artifactId>
|
151
|
+
<version>${jogl.version}</version>
|
152
|
+
<type>jar</type>
|
153
|
+
<classifier>natives-macosx-universal</classifier>
|
138
154
|
<outputDirectory>${propane.basedir}/lib</outputDirectory>
|
139
155
|
</artifactItem>
|
140
156
|
</artifactItems>
|
data/propane.gemspec
CHANGED
@@ -9,19 +9,21 @@ Gem::Specification.new do |gem|
|
|
9
9
|
gem.authors = ['monkstone']
|
10
10
|
gem.email = ['mamba2928@yahoo.co.uk']
|
11
11
|
gem.licenses = %w(GPL-3.0 LGPL-2.0)
|
12
|
-
gem.description = %q{A batteries included version of processing in ruby,
|
13
|
-
gem.summary = %q{
|
12
|
+
gem.description = %q{A batteries included version of processing in ruby, MacOS and linux64}
|
13
|
+
gem.summary = %q{ruby wrapper for processing-3.3 on MacOS and linux64 bit only for opengl}
|
14
14
|
gem.homepage = 'https://ruby-processing.github.io/propane/'
|
15
15
|
gem.files = `git ls-files`.split($/)
|
16
16
|
gem.files << 'lib/propane.jar'
|
17
|
-
gem.files << 'lib/core-3.
|
17
|
+
gem.files << 'lib/core-3.3.0.jar'
|
18
18
|
gem.files << 'lib/gluegen-rt-2.3.2.jar'
|
19
19
|
gem.files << 'lib/jogl-all-2.3.2.jar'
|
20
|
-
gem.files << 'lib/gluegen-rt-2.3.2-natives-
|
21
|
-
gem.files << 'lib/
|
20
|
+
gem.files << 'lib/gluegen-rt-2.3.2-natives-linux-amd64.jar'
|
21
|
+
gem.files << 'lib/gluegen-rt-2.3.2-natives-macosx-universal.jar'
|
22
|
+
gem.files << 'lib/jogl-all-2.3.2-natives-linux-amd64.jar'
|
23
|
+
gem.files << 'lib/jogl-all-2.3.2-natives-macosx-universal.jar'
|
22
24
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
23
25
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
24
|
-
gem.add_runtime_dependency 'arcball', '~> 0.0.3'
|
26
|
+
gem.add_runtime_dependency 'arcball', '~> 0.0.3'
|
25
27
|
gem.require_paths = ['lib']
|
26
28
|
gem.platform = 'java'
|
27
29
|
end
|
@@ -17,6 +17,7 @@ import org.jruby.RubyModule;
|
|
17
17
|
import org.jruby.RubyRange;
|
18
18
|
import org.jruby.anno.JRubyMethod;
|
19
19
|
import org.jruby.anno.JRubyModule;
|
20
|
+
import org.jruby.runtime.Block;
|
20
21
|
import org.jruby.runtime.ThreadContext;
|
21
22
|
import org.jruby.runtime.builtin.IRubyObject;
|
22
23
|
|
@@ -201,4 +202,35 @@ public class MathToolModule {
|
|
201
202
|
return args[1];
|
202
203
|
}
|
203
204
|
}
|
205
|
+
|
206
|
+
/**
|
207
|
+
* Provides propane grid method as a ruby module method
|
208
|
+
*
|
209
|
+
* @param context ThreadContext
|
210
|
+
* @param recv IRubyObject
|
211
|
+
* @param args array of args should be Fixnum
|
212
|
+
* @param block { |x, y| `do something` }
|
213
|
+
* @return nil
|
214
|
+
*/
|
215
|
+
@JRubyMethod(name = "grid", rest = true, module = true)
|
216
|
+
public static IRubyObject createGrid(ThreadContext context, IRubyObject recv, IRubyObject[] args, Block block) {
|
217
|
+
int row = (Integer) args[0].toJava(Integer.class);
|
218
|
+
int column = (Integer) args[1].toJava(Integer.class);
|
219
|
+
int rowStep = 1;
|
220
|
+
int colStep = 1;
|
221
|
+
if (args.length == 4){
|
222
|
+
rowStep = (Integer) args[2].toJava(Integer.class);
|
223
|
+
colStep = (Integer) args[3].toJava(Integer.class);
|
224
|
+
}
|
225
|
+
if (block.isGiven()) {
|
226
|
+
int tempRow = row / rowStep;
|
227
|
+
for (int z = 0; z < (tempRow * (column / colStep)); z++){
|
228
|
+
int x = z % tempRow;
|
229
|
+
int y = z / tempRow;
|
230
|
+
block.yieldSpecific(context, context.runtime.newFixnum(x * rowStep), context.runtime.newFixnum(y * colStep));
|
231
|
+
}
|
232
|
+
}
|
233
|
+
return context.nil;
|
234
|
+
|
235
|
+
}
|
204
236
|
}
|
data/test/test_create.rb
ADDED
@@ -0,0 +1,91 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require_relative 'test_helper'
|
3
|
+
|
4
|
+
|
5
|
+
require_relative '../lib/propane/creators/sketch_class'
|
6
|
+
|
7
|
+
CLASS_SKETCH = <<~CODE
|
8
|
+
# frozen_string_literal: false
|
9
|
+
require 'propane'
|
10
|
+
|
11
|
+
class FredSketch < Propane::App
|
12
|
+
def settings
|
13
|
+
size 200, 200
|
14
|
+
end
|
15
|
+
|
16
|
+
def setup
|
17
|
+
sketch_title 'Fred Sketch'
|
18
|
+
end
|
19
|
+
|
20
|
+
def draw
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
FredSketch.new
|
26
|
+
|
27
|
+
CODE
|
28
|
+
|
29
|
+
BARE_SKETCH = <<~CODE
|
30
|
+
def settings
|
31
|
+
size 200, 200, P2D
|
32
|
+
end
|
33
|
+
|
34
|
+
def setup
|
35
|
+
sketch_title 'Fred Sketch'
|
36
|
+
end
|
37
|
+
|
38
|
+
def draw
|
39
|
+
|
40
|
+
end
|
41
|
+
|
42
|
+
CODE
|
43
|
+
|
44
|
+
class SketchClassTest < Minitest::Test
|
45
|
+
|
46
|
+
def setup
|
47
|
+
@basic = SketchClass.new(name: 'fred_sketch', width: 200, height: 200)
|
48
|
+
@sketch = SketchClass.new(name: 'fred_sketch', width: 200, height: 200, mode: 'p2d')
|
49
|
+
end
|
50
|
+
|
51
|
+
def test_class
|
52
|
+
result = CLASS_SKETCH.split(/\n/, -1)
|
53
|
+
class_lines = @sketch.lines
|
54
|
+
class_lines.each_with_index do |line, i|
|
55
|
+
assert_equal result[i], line
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def test_indent
|
60
|
+
assert_equal ' indent', @sketch.indent('indent')
|
61
|
+
end
|
62
|
+
|
63
|
+
def test_size
|
64
|
+
assert_equal ' size 200, 200, P2D', @sketch.size
|
65
|
+
assert_equal ' size 200, 200', @basic.size
|
66
|
+
end
|
67
|
+
|
68
|
+
def test_sketch_title
|
69
|
+
assert_equal " sketch_title 'Fred Sketch'", @sketch.sketch_title
|
70
|
+
end
|
71
|
+
|
72
|
+
def test_class
|
73
|
+
assert_equal "FredSketch", @sketch.sketch_class
|
74
|
+
end
|
75
|
+
|
76
|
+
def test_class_new
|
77
|
+
assert_equal "FredSketch.new", @sketch.sketch_new
|
78
|
+
end
|
79
|
+
|
80
|
+
def test_method_lines
|
81
|
+
result = CLASS_SKETCH.split(/\n/, -1)
|
82
|
+
@basic.method_lines('settings', @basic.size).each_with_index do |line, i|
|
83
|
+
assert_equal result[i + 4], line
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
|
88
|
+
def test_sketch_class
|
89
|
+
assert_equal "class FredSketch < Propane::App", @basic.class_sketch
|
90
|
+
end
|
91
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require_relative 'test_helper'
|
3
|
+
|
4
|
+
Java::Monkstone::PropaneLibrary.load(JRuby.runtime)
|
5
|
+
|
6
|
+
Dir.chdir(File.dirname(__FILE__))
|
7
|
+
|
8
|
+
class DeglutTest < Minitest::Test
|
9
|
+
attr_reader :to_radian
|
10
|
+
|
11
|
+
def setup
|
12
|
+
@to_radian = Math::PI / 180
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_cos_sin
|
16
|
+
(-720..720).step(1) do |deg|
|
17
|
+
sine = DegLut.sin(deg)
|
18
|
+
deg_sin = Math.sin(deg * to_radian)
|
19
|
+
assert_in_delta(sine, deg_sin, delta = 0.000001)
|
20
|
+
cosine = DegLut.cos(deg)
|
21
|
+
deg_cos = Math.cos(deg * to_radian)
|
22
|
+
assert_in_delta(cosine, deg_cos, delta = 0.000001)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require_relative 'test_helper'
|
3
|
+
|
4
|
+
Java::Monkstone::PropaneLibrary.new.load(JRuby.runtime, false)
|
5
|
+
|
6
|
+
Dir.chdir(File.dirname(__FILE__))
|
7
|
+
|
8
|
+
class MathToolTest < Minitest::Test
|
9
|
+
include MathTool
|
10
|
+
def test_map1d
|
11
|
+
x = [0, 5, 7.5, 10]
|
12
|
+
range1 = (0..10)
|
13
|
+
range2 = (100..1)
|
14
|
+
range3 = (0..10)
|
15
|
+
range4 = (5..105)
|
16
|
+
assert_in_delta(map1d(x[0], range1, range2), 100, delta = 0.00001, msg = 'map to first')
|
17
|
+
assert_in_delta(map1d(x[1], range1, range2), 50.5, delta = 0.00001, msg = 'map to reversed intermediate')
|
18
|
+
assert_in_delta(map1d(x[2], range3, range4), 80.0, delta = 0.00001, msg = 'map to intermediate')
|
19
|
+
assert_in_delta(map1d(x[3], range1, range2), 1, delta = 0.00001, msg = 'map to last')
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_p5map # as map1d except not using range input
|
23
|
+
x = [0, 5, 7.5, 10]
|
24
|
+
range1 = (0..10)
|
25
|
+
range2 = (100..1)
|
26
|
+
range3 = (0..10)
|
27
|
+
range4 = (5..105)
|
28
|
+
assert_in_delta(p5map(x[0], range1.first, range1.last, range2.first, range2.last), 100, delta = 0.00001)
|
29
|
+
assert_in_delta(p5map(x[1], range1.first, range1.last, range2.first, range2.last), 50.5, delta = 0.00001)
|
30
|
+
assert_in_delta(p5map(x[2], range3.first, range3.last, range4.first, range4.last), 80.0, delta = 0.00001)
|
31
|
+
assert_in_delta(p5map(x[3], range1.first, range1.last, range2.first, range2.last), 1, delta = 0.00001)
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_norm
|
35
|
+
x = [10, 140, 210]
|
36
|
+
start0, last0 = 30, 200
|
37
|
+
start_int, last_int = 0, 200
|
38
|
+
assert_in_delta(norm(x[0], start0, last0), -0.11764705882352941, delta = 0.00001, msg = 'unclamped map')
|
39
|
+
assert_in_delta(norm(x[1], start_int, last_int), 0.7, delta = 0.00001, msg = 'map to intermediate')
|
40
|
+
assert_in_delta(norm(x[2], start_int, last_int), 1.05, delta = 0.00001, msg = 'unclamped map')
|
41
|
+
end
|
42
|
+
|
43
|
+
def test_norm_strict
|
44
|
+
x = [10, 140, 210]
|
45
|
+
assert_in_delta(norm_strict(x[2], x[0], x[1]), 1.0, delta = 0.00001, msg = 'clamped map to 0..1.0')
|
46
|
+
assert_in_delta(norm_strict(x[2], x[1], x[0]), 0.0, delta = 0.00001, msg = 'clamped map to 0..1.0')
|
47
|
+
assert_in_delta(norm_strict(x[1], x[0], x[2]), 0.65, delta = 0.00001, msg = 'clamped map to 0..1.0')
|
48
|
+
end
|
49
|
+
|
50
|
+
def test_lerp # behaviour is deliberately different to processing which is unclamped
|
51
|
+
x = [0.5, 0.8, 2.0]
|
52
|
+
start0, last0 = 300, 200
|
53
|
+
start_int, last_int = 0, 200
|
54
|
+
assert_in_delta(lerp(start0, last0, x[0]), 250, delta = 0.00001, msg = 'produces a intermediate value of a reversed range')
|
55
|
+
assert_in_delta(lerp(start_int, last_int, x[1]), 160, delta = 0.00001, msg = 'lerps to an intermediate value')
|
56
|
+
assert_in_delta(lerp(start_int, last_int, x[2]), 200, delta = 0.00001, msg = 'lerps to the last value of a range')
|
57
|
+
end
|
58
|
+
|
59
|
+
def test_constrain
|
60
|
+
x_int = [15, 2_500, -2_500]
|
61
|
+
start_int, last_int = 0, 200
|
62
|
+
assert_in_delta(constrain(x_int[0], start_int, last_int), 15, delta = 0.00001)
|
63
|
+
assert_in_delta(constrain(x_int[1], start_int, last_int), 200, delta = 0.00001)
|
64
|
+
assert_in_delta(constrain(x_int[2], start_int, last_int), 0, delta = 0.00001)
|
65
|
+
xf = [15.0, 2_500.0, -2_500.0]
|
66
|
+
startf, lastf = 0, 200.0
|
67
|
+
assert_in_delta(constrain(xf[0], startf, lastf), 15.0, delta = 0.00001, msg = 'constrain to 0..200')
|
68
|
+
assert_in_delta(constrain(xf[1], startf, lastf), 200.0, delta = 0.00001, msg = 'constrain to 0..200')
|
69
|
+
assert_in_delta(constrain(xf[2], startf, lastf), 0.0, delta = 0.00001, msg = 'constrain to 0..200')
|
70
|
+
end
|
71
|
+
|
72
|
+
def test_grid_one
|
73
|
+
array = []
|
74
|
+
grid(100, 100) { |x, y| array << [x, y] }
|
75
|
+
assert array[0].include?(0)
|
76
|
+
assert array[98].include?(0)
|
77
|
+
assert_equal array.length, 10_000
|
78
|
+
assert array[50].include?(50)
|
79
|
+
end
|
80
|
+
|
81
|
+
def test_grid_ten
|
82
|
+
array = []
|
83
|
+
grid(100, 100, 10, 10) { |x, y| array << [x, y] }
|
84
|
+
assert array[0].include?(0)
|
85
|
+
assert array[9].include?(90)
|
86
|
+
assert_equal array.length, 100
|
87
|
+
assert array[5].include?(50)
|
88
|
+
end
|
89
|
+
end
|
@@ -0,0 +1,213 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require_relative 'test_helper'
|
3
|
+
|
4
|
+
METHODS = %i(
|
5
|
+
alpha
|
6
|
+
ambient
|
7
|
+
ambient_light
|
8
|
+
apply_matrix
|
9
|
+
arc
|
10
|
+
background
|
11
|
+
begin_camera
|
12
|
+
begin_contour
|
13
|
+
begin_raw
|
14
|
+
begin_record
|
15
|
+
begin_shape
|
16
|
+
bezier
|
17
|
+
bezier_detail
|
18
|
+
bezier_point
|
19
|
+
bezier_tangent
|
20
|
+
bezier_vertex
|
21
|
+
blend
|
22
|
+
blend_mode
|
23
|
+
blue
|
24
|
+
box
|
25
|
+
brightness
|
26
|
+
camera
|
27
|
+
color
|
28
|
+
color_mode
|
29
|
+
copy
|
30
|
+
create_font
|
31
|
+
create_graphics
|
32
|
+
create_image
|
33
|
+
create_input
|
34
|
+
create_output
|
35
|
+
create_reader
|
36
|
+
create_shape
|
37
|
+
create_writer
|
38
|
+
cursor
|
39
|
+
curve
|
40
|
+
curve_detail
|
41
|
+
curve_point
|
42
|
+
curve_tangent
|
43
|
+
curve_tightness
|
44
|
+
curve_vertex
|
45
|
+
directional_light
|
46
|
+
ellipse
|
47
|
+
ellipse_mode
|
48
|
+
emissive
|
49
|
+
end_camera
|
50
|
+
end_contour
|
51
|
+
end_raw
|
52
|
+
end_record
|
53
|
+
end_shape
|
54
|
+
fill
|
55
|
+
filter
|
56
|
+
focused
|
57
|
+
frame_count
|
58
|
+
frame_rate
|
59
|
+
frame_rate
|
60
|
+
frustum
|
61
|
+
get
|
62
|
+
green
|
63
|
+
height
|
64
|
+
hue
|
65
|
+
image
|
66
|
+
image_mode
|
67
|
+
key
|
68
|
+
key_code
|
69
|
+
key_pressed
|
70
|
+
key_pressed?
|
71
|
+
key_released
|
72
|
+
key_typed
|
73
|
+
lerp_color
|
74
|
+
light_falloff
|
75
|
+
light_specular
|
76
|
+
lights
|
77
|
+
line
|
78
|
+
load_bytes
|
79
|
+
load_font
|
80
|
+
load_image
|
81
|
+
load_pixels
|
82
|
+
load_shader
|
83
|
+
load_shape
|
84
|
+
load_strings
|
85
|
+
load_table
|
86
|
+
load_xml
|
87
|
+
model_x
|
88
|
+
model_y
|
89
|
+
model_z
|
90
|
+
mouse_button
|
91
|
+
mouse_clicked
|
92
|
+
mouse_dragged
|
93
|
+
mouse_moved
|
94
|
+
mouse_pressed
|
95
|
+
mouse_pressed?
|
96
|
+
mouse_released
|
97
|
+
mouse_x
|
98
|
+
mouse_y
|
99
|
+
no_cursor
|
100
|
+
no_fill
|
101
|
+
no_lights
|
102
|
+
no_smooth
|
103
|
+
no_stroke
|
104
|
+
no_tint
|
105
|
+
noise
|
106
|
+
noise_detail
|
107
|
+
noise_seed
|
108
|
+
normal
|
109
|
+
ortho
|
110
|
+
perspective
|
111
|
+
pixels
|
112
|
+
pmouse_x
|
113
|
+
pmouse_y
|
114
|
+
point
|
115
|
+
point_light
|
116
|
+
pop_matrix
|
117
|
+
print_camera
|
118
|
+
print_matrix
|
119
|
+
print_projection
|
120
|
+
push_matrix
|
121
|
+
quad
|
122
|
+
quadratic_vertex
|
123
|
+
random
|
124
|
+
random_seed
|
125
|
+
rect
|
126
|
+
rect_mode
|
127
|
+
red
|
128
|
+
request_image
|
129
|
+
reset_matrix
|
130
|
+
reset_shader
|
131
|
+
rotate
|
132
|
+
rotate_x
|
133
|
+
rotate_y
|
134
|
+
rotate_z
|
135
|
+
saturation
|
136
|
+
save
|
137
|
+
save_bytes
|
138
|
+
save_frame
|
139
|
+
save_stream
|
140
|
+
save_strings
|
141
|
+
scale
|
142
|
+
screen_x
|
143
|
+
screen_y
|
144
|
+
screen_z
|
145
|
+
select_folder
|
146
|
+
select_input
|
147
|
+
select_output
|
148
|
+
set
|
149
|
+
shader
|
150
|
+
shape
|
151
|
+
shape_mode
|
152
|
+
shear_x
|
153
|
+
shear_y
|
154
|
+
shininess
|
155
|
+
sketch_title
|
156
|
+
size
|
157
|
+
smooth
|
158
|
+
specular
|
159
|
+
sphere
|
160
|
+
sphere_detail
|
161
|
+
spot_light
|
162
|
+
stroke
|
163
|
+
stroke_cap
|
164
|
+
stroke_join
|
165
|
+
stroke_weight
|
166
|
+
text_align
|
167
|
+
text_ascent
|
168
|
+
text_descent
|
169
|
+
text_font
|
170
|
+
text_leading
|
171
|
+
text_mode
|
172
|
+
text_size
|
173
|
+
text_width
|
174
|
+
texture
|
175
|
+
texture_mode
|
176
|
+
texture_wrap
|
177
|
+
tint
|
178
|
+
translate
|
179
|
+
triangle
|
180
|
+
update_pixels
|
181
|
+
vertex
|
182
|
+
width
|
183
|
+
)
|
184
|
+
|
185
|
+
class TestSketch < Propane::App
|
186
|
+
def settings
|
187
|
+
size 100, 100
|
188
|
+
end
|
189
|
+
|
190
|
+
def setup
|
191
|
+
sketch_title 'Sketch Test'
|
192
|
+
end
|
193
|
+
|
194
|
+
def draw
|
195
|
+
exit if frame_count > 30
|
196
|
+
end
|
197
|
+
end
|
198
|
+
|
199
|
+
class SpecTest < Minitest::Test
|
200
|
+
def setup
|
201
|
+
@processing_sketch = TestSketch.new
|
202
|
+
end
|
203
|
+
|
204
|
+
def test_respond
|
205
|
+
METHODS.each do |method_string|
|
206
|
+
assert_respond_to @processing_sketch, method_string
|
207
|
+
end
|
208
|
+
end
|
209
|
+
|
210
|
+
def tear_down
|
211
|
+
@processing_sketch = nil?
|
212
|
+
end
|
213
|
+
end
|
data/vendors/Rakefile
CHANGED
@@ -5,11 +5,11 @@ WARNING = <<-EOS
|
|
5
5
|
WARNING: you may not have wget installed, you could just download
|
6
6
|
the correct version of propane-examples (see EXAMPLES vendors directory)
|
7
7
|
EOS
|
8
|
-
SOUND = 'sound.zip'.freeze
|
8
|
+
SOUND = 'sound.zip'.freeze
|
9
9
|
SOUND_VERSION = 'v1.3.2' # version 1.3.2
|
10
10
|
VIDEO = 'video-2.zip'
|
11
11
|
VIDEO_VERSION = '2' # version 1.0.1
|
12
|
-
EXAMPLES = '0
|
12
|
+
EXAMPLES = '1.0'.freeze
|
13
13
|
HOME_DIR = ENV['HOME']
|
14
14
|
MAC_OR_LINUX = /linux|mac|darwin/ =~ RbConfig::CONFIG['host_os']
|
15
15
|
|
@@ -50,9 +50,9 @@ task :download_sound do
|
|
50
50
|
end
|
51
51
|
|
52
52
|
desc 'download video library'
|
53
|
-
task :download_video do
|
53
|
+
task :download_video do
|
54
54
|
wget_base = 'wget https://github.com/processing/processing-video'
|
55
|
-
wget_string = [wget_base, 'releases/download', VIDEO_VERSION, VIDEO].join('/')
|
55
|
+
wget_string = [wget_base, 'releases/download', VIDEO_VERSION, VIDEO].join('/')
|
56
56
|
begin
|
57
57
|
sh wget_string
|
58
58
|
rescue
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: propane
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.3.0
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- monkstone
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-02-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: arcball
|
@@ -24,7 +24,7 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 0.0.3
|
27
|
-
description: A batteries included version of processing in ruby,
|
27
|
+
description: A batteries included version of processing in ruby, MacOS and linux64
|
28
28
|
email:
|
29
29
|
- mamba2928@yahoo.co.uk
|
30
30
|
executables:
|
@@ -45,11 +45,13 @@ files:
|
|
45
45
|
- Rakefile
|
46
46
|
- bin/propane
|
47
47
|
- lib/PROCESSING_LICENSE.txt
|
48
|
-
- lib/core-3.
|
48
|
+
- lib/core-3.3.0.jar
|
49
49
|
- lib/export.txt
|
50
|
-
- lib/gluegen-rt-2.3.2-natives-
|
50
|
+
- lib/gluegen-rt-2.3.2-natives-linux-amd64.jar
|
51
|
+
- lib/gluegen-rt-2.3.2-natives-macosx-universal.jar
|
51
52
|
- lib/gluegen-rt-2.3.2.jar
|
52
|
-
- lib/jogl-all-2.3.2-natives-
|
53
|
+
- lib/jogl-all-2.3.2-natives-linux-amd64.jar
|
54
|
+
- lib/jogl-all-2.3.2-natives-macosx-universal.jar
|
53
55
|
- lib/jogl-all-2.3.2.jar
|
54
56
|
- lib/propane.jar
|
55
57
|
- lib/propane.rb
|
@@ -104,6 +106,11 @@ files:
|
|
104
106
|
- test/deglut_spec_test.rb
|
105
107
|
- test/math_tool_test.rb
|
106
108
|
- test/respond_to_test.rb
|
109
|
+
- test/test_create.rb
|
110
|
+
- test/test_deglut_spec.rb
|
111
|
+
- test/test_helper.rb
|
112
|
+
- test/test_math_tool.rb
|
113
|
+
- test/test_respond_to.rb
|
107
114
|
- test/vecmath_spec_test.rb
|
108
115
|
- vendors/Rakefile
|
109
116
|
homepage: https://ruby-processing.github.io/propane/
|
@@ -122,18 +129,23 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
122
129
|
version: '0'
|
123
130
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
124
131
|
requirements:
|
125
|
-
- - "
|
132
|
+
- - ">="
|
126
133
|
- !ruby/object:Gem::Version
|
127
|
-
version:
|
134
|
+
version: '0'
|
128
135
|
requirements: []
|
129
136
|
rubyforge_project:
|
130
|
-
rubygems_version: 2.6.
|
137
|
+
rubygems_version: 2.6.8
|
131
138
|
signing_key:
|
132
139
|
specification_version: 4
|
133
|
-
summary:
|
140
|
+
summary: ruby wrapper for processing-3.3 on MacOS and linux64 bit only for opengl
|
134
141
|
test_files:
|
135
142
|
- test/create_test.rb
|
136
143
|
- test/deglut_spec_test.rb
|
137
144
|
- test/math_tool_test.rb
|
138
145
|
- test/respond_to_test.rb
|
146
|
+
- test/test_create.rb
|
147
|
+
- test/test_deglut_spec.rb
|
148
|
+
- test/test_helper.rb
|
149
|
+
- test/test_math_tool.rb
|
150
|
+
- test/test_respond_to.rb
|
139
151
|
- test/vecmath_spec_test.rb
|