Abstract out block placement
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
--{-# LANGUAGE TupleSections #-}
|
||||
module Dodge.Room.Foreground where
|
||||
import Dodge.Data
|
||||
import Picture
|
||||
import Geometry
|
||||
import Shape
|
||||
import Quaternion
|
||||
|
||||
import Dodge.Data.ForegroundShape
|
||||
--import Dodge.Data.ForegroundShape
|
||||
import Dodge.Default.Foreground
|
||||
import Data.List
|
||||
import Data.Maybe
|
||||
@@ -115,6 +116,24 @@ girderVCapLR csize h d w x y = thinHighBar h (x -.- n) (x +.+ n)
|
||||
where
|
||||
n = csize *.* vNormal (normalizeV (x -.- y))
|
||||
|
||||
putShape :: Shape -> PSType
|
||||
putShape sh = PutForeground $ defaultForeground
|
||||
& fsPos .~ m
|
||||
& fsRad .~ radBounds bnds
|
||||
& fsSPic .~ noPic (uncurryV translateSHf (-m) $ sh)
|
||||
where
|
||||
bnds = shapeBounds sh
|
||||
m = midBounds bnds
|
||||
|
||||
shapeBounds :: Shape -> (Float,Float,Float,Float)
|
||||
shapeBounds sh = undefined
|
||||
|
||||
midBounds :: (Float,Float,Float,Float) -> Point2
|
||||
midBounds (n,s,e,w) = V2 ((n + s)/2) ((e + w)/2)
|
||||
|
||||
radBounds :: (Float, Float,Float,Float) -> Float
|
||||
radBounds (n,s,e,w) = max (n-s) (e-w) / 2
|
||||
|
||||
girderV'
|
||||
:: Float -- ^ "cap" size
|
||||
-> Float -- ^ height
|
||||
@@ -123,7 +142,7 @@ girderV'
|
||||
-> Point2 -> Point2 -> ForegroundShape
|
||||
girderV' csize h d w x y = defaultForeground
|
||||
& fsPos .~ m
|
||||
& fsRad .~ dist m x'
|
||||
& fsRad .~ dist m x
|
||||
& fsSPic .~ noPic sh
|
||||
where
|
||||
m = midPoint x y
|
||||
|
||||
Reference in New Issue
Block a user