Simplify creature drawing positioning
This commit is contained in:
@@ -27,30 +27,26 @@ import ShapePicture
|
|||||||
|
|
||||||
basicCrPict :: Creature -> SPic
|
basicCrPict :: Creature -> SPic
|
||||||
basicCrPict cr =
|
basicCrPict cr =
|
||||||
uncurryV translateSPxy (_crPos cr) (rotateSP (_crDir cr) $ drawEquipment cr)
|
uncurryV translateSPxy (_crPos cr) . rotateSP (_crDir cr) $ drawEquipment cr
|
||||||
<> noPic (basicCrShape cr)
|
<> noPic ( basicCrShape cr)
|
||||||
|
|
||||||
crCamouflage :: Creature -> CamouflageStatus
|
crCamouflage :: Creature -> CamouflageStatus
|
||||||
crCamouflage _ = FullyVisible
|
crCamouflage _ = FullyVisible
|
||||||
|
|
||||||
basicCrShape ::
|
basicCrShape :: Creature -> Shape
|
||||||
Creature ->
|
|
||||||
Shape
|
|
||||||
basicCrShape cr
|
basicCrShape cr
|
||||||
| crCamouflage cr == Invisible = mempty
|
| crCamouflage cr == Invisible = mempty
|
||||||
| otherwise =
|
| otherwise =
|
||||||
tr . scaleSH (V3 crsize crsize crsize) $
|
scaleSH (V3 crsize crsize crsize) $
|
||||||
mconcat
|
mconcat
|
||||||
[ rotdir . colorSH (_skinHead cskin) . translateSHz 20 $ scalp cr
|
[ colorSH (_skinHead cskin) . translateSHz 20 $ scalp cr
|
||||||
, rotdir $ colorSH (_skinUpper cskin) $ upperBody cr
|
, colorSH (_skinUpper cskin) $ upperBody cr
|
||||||
, rotmdir $ colorSH (_skinLower cskin) $ feet cr
|
, rotmdir $ colorSH (_skinLower cskin) $ feet cr
|
||||||
]
|
]
|
||||||
where
|
where
|
||||||
cskin = crShape $ _crType cr
|
cskin = crShape $ _crType cr
|
||||||
crsize = 0.1 * crRad (cr ^. crType)
|
crsize = 0.1 * crRad (cr ^. crType)
|
||||||
tr = uncurryV translateSHxy (_crPos cr)
|
rotmdir = rotateSH (_crMvDir cr - _crDir cr)
|
||||||
rotdir = rotateSH (_crDir cr)
|
|
||||||
rotmdir = rotateSH (_crMvDir cr)
|
|
||||||
|
|
||||||
feet :: Creature -> Shape
|
feet :: Creature -> Shape
|
||||||
{-# INLINE feet #-}
|
{-# INLINE feet #-}
|
||||||
|
|||||||
@@ -41,31 +41,19 @@ drawCreature cr = case cr ^. crType of
|
|||||||
BarrelCrit{} ->
|
BarrelCrit{} ->
|
||||||
uncurryV translateSPxy (_crPos cr) $ rotateSP (_crDir cr)
|
uncurryV translateSPxy (_crPos cr) $ rotateSP (_crDir cr)
|
||||||
$ barrelShape
|
$ barrelShape
|
||||||
-- picAtCrPos1
|
LampCrit{_lampHeight = h} -> uncurryV translateSPxy (_crPos cr) $ rotateSP (cr ^. crDir)$ lampCrSPic h
|
||||||
-- ( setDepth 20 $
|
|
||||||
-- fold
|
|
||||||
-- [ color orange $ circleSolid 10
|
|
||||||
-- , setDepth 0.049 . color (greyN 0.5) $ circleSolid 8
|
|
||||||
-- , color (greyN 0.5) $ circleSolid 8
|
|
||||||
-- ]
|
|
||||||
-- )
|
|
||||||
-- cr
|
|
||||||
LampCrit{_lampHeight = h} -> uncurryV translateSPxy (_crPos cr) $ lampCrSPic h
|
|
||||||
_ -> basicCrPict cr
|
_ -> basicCrPict cr
|
||||||
-- NonDrawnCreature -> mempty
|
|
||||||
|
|
||||||
barrelShape :: SPic
|
barrelShape :: SPic
|
||||||
barrelShape = noPic $ upperPrismPoly Medium Important 20 $ polyCirc 3 10
|
barrelShape = noPic $ cylinderPoly Medium Important (map (addZ 20) ps) (map (addZ 0) ps)
|
||||||
|
where
|
||||||
|
ps = polyCirc 3 10
|
||||||
|
|
||||||
lampCrSPic :: Float -> SPic
|
lampCrSPic :: Float -> SPic
|
||||||
lampCrSPic h =
|
lampCrSPic h =
|
||||||
colorSH blue (upperBox Small Typical h $ rectWH 5 5)
|
colorSH blue (upperBox Small Typical h $ rectWH 5 5)
|
||||||
:!: setLayer BloomLayer (setDepth h . color white $ circleSolid 3)
|
:!: setLayer BloomLayer (setDepth h . color white $ circleSolid 3)
|
||||||
|
|
||||||
picAtCrPos1 :: Picture -> Creature -> SPic
|
|
||||||
--{-# INLINE picAtCrPos #-}
|
|
||||||
picAtCrPos1 thePic cr = (:!:) mempty $ tranRot (_crPos cr) (_crDir cr) thePic
|
|
||||||
|
|
||||||
shiftDraw :: (a -> Point2) -> (a -> Float) -> (a -> a -> SPic) -> a -> SPic
|
shiftDraw :: (a -> Point2) -> (a -> Float) -> (a -> a -> SPic) -> a -> SPic
|
||||||
shiftDraw fpos fdir fdraw x =
|
shiftDraw fpos fdir fdraw x =
|
||||||
uncurryV translateSPxy (fpos x)
|
uncurryV translateSPxy (fpos x)
|
||||||
|
|||||||
@@ -83,6 +83,7 @@ prismBox size shads upps downps = [Surface (FlatFaces n) (f upps downps) white s
|
|||||||
f (a : as) (b : bs) = a : b : f as bs
|
f (a : as) (b : bs) = a : b : f as bs
|
||||||
f _ _ = []
|
f _ _ = []
|
||||||
|
|
||||||
|
-- to check: should the polygons be anticlockwise? does this matter?
|
||||||
cylinderPoly ::
|
cylinderPoly ::
|
||||||
Size ->
|
Size ->
|
||||||
Importance ->
|
Importance ->
|
||||||
|
|||||||
Reference in New Issue
Block a user