Decrease window block size to ameliorate z fighting

This commit is contained in:
jgk
2021-03-22 11:56:30 +01:00
parent 7aacaccc8c
commit 3bee30895d
3 changed files with 16 additions and 15 deletions
+11 -11
View File
@@ -120,7 +120,7 @@ instance Shiftable PlacementSpot where
rotateS r' (PS p r x) = PS (rotateV r' p) (r + r') x
putWindowBlock :: Point2 -> Point2 -> World -> World
putWindowBlock a b w = removePathsCrossing a b $ foldr makeBlockAt w $ zip ps ns
putWindowBlock a b w = removePathsCrossing a b $ foldr (makeBlockAt bSide) w $ zip ps ns
where d = dist a b
rot = argV (b -.- a)
numPoints' = floor (d / 20)
@@ -128,17 +128,17 @@ putWindowBlock a b w = removePathsCrossing a b $ foldr makeBlockAt w $ zip ps ns
ns = take (numPoints+1) [0..]
ps = map (\i -> a +.+ i/ (fromIntegral numPoints) *.* (b -.- a))
$ map fromIntegral ns
k = newKey $ _walls w
ksAtN i = [k+i*4,k+i*4 + 1 ,k+i*4 +2, k+i*4+3]
bSide = d / (fromIntegral numPoints)
ds = [(-bSide,-10),(-bSide,10),(bSide,10),(bSide,-10)]
polyAtP p = map ((+.+) p . rotateV rot) ds
hp = 1
degradeHP = [5,5]
winCol = withAlpha 0.5 cyan
makeBlockAt :: (Point2,Int) -> World -> World
makeBlockAt (p,i) w =
let (k0:k1:k2:k3:_) = ksAtN i
makeBlockAt :: Float -> (Point2,Int) -> World -> World
makeBlockAt bSide (p,i) w =
let k = newKey $ _walls w
ds = [(-bSide,-9),(-bSide,9),(bSide,9),(bSide,-9)]
polyAtP p = map ((+.+) p . rotateV rot) ds
hp = 1
degradeHP = [5,5]
winCol = withAlpha 0.5 cyan
ksAtN i = [k+i*4,k+i*4 + 1 ,k+i*4 +2, k+i*4+3]
(k0:k1:k2:k3:_) = ksAtN i
(bl:tl:tr:br:_) = polyAtP p
shadows | i == 0 = ksAtN 1
| i == numPoints - 1 = ksAtN $ numPoints - 2