Decrease window block size to ameliorate z fighting
This commit is contained in:
+2
-1
@@ -471,7 +471,8 @@ data Particle' =
|
|||||||
, _btTimer' :: Int
|
, _btTimer' :: Int
|
||||||
}
|
}
|
||||||
|
|
||||||
type HitEffect = Point2 -> Point2 -> (Point2, (Either3 Creature Wall ForceField)) -> World -> World
|
type HitEffect = Particle' -> [( Point2, [(Point2, (Either3 Creature Wall ForceField))] )]
|
||||||
|
-> World -> World
|
||||||
type HitEffect' = Particle' -> (Point2, (Either3 Creature Wall ForceField)) -> World -> World
|
type HitEffect' = Particle' -> (Point2, (Either3 Creature Wall ForceField)) -> World -> World
|
||||||
|
|
||||||
data Particle =
|
data Particle =
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ instance Shiftable PlacementSpot where
|
|||||||
rotateS r' (PS p r x) = PS (rotateV r' p) (r + r') x
|
rotateS r' (PS p r x) = PS (rotateV r' p) (r + r') x
|
||||||
|
|
||||||
putWindowBlock :: Point2 -> Point2 -> World -> World
|
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
|
where d = dist a b
|
||||||
rot = argV (b -.- a)
|
rot = argV (b -.- a)
|
||||||
numPoints' = floor (d / 20)
|
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..]
|
ns = take (numPoints+1) [0..]
|
||||||
ps = map (\i -> a +.+ i/ (fromIntegral numPoints) *.* (b -.- a))
|
ps = map (\i -> a +.+ i/ (fromIntegral numPoints) *.* (b -.- a))
|
||||||
$ map fromIntegral ns
|
$ 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)
|
bSide = d / (fromIntegral numPoints)
|
||||||
ds = [(-bSide,-10),(-bSide,10),(bSide,10),(bSide,-10)]
|
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
|
polyAtP p = map ((+.+) p . rotateV rot) ds
|
||||||
hp = 1
|
hp = 1
|
||||||
degradeHP = [5,5]
|
degradeHP = [5,5]
|
||||||
winCol = withAlpha 0.5 cyan
|
winCol = withAlpha 0.5 cyan
|
||||||
makeBlockAt :: (Point2,Int) -> World -> World
|
ksAtN i = [k+i*4,k+i*4 + 1 ,k+i*4 +2, k+i*4+3]
|
||||||
makeBlockAt (p,i) w =
|
(k0:k1:k2:k3:_) = ksAtN i
|
||||||
let (k0:k1:k2:k3:_) = ksAtN i
|
|
||||||
(bl:tl:tr:br:_) = polyAtP p
|
(bl:tl:tr:br:_) = polyAtP p
|
||||||
shadows | i == 0 = ksAtN 1
|
shadows | i == 0 = ksAtN 1
|
||||||
| i == numPoints - 1 = ksAtN $ numPoints - 2
|
| i == numPoints - 1 = ksAtN $ numPoints - 2
|
||||||
|
|||||||
@@ -42,9 +42,6 @@ thingsHit sp ep w
|
|||||||
where
|
where
|
||||||
hitCrs = IM.elems $ IM.filter (\cr -> circOnLine sp ep (_crPos cr) (_crRad cr))
|
hitCrs = IM.elems $ IM.filter (\cr -> circOnLine sp ep (_crPos cr) (_crRad cr))
|
||||||
$ _creatures w
|
$ _creatures w
|
||||||
-- $ creaturesAlongLine sp ep w
|
|
||||||
-- creaturesAlongLine doesn't always
|
|
||||||
-- hit crs
|
|
||||||
crPs = map (\cr -> ssaTriPoint ep (_crPos cr) sp (_crRad cr)) hitCrs
|
crPs = map (\cr -> ssaTriPoint ep (_crPos cr) sp (_crRad cr)) hitCrs
|
||||||
crs = zip crPs (map E3x1 hitCrs)
|
crs = zip crPs (map E3x1 hitCrs)
|
||||||
|
|
||||||
@@ -58,3 +55,6 @@ thingsHit sp ep w
|
|||||||
hitFFs = mapMaybe (collidePointFF sp ep (_randGen w)) (IM.elems $ _forceFields w)
|
hitFFs = mapMaybe (collidePointFF sp ep (_randGen w)) (IM.elems $ _forceFields w)
|
||||||
ffs = map (\(p,(_,i)) -> (p, E3x3 $ _forceFields w IM.! i)) hitFFs
|
ffs = map (\(p,(_,i)) -> (p, E3x3 $ _forceFields w IM.! i)) hitFFs
|
||||||
|
|
||||||
|
thingsHitOnPath :: [Point2] -> World -> [ [ ( Point2, (Either3 Creature Wall ForceField) ) ] ]
|
||||||
|
thingsHitOnPath [] _ = error "tried to find thingsHitOnPath containing no points"
|
||||||
|
thingsHitOnPath ps w = map (flip (uncurry thingsHit) w) . zip ps $ tail ps
|
||||||
|
|||||||
Reference in New Issue
Block a user