Add line shadow shader

This commit is contained in:
jgk
2021-06-26 22:20:41 +02:00
parent 726cd425f2
commit 06f22a3ea5
21 changed files with 128 additions and 74 deletions
+8 -6
View File
@@ -19,6 +19,7 @@ import Dodge.LevelGen.TriggerDoor
import Dodge.LevelGen.Switch
import Dodge.LevelGen.Data
import Geometry
import Geometry.Data
import Picture
import qualified IntMapHelp as IM
@@ -70,7 +71,7 @@ placeSpot ps w = case _psType ps of
PutButton bt -> placeBt bt p rot w
PutFlIt itm -> placeFlIt itm p rot w
PutCrit cr -> placeCr cr p rot w
PutLS ls dec -> placeLS ls dec p rot w
PutLS ls dec -> placeLS ls dec p' rot w
PutPressPlate pp -> placePressPlate pp p rot w
RandPS rgen -> placeSpot (set psType evaluatedType ps) (set randGen g w)
where
@@ -97,7 +98,8 @@ placeSpot ps w = case _psType ps of
PutID _ -> w
--_ -> w
where
p = _psPos ps
p@(px,py) = _psPos ps
p' = (px,py,0)
rot = _psRot ps
-- TODO: remove this typeclass
@@ -188,14 +190,14 @@ placeCr crF p rot = over creatures addCr
(crF {_crPos = p,_crOldPos = p,_crDir = rot,_crID = IM.newKey crs})
crs
placeLS :: LightSource -> Picture -> Point2 -> Float -> World -> World
placeLS ls dec p@(x,y) rot w = over lightSources addLS $ over decorations addDec w
placeLS :: LightSource -> Picture -> Point3 -> Float -> World -> World
placeLS ls dec (x,y,z) rot w = over lightSources addLS $ over decorations addDec w
where
addLS lss = IM.insert
(IM.newKey lss)
(ls {_lsPos = (x,y,0),_lsDir = rot,_lsID = IM.newKey lss})
(ls {_lsPos = (x,y,z),_lsDir = rot,_lsID = IM.newKey lss})
lss
addDec decs = IM.insert
(IM.newKey decs)
(uncurry translate p $ rotate (negate rot) dec)
(translate x y $ rotate (negate rot) dec)
decs