Skip to content

Commit b6a3a5a

Browse files
committed
Add a CHANGELOG
1 parent e724bdf commit b6a3a5a

File tree

5 files changed

+81
-4
lines changed

5 files changed

+81
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
**v2.6** Update examples for hemesh-6.0.1, update pixelflow examples add more gui examples including skatolo

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# JRubyArt-examples for JRubyArt-1.4.0+
1+
# JRubyArt-examples for JRubyArt-1.4.5+
22
Replaces `$app` with `Processing.app`, new `library_loader` (_but latter change should be transparent_).
33
Uses a simplified `control_panel` interface, ie use `c.title('PanelTitle')` instead of `c.title = 'PanelTitle'`, the old examples still work with the the latest version of JRubyArt, but these examples require the latest version.
44

contributed/mushrooms.rb

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# 3D mushrooms by Nik
2+
# http://www.local-guru.net/blog">guru</a>
3+
4+
def setup
5+
sketch_title 'Mushrooms'
6+
ArcBall.init self
7+
end
8+
9+
def draw
10+
background(0)
11+
lights
12+
fill 127, 64, 0
13+
beginShape
14+
vertex(-100,100,-100)
15+
vertex(-100,100,100)
16+
vertex(100,100,100)
17+
vertex(100,100,-100)
18+
endShape
19+
20+
draw_mushroom
21+
rotateY(PI)
22+
translate(10,35,0)
23+
scale(0.65)
24+
25+
draw_mushroom
26+
27+
end
28+
29+
def draw_mushroom
30+
# stem
31+
fill 205, 199, 176
32+
noStroke
33+
(0..20).each do |i|
34+
35+
beginShape(QUAD_STRIP)
36+
ofx1 = cos(i * PI / 20) * 20 + 20
37+
ofx2 = cos((i + 1) * PI / 20) * 20 + 20
38+
(0..11).each do |a|
39+
vertex(cos(a * PI / 5) * 10 + ofx1, 5 * i, sin(a * PI / 5) * 10)
40+
vertex(cos(a * PI / 5) * 10 + ofx2, 5 * (i+1), sin(a * PI / 5) * 10)
41+
end
42+
endShape
43+
end
44+
# cap
45+
46+
pushMatrix
47+
translate(40,0,0)
48+
beginShape(TRIANGLE_STRIP)
49+
step = 10.radians
50+
alpha = 50
51+
(0..PI / 2).step(step) do |i|
52+
sini = sin(i)
53+
cosi = cos(i)
54+
sinip = sin((i + step))
55+
cosip = cos((i + step))
56+
(0..TWO_PI).step(step) do |j|
57+
sinj = sin(j)
58+
cosj = cos(j)
59+
sinjp = sin(j + step)
60+
cosjp = cos(j + step)
61+
# Upper hemisphere
62+
vertex(alpha * cosj * sini, alpha * -cosi, alpha * sinj * sini) # x, y, z
63+
vertex(alpha * cosjp * sini, alpha * -cosi, alpha * sinjp * sini)
64+
vertex(alpha * cosj * sinip, alpha * -cosip, alpha * sinj * sinip)
65+
vertex(alpha * cosjp * sinip, alpha * -cosip, alpha * sinjp * sinip)
66+
end
67+
end
68+
endShape
69+
popMatrix
70+
end
71+
def settings
72+
size(300,300,P3D)
73+
end
2.48 KB
Loading

external_library/gem/toxiclibs/mesh/povmesh/tentacle.rb

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# A 3D Tentacle by Nikolaus Gradwohl http://www.local-guru.net
44
# Adapted for JRubyArt and mesh to PShape, and mesh2 export by Martin Prout
55

6-
attr_reader :mesh, :gfx, :tentacle
6+
attr_reader :mesh, :gfx, :tentacle, :tex
77

88
def settings
99
size(500, 500, P3D)
@@ -13,6 +13,7 @@ def setup
1313
sketch_title 'Tentacle'
1414
ArcBall.init(self)
1515
@gfx = Gfx::MeshToVBO.new(self)
16+
@tex = load_image(data_path('texture.png'))
1617
volume = VolumetricSpaceArray.new(TVec3D.new(100, 200, 100), 100, 100, 100)
1718
surface = ArrayIsoSurface.new(volume)
1819
@mesh = TriangleMesh.new
@@ -37,7 +38,7 @@ def setup
3738
surface.reset
3839
surface.compute_surface_mesh(mesh, 0.5)
3940
no_stroke
40-
@tentacle = gfx.mesh_to_shape(mesh, true)
41+
@tentacle = gfx.mesh_to_textured_shape(mesh, tex)
4142
end
4243

4344
def draw
@@ -46,7 +47,7 @@ def draw
4647
shape(tentacle)
4748
end
4849

49-
def define_lights
50+
def define_lights
5051
lights
5152
ambient_light(40, 40, 40)
5253
directional_light(10, 30, 40, 1, 1, 0)
@@ -66,5 +67,7 @@ def key_pressed
6667
exit
6768
when 's', 'S'
6869
save_frame('Tentacle.png')
70+
when 't', 'T'
71+
mesh.saveAsSTL(data_path('tentacle.stl'))
6972
end
7073
end

0 commit comments

Comments
 (0)