Skip to content

Commit 9799bb7

Browse files
committed
Update samples for propane-2.0 (ie processing 3)
1 parent c6aabbd commit 9799bb7

39 files changed

+246
-102
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# propane-examples
2-
Example Sketches for propane see also [Example-Sketches][examples] for ruby-processing (many of with only need to be class wrapped to run with propane).
2+
Example Sketches for propane-2.0+ see also [Example-Sketches][examples] for ruby-processing (many of with only need to be class wrapped to run with propane).
33

4-
1. Sketches using the [data_path wrapper][path] (yields absolute path to `data` folder). NB without wrapper these sketches would need to be run using jruby-complete (`propane --run sketch.rb` rather than `jruby sketch.rb`
4+
1. Sketches using the [data_path wrapper][path] (yields absolute path to `data` folder).
55

6-
2. Other [sketches][regular], can be run with `propane --run sketch.rb` or `jruby sketch.rb`
6+
2. Other [sketches][regular]
77

88
[path]:https://github.com/ruby-processing/propane-examples/tree/master/data_path
99
[regular]:https://github.com/ruby-processing/propane-examples/tree/master/data_path

data_path/bw_shader.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,12 @@ class BwShader < Propane::App
77

88
attr_reader :label, :can, :angle, :bw_shader
99

10-
def setup
10+
def settings
1111
size(640, 360, P3D)
12+
end
13+
14+
def setup
15+
sketch_title 'Black and White Shader'
1216
@label = load_image(data_path('lachoy.jpg'))
1317
@can = create_can(100, 200, 32, label)
1418
@bw_shader = load_shader(data_path('bwfrag.glsl'))
@@ -44,4 +48,4 @@ def create_can(r, h, detail, tex)
4448
end
4549
end
4650

47-
BwShader.new title: 'Black & White Shader'
51+
BwShader.new

data_path/edge_detection.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,12 @@ class EdgeDetection < Propane::App
1010
KERNEL = [[-1, -1, -1], [-1, 9, -1], [-1, -1, -1]].freeze
1111
attr_reader :img
1212

13-
def setup
13+
def settings
1414
size(640, 360)
15+
end
16+
17+
def setup
18+
sketch_title 'Edge Detection'
1519
@img = load_image(data_path('moon.jpg')) # Load the original image
1620
no_loop
1721
end
@@ -46,4 +50,4 @@ def draw
4650
end
4751
end
4852

49-
EdgeDetection.new title: 'Edge Detection'
53+
EdgeDetection.new

data_path/glsl_heightmap_noise.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,12 @@ class HeightMap < Propane::App
2929
attr_reader :images # array to hold 2 input images
3030
attr_reader :color_map # variable to keep track of the current colorMap
3131

32-
def setup
32+
def settings
3333
size(1280, 720, P3D) # use the P3D OpenGL renderer
34+
end
35+
36+
def setup
37+
sketch_title 'Height Map'
3438
@blur_factor = 3
3539
@resize_factor = 0.25
3640
displace_strength = 0.25 # the displace strength of the GLSL shader displacement effect
@@ -122,4 +126,4 @@ def key_released
122126
end
123127
end
124128

125-
HeightMap.new title: 'Height Map'
129+
HeightMap.new

data_path/kinetic_type.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,12 @@
1313
# dispay them 'words'
1414
class KineticType < Propane::App
1515

16-
def setup
16+
def settings
1717
size(200, 200, P3D)
18+
end
19+
20+
def setup
21+
sketch_title 'Kinetic Type'
1822
frame_rate 30
1923
# Load the font from the sketch's data directory.
2024
text_font loadFont(data_path('Univers45.vlw')), 1.0
@@ -76,4 +80,4 @@ def initialize(c, x, y)
7680
end
7781
end
7882

79-
KineticType.new title: 'Kinetic Type'
83+
KineticType.new

data_path/landscape.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,12 @@ class Landscape < Propane::App
1313
attr_reader :landscape
1414
java_alias :background_int, :background, [Java::int]
1515

16-
def setup
16+
def settings
1717
size(640, 360, P2D)
18+
end
19+
20+
def setup
21+
sketch_title 'Landscape'
1822
no_stroke
1923
# The code of this shader shows how to integrate shaders from shadertoy
2024
# into Processing with minimal changes.
@@ -31,4 +35,4 @@ def draw
3135
end
3236
end
3337

34-
Landscape.new title: 'Landscape'
38+
Landscape.new

data_path/linear_image.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,12 @@
1212
class LinearImage < Propane::App
1313
attr_reader :signal, :img, :direction
1414

15-
def setup
15+
def settings
1616
size(640, 360)
17+
end
18+
19+
def setup
20+
sketch_title 'Linear Image'
1721
stroke(255)
1822
@img = load_image(data_path('sea.jpg'))
1923
@direction = 1
@@ -48,4 +52,4 @@ def draw
4852
end
4953
end
5054

51-
LinearImage.new title: 'Linear Image'
55+
LinearImage.new

data_path/monjori.rb

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,13 @@ class Monjori < Propane::App
1313
# (Look for Monjori under the Plane Deformations Presets)
1414

1515
attr_reader :monjori
16-
17-
def setup
16+
17+
def settings
1818
size(640, 360, P2D)
19+
end
20+
21+
def setup
22+
sketch_title 'Monjori'
1923
no_stroke
2024
@monjori = load_shader(data_path('monjori.glsl'))
2125
monjori.set('resolution', width.to_f, height.to_f)
@@ -32,4 +36,4 @@ def draw
3236
end
3337
end
3438

35-
Monjori.new title: 'Monjori'
39+
Monjori.new

regular/arcball_box.rb

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,21 @@
1111

1212
class ArcballBox < Propane::App
1313

14-
def setup
15-
size(600, 600, P3D)
16-
smooth(8)
17-
Processing::ArcBall.init(self, 300, 300)
18-
fill 180
19-
end
14+
def setup
15+
size(600, 600, P3D)
16+
smooth(8)
17+
end
2018

21-
def draw
22-
background(50)
23-
box(300, 300, 300)
24-
end
19+
def setup
20+
sketch_title 'ArcBall Box'
21+
ArcBall.init(self, 300, 300)
22+
fill 180
23+
end
2524

25+
def draw
26+
background(50)
27+
box(300, 300, 300)
28+
end
2629
end
2730

28-
ArcballBox.new title: 'ArcBall Box'
31+
ArcballBox.new

regular/arcball_constrain.rb

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,13 @@
1212

1313
class ArcballBox < Propane::App
1414

15-
def setup
15+
def settings
1616
size(600, 600, P3D)
1717
smooth(8)
18+
end
19+
20+
def setup
21+
sketch_title 'ArcBall Box'
1822
Processing::ArcBall.constrain(self, :xaxis)
1923
fill 180
2024
end
@@ -23,7 +27,6 @@ def draw
2327
background(50)
2428
box(300, 300, 300)
2529
end
26-
2730
end
2831

29-
ArcballBox.new title: 'ArcBall Box'
32+
ArcballBox.new

0 commit comments

Comments
 (0)