Skip to content

Commit 99ed186

Browse files
committed
Now much more like ruby code
1 parent b091029 commit 99ed186

File tree

1 file changed

+9
-18
lines changed

1 file changed

+9
-18
lines changed

external_library/java/PixelFlow/geometry_grid.rb

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def create_mesh(subdivisions)
3838

3939
def draw
4040
lights
41-
directionalLight(128, 96, 64, -500, -500, 1_000)
41+
directional_light(128, 96, 64, -500, -500, 1_000)
4242
background(64)
4343
display_gizmo(300)
4444
scale(RADIUS)
@@ -73,34 +73,25 @@ def display_mesh(ifs)
7373
faces_count = ifs.get_faces_count
7474
faces = ifs.get_faces
7575
verts = ifs.get_verts
76-
v = Array.new(3)
7776
faces.each do |face|
7877
case(face.length)
7978
when 3
8079
begin_shape(TRIANGLE)
81-
v = verts[face[2]]
82-
vertex(v[0], v[1], v[2])
83-
v = verts[face[1]]
84-
vertex(v[0], v[1], v[2])
85-
v = verts[face[0]]
86-
vertex(v[0], v[1], v[2])
80+
vertex(*verts[face[2]])
81+
vertex(*verts[face[1]])
82+
vertex(*verts[face[0]])
8783
end_shape
8884
when 4
8985
begin_shape(QUAD)
90-
v = verts[face[3]]
91-
vertex(v[0], v[1], v[2])
92-
v = verts[face[2]]
93-
vertex(v[0], v[1], v[2])
94-
v = verts[face[1]]
95-
vertex(v[0], v[1], v[2])
96-
v = verts[face[0]]
97-
vertex(v[0], v[1], v[2])
86+
vertex(*verts[face[3]])
87+
vertex(*verts[face[2]])
88+
vertex(*verts[face[1]])
89+
vertex(*verts[face[0]])
9890
end_shape
9991
else
10092
begin_shape # POLYGON
10193
face.each do |coord|
102-
v = verts[face[coord]]
103-
vertex(v[0], v[1], v[2])
94+
vertex(*verts[face[coord]])
10495
end
10596
end_shape(CLOSE)
10697
end

0 commit comments

Comments
 (0)