Skip to content

Commit

Permalink
Fix Polygon shader
Browse files Browse the repository at this point in the history
  • Loading branch information
JPonte authored and davesmith00000 committed Dec 12, 2023
1 parent 902bed8 commit cd3bb6e
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@ object ShapePolygon:
var j: Int = count - 1

while i < count do
j = i
i = i + 1
val e = v(j) - v(i)
val w = p - v(i)
val b = w - e * clamp(dot(w, e) / dot(e, e), 0.0f, 1.0f)
d = min(d, dot(b, b))
val c = bvec3(p.y >= v(i).y, p.y < v(j).y, e.x * w.y > e.y * w.x)
if (all(c) || all(not(c))) s = s * -1.0f
j = i
i = i + 1

s * sqrt(d)

Expand Down

0 comments on commit cd3bb6e

Please sign in to comment.