Skip to content

Commit 7c58fc7

Browse files
committed
add vertices to generate correct normals
1 parent 5481267 commit 7c58fc7

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

src/rectangles.jl

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,15 @@ function coordinates(rect::Rect3D, nvertices=nothing)
551551
# TODO use n
552552
w = widths(rect)
553553
o = origin(rect)
554-
return (ntuple(j-> o[j] + ((i >> (j - 1)) & 1) * w[j], 3) for i in 0:7)
554+
return map(x -> Point3f0(x .* w .+ o), [
555+
[0, 0, 0], [0, 0, 1], [0, 1, 1], [0, 1, 0],
556+
[0, 0, 0], [1, 0, 0], [1, 0, 1], [0, 0, 1],
557+
[0, 0, 0], [0, 1, 0], [1, 1, 0], [1, 0, 0],
558+
559+
[1, 1, 1], [0, 1, 1], [0, 0, 1], [1, 0, 1],
560+
[1, 1, 1], [1, 0, 1], [1, 0, 0], [1, 1, 0],
561+
[1, 1, 1], [1, 1, 0], [0, 1, 0], [0, 1, 1]
562+
])
555563
end
556564

557565
function texturecoordinates(rect::Rect3D, nvertices=1)
@@ -560,11 +568,11 @@ end
560568

561569
function faces(rect::Rect3D, nvertices=1)
562570
return QuadFace{Int}[
563-
(1,3,4,2),
564-
(2,4,8,6),
565-
(4,3,7,8),
566-
(1,5,7,3),
567-
(1,2,6,5),
568-
(5,6,8,7),
571+
(1,2,3,4),
572+
(5,6,7,8),
573+
(9,10,11,12),
574+
(13,14,15,16),
575+
(17,18,19,20),
576+
(21,22,23,24),
569577
]
570578
end

0 commit comments

Comments
 (0)