jruby_art 1.0.7 → 1.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/jruby_art/app.rb +10 -4
- data/lib/jruby_art/helper_methods.rb +14 -1
- data/lib/jruby_art/runner.rb +0 -12
- data/lib/jruby_art/runners/base.rb +2 -2
- data/lib/jruby_art/version.rb +1 -1
- data/lib/rpextras.jar +0 -0
- data/vendors/Rakefile +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0d4599fd8c0c7d899d61ea1e1ecca52d32121e98
|
4
|
+
data.tar.gz: fe74a65d0f2eea372b0e21c3b907a36277dcec67
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 09f2e4a8f740b67d5b044cd7e9c4a22399c24aa58a974752c9f2f7acaabfbfe387cc7b7bcda901416492301c5306ca70f6d937dc359c39bbae1266925c1aca23
|
7
|
+
data.tar.gz: e0dde3f5d1cc6ea6bcb24874df72ad5c4c7537c6c051c9821d543c77942742c1863c6e3078af1b58d278d5cd9cb8c709463b99a7724095158f7067e077d01c32
|
data/lib/jruby_art/app.rb
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
# frozen_string_literal: false
|
3
3
|
|
4
4
|
require 'java'
|
5
|
+
# require 'jruby/core_ext'
|
5
6
|
require_relative '../rpextras'
|
6
7
|
require_relative '../jruby_art/helper_methods'
|
7
8
|
require_relative '../jruby_art/helpers/aabb'
|
@@ -89,16 +90,15 @@ module Processing
|
|
89
90
|
def library_loaded?(library_name)
|
90
91
|
self.class.library_loaded?(library_name)
|
91
92
|
end
|
92
|
-
|
93
|
+
|
93
94
|
# Since processing-3.0 you should prefer setting the sketch width and
|
94
95
|
# height and renderer using the size method in the settings loop of the
|
95
96
|
# sketch (as with vanilla processing) but is hidden see created java.
|
96
97
|
# Options are no longer relevant, define post_initialize method to use
|
97
98
|
# custom options (see Sandi Metz POODR)
|
98
99
|
|
99
|
-
def initialize
|
100
|
+
def initialize
|
100
101
|
super()
|
101
|
-
post_initialize(options) # for anyone wishing to pass options
|
102
102
|
$app = self
|
103
103
|
proxy_java_fields
|
104
104
|
mix_proxy_into_inner_classes
|
@@ -111,7 +111,7 @@ module Processing
|
|
111
111
|
# NB: this is the processing runSketch() method as used by processing.py
|
112
112
|
run_sketch
|
113
113
|
end
|
114
|
-
|
114
|
+
|
115
115
|
def size(*args)
|
116
116
|
w, h, mode = *args
|
117
117
|
@width ||= w
|
@@ -125,6 +125,11 @@ module Processing
|
|
125
125
|
surface.set_title(title)
|
126
126
|
end
|
127
127
|
|
128
|
+
def sketchPath(spath = nil)
|
129
|
+
return super() if spath.nil?
|
130
|
+
super(spath)
|
131
|
+
end
|
132
|
+
|
128
133
|
def sketch_size(x, y)
|
129
134
|
surface.set_size(x, y)
|
130
135
|
end
|
@@ -177,6 +182,7 @@ module Processing
|
|
177
182
|
java_import format('processing.opengl.%s', klass)
|
178
183
|
end
|
179
184
|
end
|
185
|
+
# become_java!
|
180
186
|
end # Processing::App
|
181
187
|
|
182
188
|
# @HACK purists may prefer 'forwardable' to the use of Proxy
|
@@ -25,6 +25,14 @@ module Processing
|
|
25
25
|
up: Vec3D.new(0, 1.0, 0))
|
26
26
|
camera(eye.x, eye.y, eye.z, center.x, center.y, center.z, up.x, up.y, up.z)
|
27
27
|
end
|
28
|
+
|
29
|
+
def perspektiv(
|
30
|
+
fov: Math::PI / 3.0,
|
31
|
+
aspect_ratio: width.to_f / height,
|
32
|
+
near_z: (height / 20.0) / tan(fov / 2.0),
|
33
|
+
far_z: (height * 5) / tan(fov / 2.0))
|
34
|
+
perspective(fov, aspect_ratio, near_z, far_z)
|
35
|
+
end
|
28
36
|
|
29
37
|
# A nice method to run a given block for a grid.
|
30
38
|
# Lifted from action_coding/Nodebox.
|
@@ -41,6 +49,11 @@ module Processing
|
|
41
49
|
def lerp_color(*args)
|
42
50
|
args.length > 3 ? self.class.lerp_color(*args) : super(*args)
|
43
51
|
end
|
52
|
+
|
53
|
+
# hue, sat, brightness in range 0..1.0 returns RGB color int
|
54
|
+
def hsb_color(hue, sat, brightness)
|
55
|
+
Java::Monkstone::ColorUtil.hsbToRgB(hue, sat, brightness)
|
56
|
+
end
|
44
57
|
|
45
58
|
def color(*args)
|
46
59
|
return super(*args) unless args.length == 1
|
@@ -106,7 +119,7 @@ module Processing
|
|
106
119
|
# Proxy over a list of Java declared fields that have the same name as
|
107
120
|
# some methods. Add to this list as needed.
|
108
121
|
def proxy_java_fields
|
109
|
-
fields = %w(
|
122
|
+
fields = %w(key frameRate mousePressed keyPressed)
|
110
123
|
methods = fields.map { |field| java_class.declared_field(field) }
|
111
124
|
@declared_fields = Hash[fields.zip(methods)]
|
112
125
|
end
|
data/lib/jruby_art/runner.rb
CHANGED
@@ -201,7 +201,6 @@ module Processing
|
|
201
201
|
def discover_java_args(sketch)
|
202
202
|
arg_file = "#{File.dirname(sketch)}/data/java_args.txt"
|
203
203
|
args = []
|
204
|
-
args += dock_icon
|
205
204
|
if FileTest.exist?(arg_file)
|
206
205
|
args += File.read(arg_file).split(/\s+/)
|
207
206
|
elsif Processing::RP_CONFIG['java_args']
|
@@ -260,16 +259,5 @@ module Processing
|
|
260
259
|
data['JRUBY'] = 'true'
|
261
260
|
open(path, 'w:UTF-8') { |f| f.write(data.to_yaml) }
|
262
261
|
end
|
263
|
-
|
264
|
-
# On the Mac, we can display a fat, shiny ruby in the Dock.
|
265
|
-
def dock_icon
|
266
|
-
@os ||= host_os
|
267
|
-
icon = []
|
268
|
-
if os == :mac
|
269
|
-
icon << '-Xdock:name=JRubyArt'
|
270
|
-
icon << "-Xdock:icon=#{K9_ROOT}/lib/templates/application/Contents/Resources/sketch.icns"
|
271
|
-
end
|
272
|
-
icon
|
273
|
-
end
|
274
262
|
end # class Runner
|
275
263
|
end # module Processing
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
# frozen_string_literal: false
|
3
3
|
SKETCH_PATH ||= ARGV.shift
|
4
|
-
SKETCH_ROOT ||= File.dirname(SKETCH_PATH)
|
4
|
+
SKETCH_ROOT ||= File.absolute_path(File.dirname(SKETCH_PATH))
|
5
5
|
|
6
6
|
# we can safely require app.rb as we are using a jruby runtime
|
7
7
|
require_relative '../app'
|
@@ -41,7 +41,7 @@ module Processing
|
|
41
41
|
end
|
42
42
|
code = no_methods ? format(NAKED_WRAP, source) : format(BARE_WRAP, source)
|
43
43
|
Object.class_eval code, SKETCH_PATH, -1
|
44
|
-
Processing::App.sketch_class.new
|
44
|
+
Processing::App.sketch_class.new unless $app
|
45
45
|
end
|
46
46
|
|
47
47
|
# Read in the sketch source code. Needs to work both online and offline.
|
data/lib/jruby_art/version.rb
CHANGED
data/lib/rpextras.jar
CHANGED
Binary file
|
data/vendors/Rakefile
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jruby_art
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Ashkenas
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2016-05-
|
13
|
+
date: 2016-05-19 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rake
|
@@ -18,14 +18,14 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - "~>"
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: '
|
21
|
+
version: '11.1'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
requirements:
|
26
26
|
- - "~>"
|
27
27
|
- !ruby/object:Gem::Version
|
28
|
-
version: '
|
28
|
+
version: '11.1'
|
29
29
|
- !ruby/object:Gem::Dependency
|
30
30
|
name: minitest
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|
@@ -41,7 +41,7 @@ dependencies:
|
|
41
41
|
- !ruby/object:Gem::Version
|
42
42
|
version: '5.8'
|
43
43
|
description: " JRubyArt is a ruby wrapper for the processing art framework.\n This
|
44
|
-
version supports processing-3.
|
44
|
+
version supports processing-3.1.1, and uses jruby-9.1.0.0 as the glue \n between
|
45
45
|
ruby and java. You can use both processing libraries and ruby gems \n in your sketches.
|
46
46
|
Features create/run/watch/live modes. The \"watch\" mode,\n provides a nice REPL-ish
|
47
47
|
way to work on your processing sketches. Includes:-\n A \"Control Panel\" library,
|