Simplify block drawing
This commit is contained in:
@@ -15,16 +15,8 @@ import Dodge.Path
|
||||
import Geometry
|
||||
import qualified IntMapHelp as IM
|
||||
|
||||
plBlock ::
|
||||
-- | Block polygon
|
||||
[Point2] ->
|
||||
Block ->
|
||||
-- | Base Pane
|
||||
Wall ->
|
||||
GenWorld ->
|
||||
(Int, GenWorld)
|
||||
plBlock [] _ _ _ = error "Trying to add a block with incomplete polygon"
|
||||
plBlock (p : ps) bl wl w =
|
||||
plBlock :: [Point2] -> Block -> Wall -> GenWorld -> (Int, GenWorld)
|
||||
plBlock ps bl wl w =
|
||||
(,) blid $
|
||||
w
|
||||
& gwWorld . cWorld . lWorld . blocks . at blid
|
||||
@@ -32,19 +24,18 @@ plBlock (p : ps) bl wl w =
|
||||
{ _blID = blid
|
||||
, _blWallIDs = IS.fromList is
|
||||
, _blShadows = []
|
||||
, _blFootprint = p : ps
|
||||
, _blFootprint = ps
|
||||
}
|
||||
& gwWorld %~ insertWalls wls
|
||||
where
|
||||
blid = IM.newKey $ w ^. gwWorld . cWorld . lWorld . blocks
|
||||
lns = zip (p : ps) (ps ++ [p])
|
||||
i = IM.newKey $ w ^. gwWorld . cWorld . lWorld . walls
|
||||
is = [i .. i + length lns -1]
|
||||
is = take (length ps) [i .. ]
|
||||
wls =
|
||||
zipWith
|
||||
(\j ln -> wl & wlLine .~ ln & wlID .~ j & wlStructure .~ BlockPart blid)
|
||||
is
|
||||
lns
|
||||
(loopPairs ps)
|
||||
|
||||
-- | Splits a line into many four cornered blocks.
|
||||
plLineBlock ::
|
||||
|
||||
Reference in New Issue
Block a user