Working dynamic shadows using shape vertices buffer
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
{-# LANGUAGE TupleSections #-}
|
||||
--{-# LANGUAGE TupleSections #-}
|
||||
{- |
|
||||
Drawing of creatures.
|
||||
Takes into account damage etc. -}
|
||||
@@ -55,6 +55,7 @@ basicCrShape col cr = tr $ mconcat
|
||||
, translateSHz 25 . dm . rotdir $ scalp cr
|
||||
, dm . rotmdir $ feet cr
|
||||
, dm . rotdir $ upperBody col cr
|
||||
, rotdir $ _spShape $ drawEquipment cr
|
||||
]
|
||||
where
|
||||
dm = damageModSH cr
|
||||
|
||||
@@ -75,9 +75,6 @@ data World = World
|
||||
, _playingSounds :: M.Map SoundOrigin Sound
|
||||
, _decorations :: IM.IntMap Picture
|
||||
, _foregroundShape :: Shape
|
||||
--, _foregroundDecorations :: [Polyhedra]
|
||||
, _foregroundDecorations :: Shape
|
||||
, _foregroundEdgeVerx :: [Point3]
|
||||
, _corpses :: Zone [Corpse]
|
||||
, _clickMousePos :: !Point2
|
||||
, _pathGraph :: ~(Gr Point2 Float)
|
||||
|
||||
@@ -36,7 +36,7 @@ defaultCreature = Creature
|
||||
, _crOldDir = 0
|
||||
, _crMvDir = 0
|
||||
, _crID = 1
|
||||
, _crPict = \_ _ -> (,) (mempty) blank
|
||||
, _crPict = \_ _ -> (,) mempty blank
|
||||
, _crUpdate = \cr _ -> (Endo id , Just cr)
|
||||
, _crRad = 10
|
||||
, _crMass = 10
|
||||
@@ -200,7 +200,7 @@ defaultIt = Consumable
|
||||
, _itAmount = 2
|
||||
, _cnEffect = const return
|
||||
, _itFloorPict = (,) emptySH $ onLayer FlItLayer $ polygon $ map toV2 [(-3,-3),(-3,3),(3,3),(3,-3)]
|
||||
, _itEquipPict = \_ _ -> (,) emptySH $ blank
|
||||
, _itEquipPict = \_ _ -> (,) emptySH blank
|
||||
, _itID = Nothing
|
||||
, _itInvDisplay = _itName
|
||||
, _itInvColor = blue
|
||||
|
||||
@@ -80,8 +80,6 @@ defaultWorld = World
|
||||
, _inventoryMode = TopInventory
|
||||
, _lClickHammer = HammerUp
|
||||
, _foregroundShape = mempty
|
||||
, _foregroundDecorations = mempty
|
||||
, _foregroundEdgeVerx = []
|
||||
, _radDistortion = []
|
||||
, _gameRooms = []
|
||||
, _preloadData = DummyPdata -- hack TODO remove this
|
||||
|
||||
@@ -16,7 +16,7 @@ magShield = defaultEquipment
|
||||
, _itMaxStack = 1
|
||||
, _itAmount = 1
|
||||
, _itFloorPict = (,) emptySH $ onLayer FlItLayer $ polygon $ map toV2 [(-3,-3),(-3,3),(3,3),(3,-3)]
|
||||
, _itEquipPict = \_ _ -> (,) emptySH $ blank
|
||||
, _itEquipPict = \_ _ -> (,) emptySH blank
|
||||
, _itID = Nothing
|
||||
}
|
||||
flameShield :: Item
|
||||
|
||||
@@ -440,15 +440,18 @@ spreadGun = defaultGun
|
||||
]
|
||||
, _wpSpread = spreadGunSpread
|
||||
, _wpRange = 20
|
||||
, _itFloorPict = (,) emptySH $ onLayer FlItLayer spreadGunPic
|
||||
, _itFloorPict = spreadGunPic
|
||||
, _itAimingSpeed = 1
|
||||
, _itAimingRange = 0
|
||||
, _itEquipPict = pictureWeaponOnAim $ (,) emptySH spreadGunPic
|
||||
, _itEquipPict = pictureWeaponOnAim $ spreadGunPic
|
||||
, _wpAmmo = basicBullet
|
||||
, _wpNumBarrels = 50
|
||||
}
|
||||
spreadGunPic :: Picture
|
||||
spreadGunPic = color green $ pictures [ polygon $ map toV2[(-3,0),(3,6),(3,-6)] ]
|
||||
spreadGunPic :: SPic
|
||||
spreadGunPic =
|
||||
( colorSH green $ upperPrismPoly 5 $ map toV2[(-3,0),(3,6),(3,-6)]
|
||||
, mempty
|
||||
)
|
||||
multGun :: Item
|
||||
multGun = defaultGun
|
||||
{ _itName = "MULTGUN"
|
||||
@@ -1111,7 +1114,7 @@ autoSonar = defaultEquipment
|
||||
, _itMaxStack = 1
|
||||
, _itAmount = 1
|
||||
, _itFloorPict = (,) emptySH $ onLayer FlItLayer $ color yellow $ polygon $ map toV2 [(-3,-3),(-3,3),(3,3),(3,-3)]
|
||||
, _itEquipPict = \_ _ -> (,) emptySH $ blank
|
||||
, _itEquipPict = \_ _ -> (,) emptySH blank
|
||||
, _itEffect = autoSonarEffect
|
||||
, _itID = Nothing
|
||||
, _itAimingSpeed = 1
|
||||
@@ -1128,7 +1131,7 @@ autoRadar = defaultEquipment
|
||||
, _itMaxStack = 1
|
||||
, _itAmount = 1
|
||||
, _itFloorPict = (,) emptySH $ onLayer FlItLayer $ color yellow $ polygon $ map toV2 [(-3,-3),(-3,3),(3,3),(3,-3)]
|
||||
, _itEquipPict = \_ _ -> (,) emptySH $ blank
|
||||
, _itEquipPict = \_ _ -> (,) emptySH blank
|
||||
, _itEffect = autoRadarEffect
|
||||
, _itID = Nothing
|
||||
, _itAimingSpeed = 1
|
||||
|
||||
@@ -9,14 +9,13 @@ import Dodge.Item.Weapon.ExtraEffect
|
||||
import Dodge.Item.Weapon.InventoryDisplay
|
||||
import Dodge.Item.Weapon.AmmoParams
|
||||
import Dodge.Item.Data
|
||||
import Dodge.Picture.Layer
|
||||
import Dodge.Item.Draw
|
||||
import Dodge.Item.Weapon.Bullet
|
||||
import Dodge.Item.Weapon.TriggerType
|
||||
import Dodge.SoundLogic.LoadSound
|
||||
import Picture
|
||||
import Geometry
|
||||
--import ShapePicture
|
||||
import ShapePicture
|
||||
import Shape
|
||||
|
||||
import qualified Data.Sequence as Seq
|
||||
@@ -51,20 +50,23 @@ autoGun = defaultAutoGun
|
||||
, _wpSpread = autogunSpread
|
||||
, _wpRange = 20
|
||||
, _itHammer = HammerUp
|
||||
, _itFloorPict = (,) emptySH $ onLayer FlItLayer autoGunPic
|
||||
, _itFloorPict = autoGunPic
|
||||
, _itAimingSpeed = 0.4
|
||||
, _itAimingRange = 1
|
||||
, _itZoom = defaultItZoom
|
||||
, _itAimZoom = defaultItZoom {_itZoomFac = 1.5}
|
||||
, _itEquipPict = pictureWeaponOnAim $ (,) emptySH autoGunPic
|
||||
, _itEquipPict = pictureWeaponOnAim autoGunPic
|
||||
, _itEffect = wpRecock
|
||||
, _itAttachment = ItCharMode $ Seq.fromList "MS"
|
||||
, _itScroll = scrollCharMode
|
||||
, _itInvDisplay = basicWeaponDisplay
|
||||
, _wpAmmo = basicBullet
|
||||
}
|
||||
autoGunPic :: Picture
|
||||
autoGunPic = color red $ polygon $ rectNESW 4 12 (-4) (-12)
|
||||
autoGunPic :: SPic
|
||||
autoGunPic =
|
||||
( colorSH red $ upperPrismPoly 5 $ rectNESW 4 12 (-4) (-12)
|
||||
, mempty
|
||||
)
|
||||
|
||||
autogunSpread :: Float
|
||||
autogunSpread = 0.07
|
||||
|
||||
@@ -308,7 +308,7 @@ withTempLight time rad col eff item cr = eff item cr
|
||||
|
||||
modClock :: Int -> ChainEffect -> ChainEffect
|
||||
modClock n chainEff eff it cr w
|
||||
| _frameClock w `mod` n == 0 = (chainEff eff) it cr w
|
||||
| _frameClock w `mod` n == 0 = chainEff eff it cr w
|
||||
| otherwise = eff it cr w
|
||||
|
||||
withMuzFlareI :: ChainEffect
|
||||
|
||||
+1
-4
@@ -42,7 +42,7 @@ generateLevelFromRoomList gr w
|
||||
= updateWallZoning
|
||||
. setupWorldBounds
|
||||
-- . initializeStaticWalls
|
||||
. setupForegroundEdgeVerxs
|
||||
-- . setupForegroundEdgeVerxs
|
||||
. placeSpots plmnts
|
||||
-- . addRoomPolyDecorations rs
|
||||
-- . addRoomLinkDecorations rs
|
||||
@@ -76,9 +76,6 @@ setupWorldBounds w = w
|
||||
<*> L.premap sndV2 L.maximum
|
||||
) ps
|
||||
|
||||
setupForegroundEdgeVerxs :: World -> World
|
||||
setupForegroundEdgeVerxs w = w & foregroundShape .~ (_foregroundDecorations w)
|
||||
|
||||
polyhedrasToEdges :: [Polyhedra] -> [Point3]
|
||||
polyhedrasToEdges = concatMap tflat4 . concatMap polyToEdges
|
||||
|
||||
|
||||
@@ -99,7 +99,7 @@ placeSpot ps w = case _psType ps of
|
||||
where
|
||||
(q:qs) = map (shiftPointBy (p,rot)) ps'
|
||||
rmCrossPaths w' = foldr (uncurry removePathsCrossing) w' $ zip (q:qs) (qs++[q])
|
||||
PutForeground sh -> w & foregroundDecorations %~ ((uncurryV translateSHf p . rotateSH rot) sh <>)
|
||||
PutForeground sh -> w & foregroundShape %~ ((uncurryV translateSHf p . rotateSH rot) sh <>)
|
||||
PutNothing -> w
|
||||
PutID _ -> w
|
||||
--_ -> w
|
||||
|
||||
+1
-1
@@ -106,7 +106,7 @@ doDrawing pdata w = do
|
||||
glDrawElements
|
||||
(marshalEPrimitiveMode $ _shadPrim fs)
|
||||
(fromIntegral nIndices)
|
||||
(GL_UNSIGNED_SHORT)
|
||||
GL_UNSIGNED_SHORT
|
||||
nullPtr
|
||||
|
||||
--draw floor onto base buffer
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{-# LANGUAGE TupleSections #-}
|
||||
--{-# LANGUAGE TupleSections #-}
|
||||
module Dodge.Room.Foreground
|
||||
where
|
||||
import Dodge.Picture
|
||||
|
||||
Reference in New Issue
Block a user