General improvement to shadows

This commit is contained in:
2021-03-06 12:23:19 +01:00
parent 079f4deecf
commit d57bfcf354
4 changed files with 79 additions and 28 deletions
+23 -4
View File
@@ -438,19 +438,38 @@ roomMiniIntro = fmap (g . expandTreeBy f) $ sequence $ treePost
g (Node (Right x) xs) = Node (Left x) $ map g xs
g (Node y ys) = Node y $ map g ys
putSingleBlock :: Point2 -> [PlacementSpot]
putSingleBlock a = [PS a 0 $ PutBlock [5,20,20] (greyN 0.5)
$ reverse $ rectNSWE 10 (-10) (-10) 10]
putWallBlocks :: Point2 -> Point2 -> [PlacementSpot]
putWallBlocks a b = map (\p -> PS p rot $ PutBlock [5,20,20] (greyN 0.5)
putWallBlocks a b = map (\p -> PS p rot $ PutBlockWall [5,20,20] (greyN 0.5)
$ reverse $ rectNSWE 10 (-10) (-10) 10)
ps
ps
-- ++
-- map (\p -> PS p rot $ PutBlockWall [5,20,20] (greyN 0.5)
-- $ reverse $ rectNSWE 10 (-10) (-10) 10)
-- rs
where d = dist a b
rot = argV (b -.- a)
numPoints' = floor (d / 20)
numPoints' = floor (d / 30)
numPoints = numPoints'*2 + 1
ns = take (numPoints + 1) [0..]
ps = map (\i -> a +.+ i/ (fromIntegral numPoints) *.* (b -.- a))
$ map fromIntegral ns
ps' = map (\i -> au +.+ i/ (fromIntegral numPoints) *.* (bu -.- au))
$ map fromIntegral ns
rs = map (\i -> ad +.+ i/ (fromIntegral numPoints) *.* (bd -.- ad))
$ map fromIntegral ns
norm = normalizeV $ vNormal $ b -.- a
au = a +.+ 10 *.* norm
bu = b +.+ 10 *.* norm
ad = a -.- 10 *.* norm
bd = b -.- 10 *.* norm
roomCenterPillar :: RandomGen g => State g Room
roomCenterPillar = changeLinkTo ((\p -> dist p (120,0) < 10) . fst)
$ set rmPS plmnts $ roomRect' 240 240 2 2
@@ -809,7 +828,7 @@ shootersRoom = do
pistolerRoom :: RandomGen g => State g Room
pistolerRoom = do
let f2 x y = putWallBlocks (x,y) (x,y)
let f2 x y = putSingleBlock (x,y)
-- let f2 x y = [PS (x,y) 0 $ PutWindow (rectNSEW 40 0 0 40) $ withAlpha 0.5 aquamarine]
f3 x y = putWallBlocks (x-20,y) (x+20,y)
++ putWallBlocks (x,y-20) (x,y+20)