ruby-processing 2.4.4 → 2.5.0
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/lib/rpextras.jar +0 -0
- data/lib/ruby-processing.rb +8 -6
- data/lib/ruby-processing/app.rb +54 -67
- data/lib/ruby-processing/config.rb +7 -7
- data/lib/ruby-processing/exporters/application_exporter.rb +37 -38
- data/lib/ruby-processing/exporters/base_exporter.rb +34 -37
- data/lib/ruby-processing/exporters/creator.rb +27 -25
- data/lib/ruby-processing/helper_methods.rb +18 -22
- data/lib/ruby-processing/helpers/numeric.rb +5 -6
- data/lib/ruby-processing/helpers/string.rb +11 -20
- data/lib/ruby-processing/library_loader.rb +33 -35
- data/lib/ruby-processing/runner.rb +118 -65
- data/lib/ruby-processing/runners/base.rb +21 -26
- data/lib/ruby-processing/runners/live.rb +3 -4
- data/lib/ruby-processing/runners/run.rb +1 -3
- data/lib/ruby-processing/runners/watch.rb +8 -8
- data/lib/ruby-processing/version.rb +1 -1
- data/lib/templates/application/lib/args.txt.erb +1 -1
- data/lib/templates/application/run.erb +3 -3
- data/library/control_panel/control_panel.rb +29 -29
- data/library/fastmath/fastmath.rb +3 -0
- data/library/file_chooser/file_chooser.rb +11 -13
- data/library/vecmath/vecmath.rb +6 -35
- data/samples/Rakefile +3 -1
- data/samples/configRP5/configRP5.pde +150 -0
- data/samples/contributed/Rakefile +6 -6
- data/samples/contributed/animator.rb +6 -6
- data/samples/contributed/bezier_playground.rb +29 -68
- data/samples/contributed/circle_collision.rb +6 -13
- data/samples/contributed/elegant_ball.rb +14 -17
- data/samples/contributed/empathy.rb +8 -5
- data/samples/contributed/fibonacci_sphere.rb +10 -49
- data/samples/contributed/full_screen.rb +1 -1
- data/samples/contributed/grapher.rb +10 -9
- data/samples/contributed/gravity.rb +11 -16
- data/samples/contributed/jwishy.rb +18 -20
- data/samples/contributed/quadraticvertex.rb +26 -26
- data/samples/external_library/java_processing/custom/landscape.rb +6 -4
- data/samples/external_library/java_processing/hemesh/twin_iso.rb +69 -71
- data/samples/external_library/java_processing/pbox2d/bumpy_surface_noise.rb +57 -0
- data/samples/external_library/java_processing/pbox2d/contact_test.rb +23 -0
- data/samples/external_library/java_processing/pbox2d/data/java_args.txt +2 -0
- data/samples/external_library/java_processing/pbox2d/library/custom_shape/custom_shape.rb +158 -0
- data/samples/external_library/java_processing/pbox2d/library/particle_system/particle_system.rb +212 -0
- data/samples/external_library/java_processing/pbox2d/library/surface/surface.rb +154 -0
- data/samples/external_library/java_processing/pbox2d/liquidy.rb +58 -0
- data/samples/external_library/java_processing/pbox2d/polygons.rb +58 -0
- data/samples/external_library/java_processing/toxiclibs/library/vbo/vbo.rb +52 -0
- data/samples/external_library/java_processing/toxiclibs/model_align.rb +9 -16
- data/samples/processing_app/basics/color/color_wheel.rb +1 -1
- data/samples/processing_app/basics/form/regular_polygon.rb +2 -2
- data/samples/processing_app/basics/form/rgb_cube.rb +2 -2
- data/samples/processing_app/basics/form/shape_primitives.rb +1 -1
- data/samples/processing_app/basics/form/star.rb +2 -2
- data/samples/processing_app/basics/input/clock.rb +21 -16
- data/samples/processing_app/basics/input/storing_input.rb +6 -6
- data/samples/processing_app/basics/math/additive_wave.rb +1 -1
- data/samples/processing_app/basics/math/sine.rb +2 -2
- data/samples/processing_app/basics/math/sine_cosine.rb +1 -1
- data/samples/processing_app/basics/math/sine_wave.rb +1 -1
- data/samples/processing_app/basics/objects/inheritance.rb +2 -0
- data/samples/processing_app/basics/objects/inheritance_two.rb +88 -0
- data/samples/processing_app/basics/objects/module.rb +89 -0
- data/samples/processing_app/{library/vecmath/drawolver.rb → basics/objects/module_two.rb} +1 -1
- data/samples/processing_app/basics/objects/multiple_constructors.rb +5 -0
- data/samples/processing_app/basics/objects/struct.rb +38 -0
- data/samples/processing_app/basics/structure/recursion2.rb +1 -1
- data/samples/processing_app/basics/transform/birds.rb +7 -10
- data/samples/processing_app/basics/transform/library/bird/bird.rb +3 -3
- data/samples/processing_app/basics/transform/rotate.rb +1 -1
- data/samples/processing_app/basics/transform/rotate1.rb +1 -1
- data/samples/processing_app/basics/transform/rotate_x_y.rb +1 -1
- data/samples/processing_app/demos/graphics/bezier_patch.rb +1 -38
- data/samples/processing_app/demos/graphics/trefoil.rb +50 -40
- data/samples/processing_app/demos/graphics/wiggling.rb +36 -38
- data/samples/processing_app/demos/performance/cubic_grid_retained.rb +14 -14
- data/samples/processing_app/demos/performance/esfera.rb +27 -39
- data/samples/processing_app/demos/performance/text_rendering.rb +1 -1
- data/samples/processing_app/library/fastmath/clock.rb +44 -0
- data/samples/processing_app/library/pdf/complex_3D.rb +26 -24
- data/samples/processing_app/library/vecmath/{Rakefile → arcball/Rakefile} +6 -6
- data/samples/processing_app/library/vecmath/arcball/arcball_box.rb +23 -0
- data/samples/processing_app/library/vecmath/arcball/arcball_radius.rb +23 -0
- data/samples/processing_app/library/vecmath/arcball/arcball_shape.rb +29 -0
- data/samples/processing_app/library/vecmath/{README.txt → vec2d/README.txt} +0 -0
- data/samples/processing_app/library/vecmath/vec2d/Rakefile +30 -0
- data/samples/processing_app/library/vecmath/{acceleration_with_vectors.rb → vec2d/acceleration_with_vectors.rb} +4 -5
- data/samples/processing_app/library/vecmath/{bouncing_ball.rb → vec2d/bouncing_ball.rb} +9 -15
- data/samples/processing_app/library/vecmath/{circle_collision.rb → vec2d/circle_collision.rb} +46 -51
- data/samples/processing_app/library/vecmath/{data → vec2d/data}/java_args.txt +0 -0
- data/samples/processing_app/library/vecmath/{data → vec2d/data}/sprite.png +0 -0
- data/samples/processing_app/library/vecmath/{data → vec2d/data}/texture.png +0 -0
- data/samples/processing_app/library/vecmath/{flocking.rb → vec2d/flocking.rb} +3 -6
- data/samples/processing_app/library/vecmath/{library → vec2d/library}/flock/flock.rb +47 -67
- data/samples/processing_app/library/vecmath/{library → vec2d/library}/particle/particle_system.rb +5 -5
- data/samples/processing_app/library/vecmath/vec2d/library/tile/tile.rb +85 -0
- data/samples/processing_app/library/vecmath/{morph.rb → vec2d/morph.rb} +17 -16
- data/samples/processing_app/library/vecmath/{multiple_particle_systems.rb → vec2d/multiple_particle_systems.rb} +11 -28
- data/samples/processing_app/library/vecmath/{particle_system_pshape.rb → vec2d/particle_system_pshape.rb} +4 -6
- data/samples/processing_app/library/vecmath/vec2d/penrose.rb +71 -0
- data/samples/processing_app/library/vecmath/{reflection1.rb → vec2d/reflection1.rb} +6 -6
- data/samples/processing_app/library/vecmath/{seeking_neural.rb → vec2d/seeking_neural.rb} +12 -16
- data/samples/processing_app/library/vecmath/{simple_particle_system.rb → vec2d/simple_particle_system.rb} +8 -12
- data/samples/processing_app/library/vecmath/{smoke_particle_system.rb → vec2d/smoke_particle_system.rb} +8 -13
- data/samples/processing_app/library/vecmath/{vector_math.rb → vec2d/vector_math.rb} +0 -0
- data/samples/processing_app/library/vecmath/{library/wiggler/wiggler.rb → vec2d/wiggle_pshape.rb} +28 -4
- data/samples/processing_app/library/vecmath/vec3d/Rakefile +30 -0
- data/samples/processing_app/library/vecmath/vec3d/drawolver.rb +86 -0
- data/samples/processing_app/library/vecmath/vec3d/frame_of_reference.rb +103 -0
- data/samples/processing_app/library/vecmath/{hilbert_fractal.rb → vec3d/hilbert_fractal.rb} +5 -33
- data/samples/processing_app/library/vecmath/vec3d/library/geometry/geometry.rb +3 -0
- data/samples/processing_app/library/vecmath/vec3d/library/geometry/lib/cylinder.rb +44 -0
- data/samples/processing_app/library/vecmath/vec3d/library/geometry/lib/mat4.rb +28 -0
- data/samples/processing_app/library/vecmath/vec3d/library/geometry/lib/plane.rb +60 -0
- data/samples/processing_app/library/vecmath/{library → vec3d/library}/hilbert/hilbert.rb +14 -17
- data/samples/processing_app/library/vecmath/{retained_menger.rb → vec3d/retained_menger.rb} +20 -55
- data/samples/processing_app/topics/advanced_data/Rakefile +6 -6
- data/samples/processing_app/topics/advanced_data/counting_words.rb +7 -7
- data/samples/processing_app/topics/advanced_data/data/data.xml +0 -15
- data/samples/processing_app/topics/advanced_data/data/struct_data.yml +5 -0
- data/samples/processing_app/topics/advanced_data/library/bubble/bubble.rb +8 -8
- data/samples/processing_app/topics/advanced_data/load_save_XML.rb +41 -42
- data/samples/processing_app/topics/advanced_data/load_save_json.rb +11 -11
- data/samples/processing_app/topics/advanced_data/load_save_struct_yaml.rb +22 -23
- data/samples/processing_app/topics/advanced_data/load_save_table.rb +12 -12
- data/samples/processing_app/topics/advanced_data/load_save_yaml.rb +10 -12
- data/samples/processing_app/topics/advanced_data/regex.rb +5 -6
- data/samples/processing_app/topics/advanced_data/threads.rb +27 -27
- data/samples/processing_app/topics/advanced_data/threads_two.rb +3 -2
- data/samples/processing_app/topics/advanced_data/word_frequency.rb +18 -16
- data/samples/processing_app/topics/advanced_data/yahoo_weather.rb +6 -5
- data/samples/processing_app/topics/animation/animated_sprite.rb +9 -7
- data/samples/processing_app/topics/animation/sequential.rb +19 -19
- data/samples/processing_app/topics/cellular_automata/library/ca/ca.rb +1 -1
- data/samples/processing_app/topics/cellular_automata/wolfram.rb +1 -1
- data/samples/processing_app/topics/create_shapes/begin_end_contour.rb +1 -1
- data/samples/processing_app/topics/create_shapes/library/wiggler/wiggler.rb +4 -4
- data/samples/processing_app/topics/create_shapes/particle_system_pshape.rb +2 -2
- data/samples/processing_app/topics/create_shapes/path_pshape.rb +1 -1
- data/samples/processing_app/topics/create_shapes/polygon_pshape_oo3.rb +1 -1
- data/samples/processing_app/topics/create_shapes/polygon_shape.rb +3 -3
- data/samples/processing_app/topics/file_io/load_file1.rb +1 -1
- data/samples/processing_app/topics/file_io/save_frames.rb +5 -5
- data/samples/processing_app/topics/file_io/save_one_image.rb +2 -2
- data/samples/processing_app/topics/file_io/tile_images.rb +1 -1
- data/samples/processing_app/topics/gui/scrollbar.rb +3 -3
- data/samples/processing_app/topics/image_processing/blending.rb +13 -13
- data/samples/processing_app/topics/image_processing/blur.rb +1 -1
- data/samples/processing_app/topics/image_processing/brightness.rb +1 -1
- data/samples/processing_app/topics/image_processing/convolution.rb +1 -1
- data/samples/processing_app/topics/image_processing/edge_detection.rb +4 -4
- data/samples/processing_app/topics/image_processing/explode.rb +1 -1
- data/samples/processing_app/topics/image_processing/extrusion.rb +1 -1
- data/samples/processing_app/topics/image_processing/histogram.rb +1 -1
- data/samples/processing_app/topics/image_processing/linear_image.rb +1 -1
- data/samples/processing_app/topics/image_processing/pixel_array.rb +1 -1
- data/samples/processing_app/topics/image_processing/zoom.rb +2 -2
- data/samples/processing_app/topics/lsystems/Rakefile +6 -6
- data/samples/processing_app/topics/lsystems/chequer.rb +4 -10
- data/samples/processing_app/topics/lsystems/csplant.rb +25 -25
- data/samples/processing_app/topics/lsystems/cstest.rb +9 -4
- data/samples/processing_app/topics/lsystems/david_tour.rb +14 -16
- data/samples/processing_app/topics/lsystems/koch.rb +8 -18
- data/samples/processing_app/topics/lsystems/library/cs_grammar/cs_grammar.rb +18 -24
- data/samples/processing_app/topics/lsystems/library/grammar/grammar.rb +7 -9
- data/samples/processing_app/topics/lsystems/library/koch/koch_fractal.rb +75 -94
- data/samples/processing_app/topics/lsystems/library/stochastic_grammar/stochastic_grammar.rb +11 -13
- data/samples/processing_app/topics/lsystems/mpeano.rb +29 -32
- data/samples/processing_app/topics/lsystems/peano.rb +19 -21
- data/samples/processing_app/topics/lsystems/penrose.rb +31 -37
- data/samples/processing_app/topics/lsystems/penrose_snowflake.rb +10 -15
- data/samples/processing_app/topics/lsystems/pentagonal.rb +20 -23
- data/samples/processing_app/topics/lsystems/snake_kolam.rb +13 -13
- data/samples/processing_app/topics/lsystems/stochastic_test.rb +25 -28
- data/samples/processing_app/topics/lsystems/three_d_tree.rb +25 -24
- data/samples/processing_app/topics/motion/bouncy_bubbles.rb +17 -17
- data/samples/processing_app/topics/motion/cubes_in_cube.rb +1 -3
- data/samples/processing_app/topics/motion/library/cube/cube.rb +2 -2
- data/samples/processing_app/topics/motion/reflection2.rb +1 -1
- data/samples/processing_app/topics/shaders/blur_filter.rb +3 -3
- data/samples/processing_app/topics/shaders/bw_shader.rb +3 -3
- data/samples/processing_app/topics/shaders/conway.rb +5 -5
- data/samples/processing_app/topics/shaders/deform.rb +5 -5
- data/samples/processing_app/topics/shaders/edge_detect.rb +3 -5
- data/samples/processing_app/topics/shaders/glossy_fish_eye.rb +15 -21
- data/samples/processing_app/topics/shaders/glsl_heightmap_noise.rb +21 -19
- data/samples/processing_app/topics/shaders/image_mask.rb +6 -6
- data/samples/processing_app/topics/shaders/landscape.rb +4 -4
- data/samples/processing_app/topics/shaders/monjori.rb +15 -15
- data/samples/processing_app/topics/shaders/nebula.rb +3 -3
- data/samples/processing_app/topics/shaders/sep_blur.rb +15 -15
- data/samples/processing_app/topics/shaders/toon_shading.rb +2 -2
- data/samples/processing_app/topics/simulate/chain.rb +16 -14
- data/samples/processing_app/topics/simulate/smoke_particle_system.rb +3 -3
- data/samples/processing_app/topics/vectors/acceleration_with_vectors.rb +3 -2
- data/samples/processing_app/topics/vectors/bouncing_ball.rb +1 -0
- data/samples/processing_app/topics/vectors/vector_math.rb +2 -1
- data/vendors/Rakefile +15 -3
- metadata +99 -86
- data/.gitignore +0 -13
- data/.travis.yml +0 -6
- data/.yardopts +0 -5
- data/CHANGELOG +0 -316
- data/CONTRIBUTING.md +0 -35
- data/Gemfile +0 -6
- data/LICENSE.md +0 -39
- data/README.md +0 -119
- data/Rakefile +0 -37
- data/bin/install_jruby_complete +0 -13
- data/lib/ruby-processing/exporters/exporters.rb +0 -7
- data/library/vecmath/lib/arcball.rb +0 -64
- data/library/vecmath/lib/quaternion.rb +0 -62
- data/library/vecmath/lib/vec.rb +0 -232
- data/ruby-processing.gemspec +0 -54
- data/samples/processing_app/library/pdf/.gitignore +0 -1
- data/samples/processing_app/library/vecmath/retained_test.rb +0 -65
- data/samples/processing_app/library/vecmath/retained_test2.rb +0 -65
- data/samples/processing_app/library/vecmath/wiggle_pshape.rb +0 -22
- data/test/README.md +0 -6
- data/test/basic.rb +0 -14
- data/test/draw_ex.rb +0 -12
- data/test/graphics.rb +0 -7
- data/test/p2d.rb +0 -14
- data/test/p3d.rb +0 -14
- data/test/rp5_test.rb +0 -86
- data/test/setup_ex.rb +0 -12
data/ruby-processing.gemspec
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
# coding: utf-8
|
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
-
require 'ruby-processing/version'
|
|
5
|
-
|
|
6
|
-
Gem::Specification.new do |spec|
|
|
7
|
-
spec.name = "ruby-processing"
|
|
8
|
-
spec.version = RubyProcessing::VERSION
|
|
9
|
-
spec.authors = ["Jeremy Ashkenas", "Peter Gassner", "Martin Stannard", "Andrew Nanton",
|
|
10
|
-
"Marc Chung", "Peter Krenn", "Florian Jenett", "Andreas Haller",
|
|
11
|
-
"Juris Galang", "Guillaume Pierronnet", "Martin Prout"]
|
|
12
|
-
spec.email = "jeremy@ashkenas.com"
|
|
13
|
-
spec.description = <<-EOS
|
|
14
|
-
|
|
15
|
-
Ruby-Processing is a Ruby wrapper for the Processing code art framework. It's
|
|
16
|
-
this thin little shim that squeezes between Processing and JRuby, passing
|
|
17
|
-
along some neat goodies like:
|
|
18
|
-
|
|
19
|
-
* Application exporting of your sketches. Hand them out to your party guests,
|
|
20
|
-
ready-to-run.
|
|
21
|
-
|
|
22
|
-
* Live Coding via JRuby's IRB. Loads in your sketch so you can futz with
|
|
23
|
-
variables and remake methods on the fly.
|
|
24
|
-
|
|
25
|
-
* Bare sketches. Write your Ruby-Processing sketches without having to define
|
|
26
|
-
a class. Without defining methods, even.
|
|
27
|
-
|
|
28
|
-
* A "Control Panel" library, so that you can easily create sliders, buttons,
|
|
29
|
-
checkboxes and drop-down menus, and hook them into your sketch's instance
|
|
30
|
-
variables.
|
|
31
|
-
|
|
32
|
-
* "Watch" mode, where Ruby-Processing keeps an eye on your sketch and reloads
|
|
33
|
-
it from scratch every time you make a change. A pretty nice REPL-ish way
|
|
34
|
-
to work on your Processing sketches.
|
|
35
|
-
|
|
36
|
-
EOS
|
|
37
|
-
spec.summary = %q{Code as Art, Art as Code. Processing and Ruby are meant for each other.}
|
|
38
|
-
spec.homepage = "http://wiki.github.com/jashkenas/ruby-processing"
|
|
39
|
-
spec.executables = ["rp5", "install_jruby_complete"]
|
|
40
|
-
spec.license = 'MIT'
|
|
41
|
-
|
|
42
|
-
spec.files = `git ls-files`.split($/)
|
|
43
|
-
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
|
44
|
-
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
|
45
|
-
|
|
46
|
-
spec.add_development_dependency "bundler", "~> 1.3"
|
|
47
|
-
spec.add_development_dependency "rake", "~> 10.0"
|
|
48
|
-
spec.add_development_dependency "minitest", "~> 5.1"
|
|
49
|
-
spec.requirements << 'A decent graphics card'
|
|
50
|
-
spec.requirements << 'java runtime >= 1.6+'
|
|
51
|
-
spec.requirements << 'processing = 2.0.3+'
|
|
52
|
-
|
|
53
|
-
end
|
|
54
|
-
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
*.pdf
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
load_library :vecmath
|
|
2
|
-
import "vecmath"
|
|
3
|
-
|
|
4
|
-
X = 0
|
|
5
|
-
Y = 1
|
|
6
|
-
Z = 2
|
|
7
|
-
|
|
8
|
-
attr_reader :my_ball, :my_cube
|
|
9
|
-
|
|
10
|
-
def setup
|
|
11
|
-
size(600, 600, P3D)
|
|
12
|
-
smooth(16)
|
|
13
|
-
@my_ball = ArcBall.new(width/2.0, height/2.0, min(width - 20, height - 20) * 0.5)
|
|
14
|
-
@my_cube = create_shape(BOX, my_ball.radius, my_ball.radius, my_ball.radius)
|
|
15
|
-
my_cube.set_fill(color(100, 10, 100))
|
|
16
|
-
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
def draw
|
|
20
|
-
background(50, 50, 100)
|
|
21
|
-
translate(width/2.0, height/2.0) # @todo add zoom via z, using control_panel
|
|
22
|
-
define_lights
|
|
23
|
-
update
|
|
24
|
-
lights
|
|
25
|
-
stroke(0)
|
|
26
|
-
shape(my_cube)
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
def update
|
|
30
|
-
theta, x, y, z = my_ball.update
|
|
31
|
-
rotate(theta, x, y, z)
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
def mouse_pressed
|
|
35
|
-
my_ball.mouse_pressed(mouse_x, mouse_y)
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
def mouse_dragged
|
|
39
|
-
my_ball.mouse_dragged(mouse_x, mouse_y)
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
def define_lights
|
|
43
|
-
ambient(20, 20, 20)
|
|
44
|
-
ambient_light(50, 50, 50)
|
|
45
|
-
point_light(30, 30, 30, 200, -150, 0)
|
|
46
|
-
directional_light(0, 30, 50, 1, 0, 0)
|
|
47
|
-
spot_light(30, 30, 30, 0, 40, 200, 0, -0.5, -0.5, PI / 2, 2)
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
def key_pressed
|
|
51
|
-
case(key)
|
|
52
|
-
when 'x'
|
|
53
|
-
my_ball.select_axis(X)
|
|
54
|
-
when 'y'
|
|
55
|
-
my_ball.select_axis(Y)
|
|
56
|
-
when 'z'
|
|
57
|
-
my_ball.select_axis(Z)
|
|
58
|
-
end
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
def key_released
|
|
62
|
-
my_ball.select_axis(-1)
|
|
63
|
-
end
|
|
64
|
-
|
|
65
|
-
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
load_library 'vecmath'
|
|
2
|
-
import "vecamth"
|
|
3
|
-
|
|
4
|
-
X = 0
|
|
5
|
-
Y = 1
|
|
6
|
-
Z = 2
|
|
7
|
-
|
|
8
|
-
attr_reader :my_ball, :my_cube
|
|
9
|
-
|
|
10
|
-
def setup
|
|
11
|
-
size(600, 600, P3D)
|
|
12
|
-
smooth(16)
|
|
13
|
-
@my_ball = ArcBall.new(width/2.0, height/2.0, min(width - 20, height - 20) * 0.5)
|
|
14
|
-
@my_cube = create_shape(BOX, my_ball.radius, my_ball.radius, my_ball.radius)
|
|
15
|
-
my_cube.set_fill(color(100, 10, 100))
|
|
16
|
-
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
def draw
|
|
20
|
-
background(50, 50, 100)
|
|
21
|
-
translate(width/2.0, height/2.0) # @todo add zoom via z, using control_panel
|
|
22
|
-
define_lights
|
|
23
|
-
update
|
|
24
|
-
lights
|
|
25
|
-
stroke(0)
|
|
26
|
-
shape(my_cube)
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
def update
|
|
30
|
-
theta, x, y, z = my_ball.update
|
|
31
|
-
rotate(theta, x, y, z)
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
def mouse_pressed
|
|
35
|
-
my_ball.mouse_pressed(mouse_x, mouse_y)
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
def mouse_dragged
|
|
39
|
-
my_ball.mouse_dragged(mouse_x, mouse_y)
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
def define_lights
|
|
43
|
-
ambient(20, 20, 20)
|
|
44
|
-
ambient_light(50, 50, 50)
|
|
45
|
-
point_light(30, 30, 30, 200, -150, 0)
|
|
46
|
-
directional_light(0, 30, 50, 1, 0, 0)
|
|
47
|
-
spot_light(30, 30, 30, 0, 40, 200, 0, -0.5, -0.5, PI / 2, 2)
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
def key_pressed
|
|
51
|
-
case(key)
|
|
52
|
-
when 'x'
|
|
53
|
-
my_ball.select_axis(X)
|
|
54
|
-
when 'y'
|
|
55
|
-
my_ball.select_axis(Y)
|
|
56
|
-
when 'z'
|
|
57
|
-
my_ball.select_axis(Z)
|
|
58
|
-
end
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
def key_released
|
|
62
|
-
my_ball.select_axis(-1)
|
|
63
|
-
end
|
|
64
|
-
|
|
65
|
-
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
#
|
|
2
|
-
# WigglePShape.
|
|
3
|
-
#
|
|
4
|
-
# How to move the individual vertices of a PShape
|
|
5
|
-
#
|
|
6
|
-
load_library :vecmath # NB: load vecmath library here
|
|
7
|
-
load_library :wiggler
|
|
8
|
-
|
|
9
|
-
attr_reader :wiggler
|
|
10
|
-
|
|
11
|
-
def setup
|
|
12
|
-
size(640, 360, P2D)
|
|
13
|
-
@wiggler = Wiggler.new width, height
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
def draw
|
|
17
|
-
background(255)
|
|
18
|
-
wiggler.display
|
|
19
|
-
wiggler.wiggle
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
|
data/test/README.md
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
Minitest
|
|
2
|
-
========
|
|
3
|
-
|
|
4
|
-
OK strictly the tests should directly test objects, rather than the indirect tests on io here. These test make use of minitest capture_io (this seems to require real files rather than temp files?). Also there seems to be some problem with how the built in version minitest run so I've specified gem "minitest". The graphics test is designed to fail if your graphics setup does not supports opengl 3+, this may not be fatal, but as message states is probably suboptimal.
|
|
5
|
-
|
|
6
|
-
[gist]:https://gist.github.com/monkstone/6145906
|
data/test/basic.rb
DELETED
data/test/draw_ex.rb
DELETED
data/test/graphics.rb
DELETED
data/test/p2d.rb
DELETED
data/test/p3d.rb
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
java_alias :background_float_float_float, :background, [Java::float, Java::float, Java::float]
|
|
2
|
-
|
|
3
|
-
def setup
|
|
4
|
-
size(300, 300, P3D)
|
|
5
|
-
frame_rate(10)
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
def draw
|
|
9
|
-
background_float_float_float 39, 232, 51
|
|
10
|
-
if frame_count == 3
|
|
11
|
-
puts "ok"
|
|
12
|
-
exit
|
|
13
|
-
end
|
|
14
|
-
end
|
data/test/rp5_test.rb
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
gem "minitest" # don't use bundled minitest
|
|
2
|
-
require "minitest/autorun"
|
|
3
|
-
|
|
4
|
-
Minitest::Test = MiniTest::Unit::TestCase unless defined?(Minitest::Test)
|
|
5
|
-
|
|
6
|
-
Dir.chdir(File.dirname(__FILE__))
|
|
7
|
-
|
|
8
|
-
class Rp5Test < Minitest::Test
|
|
9
|
-
|
|
10
|
-
def test_normal
|
|
11
|
-
out, err = capture_io do
|
|
12
|
-
open("|../bin/rp5 run basic.rb", "r") do |io|
|
|
13
|
-
while l = io.gets
|
|
14
|
-
puts(l.chop)
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
assert_match %r%ok%, out, "Failed Basic Sketch"
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
def test_p2d
|
|
22
|
-
out, err = capture_io do
|
|
23
|
-
open("|../bin/rp5 run p2d.rb", "r") do |io|
|
|
24
|
-
while l = io.gets
|
|
25
|
-
puts(l.chop)
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
assert_match %r%ok%, out, "Failed P2D sketch"
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
def test_proc_root
|
|
33
|
-
require 'psych'
|
|
34
|
-
path = File.expand_path("~/.rp5rc")
|
|
35
|
-
config = File.exist?(path)? Psych.load_file(path) : {}
|
|
36
|
-
root = config.empty? ? '' : config['PROCESSING_ROOT']
|
|
37
|
-
assert root =~ /processing/, "You need to set your PROCESSING_ROOT in .rp5rc"
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
def test_p3d
|
|
42
|
-
out, err = capture_io do
|
|
43
|
-
open("|../bin/rp5 run p3d.rb", "r") do |io|
|
|
44
|
-
while l = io.gets
|
|
45
|
-
puts(l.chop)
|
|
46
|
-
end
|
|
47
|
-
end
|
|
48
|
-
end
|
|
49
|
-
assert_match %r%ok%, out, "Failed P3D sketch"
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
def test_graphics
|
|
53
|
-
out, err = capture_io do
|
|
54
|
-
open("|../bin/rp5 run graphics.rb", "r") do |io|
|
|
55
|
-
while l = io.gets
|
|
56
|
-
puts(l.chop)
|
|
57
|
-
end
|
|
58
|
-
end
|
|
59
|
-
end
|
|
60
|
-
assert out[0].to_i >= 3, "Graphics capability #{out} may be sub-optimal"
|
|
61
|
-
end
|
|
62
|
-
|
|
63
|
-
def test_setup_exception
|
|
64
|
-
out, err = capture_io do
|
|
65
|
-
open("|../bin/rp5 run setup_ex.rb", "r") do |io|
|
|
66
|
-
while l = io.gets
|
|
67
|
-
puts(l.chop)
|
|
68
|
-
end
|
|
69
|
-
end
|
|
70
|
-
end
|
|
71
|
-
assert out.index("undefined method `unknown_method'"), "Failed to raise exception?"
|
|
72
|
-
end
|
|
73
|
-
|
|
74
|
-
def test_draw_exception
|
|
75
|
-
out, err = capture_io do
|
|
76
|
-
open("|../bin/rp5 run draw_ex.rb", "r") do |io|
|
|
77
|
-
while l = io.gets
|
|
78
|
-
puts(l.chop)
|
|
79
|
-
end
|
|
80
|
-
end
|
|
81
|
-
end
|
|
82
|
-
assert out.index("undefined method `unknown_method'"), "Failed to raise exception"
|
|
83
|
-
end
|
|
84
|
-
end
|
|
85
|
-
|
|
86
|
-
|