Skip to content

Commit

Permalink
Added a line of documentation for #shape. Changed examples to use #sh…
Browse files Browse the repository at this point in the history
…ape.
  • Loading branch information
maxhawkins committed Jan 11, 2010
1 parent b51de4d commit 64ae921
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 14 deletions.
1 change: 1 addition & 0 deletions lib/ruby-processing/app.rb
Expand Up @@ -254,6 +254,7 @@ def grid(cols, rows, col_size=1, row_size=1)
end
end

# Shortcut for begin_shape/end_shape pair
def shape(*mode)
begin_shape *mode
yield
Expand Down
6 changes: 3 additions & 3 deletions samples/processing_app/3D/form/brick_tower.rb
Expand Up @@ -77,9 +77,9 @@ def initialize(width, height, depth)

def create
@vertices.each do |name, vectors|
begin_shape App::QUADS
vectors.each {|v| vertex(v.x, v.y, v.z) }
end_shape
shape(App::QUADS) do
vectors.each {|v| vertex(v.x, v.y, v.z) }
end
end
end

Expand Down
22 changes: 11 additions & 11 deletions samples/processing_app/basics/form/triangle_strip.rb
Expand Up @@ -23,19 +23,19 @@ def setup
number_of_points = 36
rotation = 360.0/number_of_points

begin_shape TRIANGLE_STRIP
number_of_points.times do |i|
px = x + cos(angle.radians)*outer_radius
py = y + sin(angle.radians)*outer_radius
angle += rotation
vertex px, py
shape(TRIANGLE_STRIP) do
number_of_points.times do |i|
px = x + cos(angle.radians)*outer_radius
py = y + sin(angle.radians)*outer_radius
angle += rotation
vertex px, py

px = x + cos(angle.radians)*inner_radius
py = y + sin(angle.radians)*inner_radius
angle += rotation
vertex px, py
px = x + cos(angle.radians)*inner_radius
py = y + sin(angle.radians)*inner_radius
angle += rotation
vertex px, py
end
end
end_shape
end

end
Expand Down

0 comments on commit 64ae921

Please sign in to comment.