simpler
This commit is contained in:
parent
a449efc386
commit
78b1dbab03
1 changed files with 3 additions and 9 deletions
|
@ -433,9 +433,8 @@ proc drawUber(
|
||||||
let mixer = blendMode.mixer()
|
let mixer = blendMode.mixer()
|
||||||
for y in 0 ..< a.height:
|
for y in 0 ..< a.height:
|
||||||
var
|
var
|
||||||
xMin = 0
|
xMin = a.width
|
||||||
xMax = 0
|
xMax = 0
|
||||||
hasIntersection = false
|
|
||||||
for yOffset in [0.float32, 1]:
|
for yOffset in [0.float32, 1]:
|
||||||
var scanLine = segment(
|
var scanLine = segment(
|
||||||
vec2(-100000, y.float32 + yOffset),
|
vec2(-100000, y.float32 + yOffset),
|
||||||
|
@ -444,13 +443,8 @@ proc drawUber(
|
||||||
for l in lines:
|
for l in lines:
|
||||||
var at: Vec2
|
var at: Vec2
|
||||||
if intersects(l, scanLine, at):
|
if intersects(l, scanLine, at):
|
||||||
if hasIntersection:
|
xMin = min(xMin, at.x.floor.int)
|
||||||
xMin = min(xMin, at.x.floor.int)
|
xMax = max(xMax, at.x.ceil.int)
|
||||||
xMax = max(xMax, at.x.ceil.int)
|
|
||||||
else:
|
|
||||||
hasIntersection = true
|
|
||||||
xMin = at.x.floor.int
|
|
||||||
xMax = at.x.ceil.int
|
|
||||||
|
|
||||||
xMin = xMin.clamp(0, a.width)
|
xMin = xMin.clamp(0, a.width)
|
||||||
xMax = xMax.clamp(0, a.width)
|
xMax = xMax.clamp(0, a.width)
|
||||||
|
|
Loading…
Reference in a new issue