Refactor shader loading
This commit is contained in:
+88
-61
@@ -77,13 +77,13 @@ pistol = defaultGun
|
|||||||
, _wpSpread = 0.02
|
, _wpSpread = 0.02
|
||||||
, _wpRange = 20
|
, _wpRange = 20
|
||||||
, _itHammer = HammerUp
|
, _itHammer = HammerUp
|
||||||
, _itFloorPict = (,) emptySH $ onLayer FlItLayer pistolPic
|
, _itFloorPict = pistolPic
|
||||||
, _itAmount = 1
|
, _itAmount = 1
|
||||||
, _itMaxStack = 1
|
, _itMaxStack = 1
|
||||||
, _itAimingSpeed = 1
|
, _itAimingSpeed = 1
|
||||||
, _itAimingRange = 0
|
, _itAimingRange = 0
|
||||||
, _itZoom = defaultItZoom
|
, _itZoom = defaultItZoom
|
||||||
, _itEquipPict = pictureWeaponOnAim $ (,) emptySH pistolPic
|
, _itEquipPict = pictureWeaponOnAim pistolPic
|
||||||
, _itAttachment = NoItAttachment
|
, _itAttachment = NoItAttachment
|
||||||
, _itID = Nothing
|
, _itID = Nothing
|
||||||
, _itEffect = wpRecock
|
, _itEffect = wpRecock
|
||||||
@@ -93,8 +93,11 @@ pistol = defaultGun
|
|||||||
, _itWorldTrigger = Nothing
|
, _itWorldTrigger = Nothing
|
||||||
, _wpAmmo = basicBullet
|
, _wpAmmo = basicBullet
|
||||||
}
|
}
|
||||||
pistolPic :: Picture
|
pistolPic :: SPic
|
||||||
pistolPic = color green $ polygon $ rectNESW 5 5 (-5) (-5)
|
pistolPic =
|
||||||
|
( colorSH green $ upperPrismPoly 3 $ rectNESW 5 5 (-5) (-5)
|
||||||
|
, mempty
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
effectGun :: String -> (Creature -> World -> World) -> Item
|
effectGun :: String -> (Creature -> World -> World) -> Item
|
||||||
@@ -152,17 +155,19 @@ teslaGun = defaultGun
|
|||||||
]
|
]
|
||||||
, _wpSpread = 0.001
|
, _wpSpread = 0.001
|
||||||
, _wpRange = 20
|
, _wpRange = 20
|
||||||
, _itFloorPict = (,) emptySH $ onLayer FlItLayer teslaGunPic
|
, _itFloorPict = teslaGunPic
|
||||||
, _itAimingSpeed = 0.4
|
, _itAimingSpeed = 0.4
|
||||||
, _itZoom = defaultItZoom
|
, _itZoom = defaultItZoom
|
||||||
, _itAimingRange = 0
|
, _itAimingRange = 0
|
||||||
, _itEquipPict = pictureWeaponOnAim $ (,) emptySH teslaGunPic
|
, _itEquipPict = pictureWeaponOnAim teslaGunPic
|
||||||
}
|
}
|
||||||
teslaGunPic :: Picture
|
teslaGunPic :: SPic
|
||||||
teslaGunPic = color blue $ pictures
|
teslaGunPic =
|
||||||
[polygon $ rectNESW xb y xa (-y)
|
( colorSH blue $
|
||||||
,polygon $ rectNESW (-xa) y (-xb) (-y)
|
upperPrismPoly 5 (rectNESW xb y xa (-y))
|
||||||
]
|
++ (upperPrismPoly 5 $ rectNESW (-xa) y (-xb) (-y))
|
||||||
|
, mempty
|
||||||
|
)
|
||||||
where
|
where
|
||||||
xa = 1
|
xa = 1
|
||||||
xb = 9
|
xb = 9
|
||||||
@@ -187,16 +192,19 @@ lasGun = defaultAutoGun
|
|||||||
]
|
]
|
||||||
, _wpSpread = 0.001
|
, _wpSpread = 0.001
|
||||||
, _wpRange = 20
|
, _wpRange = 20
|
||||||
, _itFloorPict = (,) emptySH $ onLayer FlItLayer lasGunPic
|
, _itFloorPict = lasGunPic
|
||||||
, _itAimingSpeed = 0.4
|
, _itAimingSpeed = 0.4
|
||||||
, _itAimingRange = 1
|
, _itAimingRange = 1
|
||||||
, _itEquipPict = pictureWeaponOnAim $ (,) emptySH lasGunPic
|
, _itEquipPict = pictureWeaponOnAim lasGunPic
|
||||||
, _itAttachment = ItCharMode $ Seq.fromList "/VZ"
|
, _itAttachment = ItCharMode $ Seq.fromList "/VZ"
|
||||||
, _itScroll = scrollCharMode
|
, _itScroll = scrollCharMode
|
||||||
, _itInvDisplay = basicWeaponDisplay
|
, _itInvDisplay = basicWeaponDisplay
|
||||||
}
|
}
|
||||||
lasGunPic :: Picture
|
lasGunPic :: SPic
|
||||||
lasGunPic = color blue . polygon $ rectNESW 3 15 (-3) (-15)
|
lasGunPic =
|
||||||
|
( colorSH blue . upperPrismPoly 5 $ rectNESW 3 15 (-3) (-15)
|
||||||
|
, mempty
|
||||||
|
)
|
||||||
forceFieldGun :: Item
|
forceFieldGun :: Item
|
||||||
forceFieldGun = defaultGun
|
forceFieldGun = defaultGun
|
||||||
{ _itName = "FORCEFIELD"
|
{ _itName = "FORCEFIELD"
|
||||||
@@ -278,12 +286,18 @@ remoteLauncher = defaultGun
|
|||||||
]
|
]
|
||||||
, _wpSpread = 0.02
|
, _wpSpread = 0.02
|
||||||
, _wpRange = 20
|
, _wpRange = 20
|
||||||
, _itFloorPict = (,) emptySH $ onLayer FlItLayer $ color cyan $ polygon $ rectNESW 5 5 (-5) (-5)
|
, _itFloorPict = remoteLauncherSPic
|
||||||
, _itAimingSpeed = 0.2
|
, _itAimingSpeed = 0.2
|
||||||
, _itAimingRange = 0.5
|
, _itAimingRange = 0.5
|
||||||
, _itEquipPict = pictureWeaponOnAim $ (,) emptySH $ color cyan $ polygon $ rectNESW 5 5 (-5) (-5)
|
, _itEquipPict = pictureWeaponOnAim remoteLauncherSPic
|
||||||
, _itAttachment = ItScope (V2 0 0) 0 1 True
|
, _itAttachment = ItScope (V2 0 0) 0 1 True
|
||||||
}
|
}
|
||||||
|
remoteLauncherSPic :: SPic
|
||||||
|
remoteLauncherSPic =
|
||||||
|
( colorSH cyan $ upperPrismPoly 7 $ rectNESW 5 5 (-5) (-5)
|
||||||
|
, mempty
|
||||||
|
)
|
||||||
|
|
||||||
hvAutoGun :: Item
|
hvAutoGun :: Item
|
||||||
hvAutoGun = defaultAutoGun
|
hvAutoGun = defaultAutoGun
|
||||||
{ _itName = "AUTO-HV"
|
{ _itName = "AUTO-HV"
|
||||||
@@ -303,14 +317,17 @@ hvAutoGun = defaultAutoGun
|
|||||||
, withMuzFlareI
|
, withMuzFlareI
|
||||||
]
|
]
|
||||||
, _wpRange = 20
|
, _wpRange = 20
|
||||||
, _itFloorPict = (,) emptySH $ onLayer FlItLayer hvAutoGunPic
|
, _itFloorPict = hvAutoGunPic
|
||||||
, _itAimingSpeed = 0.2
|
, _itAimingSpeed = 0.2
|
||||||
, _itAimingRange = 1
|
, _itAimingRange = 1
|
||||||
, _itEquipPict = pictureWeaponOnAim $ (,) emptySH hvAutoGunPic
|
, _itEquipPict = pictureWeaponOnAim hvAutoGunPic
|
||||||
, _wpAmmo = hvBullet
|
, _wpAmmo = hvBullet
|
||||||
}
|
}
|
||||||
hvAutoGunPic :: Picture
|
hvAutoGunPic :: SPic
|
||||||
hvAutoGunPic = color orange $ polygon $ rectNESW 5 12 (-5) (-12)
|
hvAutoGunPic =
|
||||||
|
( colorSH orange $ upperPrismPoly 5 $ rectNESW 5 12 (-5) (-12)
|
||||||
|
, mempty
|
||||||
|
)
|
||||||
ltAutoGun :: Item
|
ltAutoGun :: Item
|
||||||
ltAutoGun = defaultAutoGun
|
ltAutoGun = defaultAutoGun
|
||||||
{ _itName = "AUTO-LT"
|
{ _itName = "AUTO-LT"
|
||||||
@@ -334,19 +351,19 @@ ltAutoGun = defaultAutoGun
|
|||||||
]
|
]
|
||||||
, _wpSpread = 0.5
|
, _wpSpread = 0.5
|
||||||
, _wpRange = 20
|
, _wpRange = 20
|
||||||
, _itFloorPict = (,) emptySH $ onLayer FlItLayer ltAutoGunPic
|
, _itFloorPict = ltAutoGunPic
|
||||||
, _itAimingSpeed = 1
|
, _itAimingSpeed = 1
|
||||||
, _itAimingRange = 0
|
, _itAimingRange = 0
|
||||||
, _itZoom = defaultItZoom
|
, _itZoom = defaultItZoom
|
||||||
, _itEquipPict = pictureWeaponOnAim $ (,) emptySH ltAutoGunPic
|
, _itEquipPict = pictureWeaponOnAim ltAutoGunPic
|
||||||
, _itAimStance = OneHand
|
, _itAimStance = OneHand
|
||||||
, _wpAmmo = ltBullet
|
, _wpAmmo = ltBullet
|
||||||
}
|
}
|
||||||
ltAutoGunPic :: Picture
|
ltAutoGunPic :: SPic
|
||||||
ltAutoGunPic = color green $ pictures
|
ltAutoGunPic =
|
||||||
[polygon $ rectNSWE 5 (-5) (-5) 0
|
( colorSH green $ upperPrismPoly 5 $ mirrorXAxis [V2 (-5) 5, V2 5 5, V2 10 0]
|
||||||
,circleSolid 5
|
, mempty
|
||||||
]
|
)
|
||||||
miniGun :: Item
|
miniGun :: Item
|
||||||
miniGun = defaultAutoGun
|
miniGun = defaultAutoGun
|
||||||
{ _itName = "MINI-G"
|
{ _itName = "MINI-G"
|
||||||
@@ -393,10 +410,10 @@ miniGun = defaultAutoGun
|
|||||||
, withSmoke 1 black 20 200 5
|
, withSmoke 1 black 20 200 5
|
||||||
]
|
]
|
||||||
, _wpRange = 20
|
, _wpRange = 20
|
||||||
, _itFloorPict = (,) emptySH $ onLayer FlItLayer miniGunPict
|
, _itFloorPict = miniGunPict
|
||||||
, _itAimingSpeed = 0.4
|
, _itAimingSpeed = 0.4
|
||||||
, _itAimingRange = 1
|
, _itAimingRange = 1
|
||||||
, _itEquipPict = pictureWeaponOnAim $ (,) emptySH miniGunPict
|
, _itEquipPict = pictureWeaponOnAim miniGunPict
|
||||||
, _wpAmmo = basicBullet
|
, _wpAmmo = basicBullet
|
||||||
}
|
}
|
||||||
where
|
where
|
||||||
@@ -411,11 +428,13 @@ miniGun = defaultAutoGun
|
|||||||
[ 0.25, 0.5, 0.9]
|
[ 0.25, 0.5, 0.9]
|
||||||
--[ 0.75, 0.5, 0.25]
|
--[ 0.75, 0.5, 0.25]
|
||||||
--[ 0, 0, 0]
|
--[ 0, 0, 0]
|
||||||
miniGunPict :: Picture
|
miniGunPict :: SPic
|
||||||
miniGunPict = pictures
|
miniGunPict =
|
||||||
[ translate 5 0 . color red $ polygon $ rectNESW 9 7 (-9) (-5)
|
( (translateSHf 5 0 . colorSH red $ upperPrismPoly 10 $ rectNESW 9 7 (-9) (-5))
|
||||||
, color red . polygon $ rectNESW 4 12 (-4) (-12)
|
++ (colorSH red . upperPrismPoly 5 $ rectNESW 4 12 (-4) (-12))
|
||||||
]
|
|
||||||
|
, mempty
|
||||||
|
)
|
||||||
spreadGun :: Item
|
spreadGun :: Item
|
||||||
spreadGun = defaultGun
|
spreadGun = defaultGun
|
||||||
{ _itName = "SPREAD"
|
{ _itName = "SPREAD"
|
||||||
@@ -443,7 +462,7 @@ spreadGun = defaultGun
|
|||||||
, _itFloorPict = spreadGunPic
|
, _itFloorPict = spreadGunPic
|
||||||
, _itAimingSpeed = 1
|
, _itAimingSpeed = 1
|
||||||
, _itAimingRange = 0
|
, _itAimingRange = 0
|
||||||
, _itEquipPict = pictureWeaponOnAim $ spreadGunPic
|
, _itEquipPict = pictureWeaponOnAim spreadGunPic
|
||||||
, _wpAmmo = basicBullet
|
, _wpAmmo = basicBullet
|
||||||
, _wpNumBarrels = 50
|
, _wpNumBarrels = 50
|
||||||
}
|
}
|
||||||
@@ -475,28 +494,31 @@ multGun = defaultGun
|
|||||||
]
|
]
|
||||||
, _wpSpread = spreadGunSpread
|
, _wpSpread = spreadGunSpread
|
||||||
, _wpRange = 20
|
, _wpRange = 20
|
||||||
, _itFloorPict = (,) emptySH $ onLayer FlItLayer multGunPic
|
, _itFloorPict = multGunSPic
|
||||||
, _itAimingSpeed = 0.4
|
, _itAimingSpeed = 0.4
|
||||||
, _itAimingRange = 1
|
, _itAimingRange = 1
|
||||||
, _itZoom = defaultItZoom
|
, _itZoom = defaultItZoom
|
||||||
, _itAimZoom = defaultItZoom {_itZoomFac = 1.5}
|
, _itAimZoom = defaultItZoom {_itZoomFac = 1.5}
|
||||||
, _itEquipPict = pictureWeaponOnAim $ (,) emptySH multGunPic
|
, _itEquipPict = pictureWeaponOnAim multGunSPic
|
||||||
, _itAimStance = TwoHandTwist
|
, _itAimStance = TwoHandTwist
|
||||||
, _wpAmmo = basicBullet
|
, _wpAmmo = basicBullet
|
||||||
, _wpNumBarrels = 5
|
, _wpNumBarrels = 5
|
||||||
}
|
}
|
||||||
multGunPic :: Picture
|
multGunSPic :: SPic
|
||||||
multGunPic = color red $ pictures
|
multGunSPic =
|
||||||
[ polygon $ rectNESW 4 8 (-4) (-12)
|
( colorSH red $
|
||||||
, translate 8 0 $ pictures
|
upperPrismPoly 2 (rectNESW 4 8 (-4) (-12)) ++
|
||||||
[ polygon $ rectNSEW 12 8 2 (-2)
|
translateSHf 8 0 (mconcat
|
||||||
, polygon $ rectNSEW 7 3 2 (-2)
|
[ upperPrismPoly 5 $ rectNSEW 12 8 2 (-2)
|
||||||
, polygon $ rectNSEW 2 (-2) 2 (-2)
|
, upperPrismPoly 5 $ rectNSEW 7 3 2 (-2)
|
||||||
, polygon $ rectNSEW (-3) (-7) 2 (-2)
|
, upperPrismPoly 5 $ rectNSEW 2 (-2) 2 (-2)
|
||||||
, polygon $ rectNSEW (-8) (-12) 2 (-2)
|
, upperPrismPoly 5 $ rectNSEW (-3) (-7) 2 (-2)
|
||||||
, polygon $ map toV2 [(-1.5,12),(-2,12),(-2,-12),(-1.5,-12)]
|
, upperPrismPoly 5 $ rectNSEW (-8) (-12) 2 (-2)
|
||||||
]
|
, upperPrismPoly 2 $ map toV2 [(-1.5,12),(-2,12),(-2,-12),(-1.5,-12)]
|
||||||
]
|
]
|
||||||
|
)
|
||||||
|
, mempty
|
||||||
|
)
|
||||||
longGun :: Item
|
longGun :: Item
|
||||||
longGun = defaultGun
|
longGun = defaultGun
|
||||||
{ _itName = "LONGGUN"
|
{ _itName = "LONGGUN"
|
||||||
@@ -520,20 +542,23 @@ longGun = defaultGun
|
|||||||
, withMuzFlareI
|
, withMuzFlareI
|
||||||
]
|
]
|
||||||
, _wpRange = 200
|
, _wpRange = 200
|
||||||
, _itFloorPict = (,) emptySH $ onLayer FlItLayer longGunPic
|
, _itFloorPict = longGunSPic
|
||||||
, _itAimingSpeed = 0.2
|
, _itAimingSpeed = 0.2
|
||||||
, _itAimingRange = 1
|
, _itAimingRange = 1
|
||||||
, _itZoom = defaultItZoom
|
, _itZoom = defaultItZoom
|
||||||
, _itAimZoom = defaultItZoom {_itZoomMax = 0.5, _itZoomMin = 0.5}
|
, _itAimZoom = defaultItZoom {_itZoomMax = 0.5, _itZoomMin = 0.5}
|
||||||
, _itEquipPict = pictureWeaponOnAim $ (,) emptySH longGunPic
|
, _itEquipPict = pictureWeaponOnAim longGunSPic
|
||||||
, _itScroll = zoomLongGun
|
, _itScroll = zoomLongGun
|
||||||
, _itAttachment = ItScope (V2 0 0) 0 1 False
|
, _itAttachment = ItScope (V2 0 0) 0 1 False
|
||||||
, _itEffect = itemLaserScopeEffect
|
, _itEffect = itemLaserScopeEffect
|
||||||
, _wpAmmo = hvBullet
|
, _wpAmmo = hvBullet
|
||||||
, _itAimStance = TwoHandTwist
|
, _itAimStance = TwoHandTwist
|
||||||
}
|
}
|
||||||
longGunPic :: Picture
|
longGunSPic :: SPic
|
||||||
longGunPic = pictures [color orange $ polygon $ rectNESW 2 12 (-2) (-12) ]
|
longGunSPic =
|
||||||
|
( colorSH orange $ upperPrismPoly 5 $ rectNESW 2 12 (-2) (-12)
|
||||||
|
, mempty
|
||||||
|
)
|
||||||
|
|
||||||
zoomLongGun :: Float -> Creature -> Item -> Item
|
zoomLongGun :: Float -> Creature -> Item -> Item
|
||||||
zoomLongGun x _
|
zoomLongGun x _
|
||||||
@@ -591,19 +616,21 @@ flamer = defaultAutoGun
|
|||||||
]
|
]
|
||||||
, _wpSpread = 0
|
, _wpSpread = 0
|
||||||
, _wpRange = 8
|
, _wpRange = 8
|
||||||
, _itFloorPict = (,) emptySH $ onLayer FlItLayer flamerPic
|
, _itFloorPict = flamerPic
|
||||||
, _itAimingSpeed = 0.5
|
, _itAimingSpeed = 0.5
|
||||||
, _itAimingRange = 0
|
, _itAimingRange = 0
|
||||||
, _itZoom = defaultItZoom
|
, _itZoom = defaultItZoom
|
||||||
, _itAimZoom = defaultItZoom {_itZoomMax = 5, _itZoomMin = 1.5}
|
, _itAimZoom = defaultItZoom {_itZoomMax = 5, _itZoomMin = 1.5}
|
||||||
, _itEquipPict = pictureWeaponOnAim $ (,) emptySH flamerPic
|
, _itEquipPict = pictureWeaponOnAim flamerPic
|
||||||
, _itAttachment = NoItAttachment
|
, _itAttachment = NoItAttachment
|
||||||
}
|
}
|
||||||
flamerPic :: Picture
|
flamerPic :: SPic
|
||||||
flamerPic = color yellow $ pictures
|
flamerPic =
|
||||||
[ translate (negate 5) (negate 7) $ circleSolid 5
|
( colorSH yellow $
|
||||||
, polygon $ rectNESW 2 9 (-2) (-9)
|
translateSHf (negate 5) (negate 7) (upperPrismPoly 3 $ polyCirc 3 5)
|
||||||
]
|
++ upperPrismPoly 5 (rectNESW 2 9 (-2) (-9))
|
||||||
|
, mempty
|
||||||
|
)
|
||||||
blinkGun :: Item
|
blinkGun :: Item
|
||||||
blinkGun = defaultGun
|
blinkGun = defaultGun
|
||||||
{ _itName = "BLINKER"
|
{ _itName = "BLINKER"
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import Dodge.Default.Weapon
|
|||||||
import Dodge.Default.Shell
|
import Dodge.Default.Shell
|
||||||
import Dodge.SoundLogic.LoadSound
|
import Dodge.SoundLogic.LoadSound
|
||||||
import Dodge.WorldEvent.Explosion
|
import Dodge.WorldEvent.Explosion
|
||||||
import Dodge.Picture.Layer
|
|
||||||
import Dodge.Item.Data
|
import Dodge.Item.Data
|
||||||
import Dodge.Item.Draw
|
import Dodge.Item.Draw
|
||||||
import Dodge.Item.Weapon.Shell
|
import Dodge.Item.Weapon.Shell
|
||||||
@@ -22,7 +21,7 @@ import Geometry.Vector3D
|
|||||||
import Picture
|
import Picture
|
||||||
import qualified IntMapHelp as IM
|
import qualified IntMapHelp as IM
|
||||||
import Padding
|
import Padding
|
||||||
--import ShapePicture
|
import ShapePicture
|
||||||
import Shape
|
import Shape
|
||||||
|
|
||||||
import Data.Maybe
|
import Data.Maybe
|
||||||
@@ -50,10 +49,10 @@ launcher = defaultGun
|
|||||||
]
|
]
|
||||||
, _wpSpread = 0.02
|
, _wpSpread = 0.02
|
||||||
, _wpRange = 20
|
, _wpRange = 20
|
||||||
, _itFloorPict = (,) emptySH $ onLayer FlItLayer launcherPic
|
, _itFloorPict = launcherPic
|
||||||
, _itAimingSpeed = 0.2
|
, _itAimingSpeed = 0.2
|
||||||
, _itAimingRange = 0.5
|
, _itAimingRange = 0.5
|
||||||
, _itEquipPict = pictureWeaponOnAim $ (,) emptySH launcherPic
|
, _itEquipPict = pictureWeaponOnAim launcherPic
|
||||||
, _itHammer = NoHammer
|
, _itHammer = NoHammer
|
||||||
, _itEffect = NoItEffect
|
, _itEffect = NoItEffect
|
||||||
, _wpAmmo = defaultShellAmmo
|
, _wpAmmo = defaultShellAmmo
|
||||||
@@ -65,8 +64,11 @@ launcher = defaultGun
|
|||||||
, _itAimStance = TwoHandTwist
|
, _itAimStance = TwoHandTwist
|
||||||
}
|
}
|
||||||
|
|
||||||
launcherPic :: Picture
|
launcherPic :: SPic
|
||||||
launcherPic = color cyan $ polygon $ rectNESW 5 10 (-5) (-10)
|
launcherPic =
|
||||||
|
( colorSH cyan $ upperPrismPoly 7 $ rectNESW 5 10 (-5) (-10)
|
||||||
|
, mempty
|
||||||
|
)
|
||||||
|
|
||||||
basicAmPjMoves :: [PjParam]
|
basicAmPjMoves :: [PjParam]
|
||||||
basicAmPjMoves =
|
basicAmPjMoves =
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import Geometry.Vector
|
|||||||
import Geometry.LHS
|
import Geometry.LHS
|
||||||
--import Geometry.Zone
|
--import Geometry.Zone
|
||||||
|
|
||||||
|
import Data.Maybe
|
||||||
import Data.List
|
import Data.List
|
||||||
-- | Return a point a distance away from a first point towards a second point.
|
-- | Return a point a distance away from a first point towards a second point.
|
||||||
-- Does not go past the second point.
|
-- Does not go past the second point.
|
||||||
@@ -64,6 +65,13 @@ rectNSWE !n !s !w !e = [V2 w n, V2 w s, V2 e s, V2 e n]
|
|||||||
-- | Draw a rectangle around the origin with given height and width
|
-- | Draw a rectangle around the origin with given height and width
|
||||||
rectWdthHght :: Float -> Float -> [Point2]
|
rectWdthHght :: Float -> Float -> [Point2]
|
||||||
rectWdthHght w h = rectNSWE h (-h) (-w) w
|
rectWdthHght w h = rectNSWE h (-h) (-w) w
|
||||||
|
|
||||||
|
mirrorXAxis :: [Point2] -> [Point2]
|
||||||
|
mirrorXAxis ps = orderPolygon $ ps ++ mapMaybe f ps
|
||||||
|
where
|
||||||
|
f (V2 _ 0) = Nothing
|
||||||
|
f (V2 x y) = Just $ V2 x (-y)
|
||||||
|
|
||||||
-- | Test whether a point is in a polygon or on the polygon border.
|
-- | Test whether a point is in a polygon or on the polygon border.
|
||||||
-- Supposes the points in the
|
-- Supposes the points in the
|
||||||
-- polygon are listed in anticlockwise order.
|
-- polygon are listed in anticlockwise order.
|
||||||
|
|||||||
+11
-11
@@ -117,13 +117,13 @@ preloadRender = do
|
|||||||
let silEBO = EBO {_ebo = silEBOname, _eboPtr = silEBOptr}
|
let silEBO = EBO {_ebo = silEBOname, _eboPtr = silEBOptr}
|
||||||
shEdgeVAO = VAO { _vao = shEdgeVAOname, _vaoVBO = shVBO }
|
shEdgeVAO = VAO { _vao = shEdgeVAOname, _vaoVBO = shVBO }
|
||||||
-- lighting shaders
|
-- lighting shaders
|
||||||
wsShad <- makeShader "lighting/occlude" [vert,geom,frag] [4] EPoints
|
lightingOccludeShad <- makeShaderUsingVAO "lighting/occlude" [vert,geom,frag] EPoints wpVAO
|
||||||
>>= addUniforms ["lightPos"]
|
>>= addUniforms ["lightPos"]
|
||||||
lightingCapShad
|
lightingCapShad
|
||||||
<- makeShader "lighting/cap" [vert,geom,frag] [3] ETriangles
|
<- makeShaderUsingVAO "lighting/cap" [vert,geom,frag] ETriangles shPosVAO
|
||||||
>>= addUniforms ["lightPos"]
|
>>= addUniforms ["lightPos"]
|
||||||
lightingLineShadowShad
|
lightingLineShadowShad
|
||||||
<- makeShader "lighting/lineShadow" [vert,geom,frag] [3] ELinesAdjacency
|
<- makeShaderUsingVAO "lighting/lineShadow" [vert,geom,frag] ELinesAdjacency shEdgeVAO
|
||||||
>>= addUniforms ["lightPos"]
|
>>= addUniforms ["lightPos"]
|
||||||
-- 2D draw shaders
|
-- 2D draw shaders
|
||||||
bslist <- makeShader "dualTwoD/basic" [vert,frag] [3,4] ETriangles
|
bslist <- makeShader "dualTwoD/basic" [vert,frag] [3,4] ETriangles
|
||||||
@@ -150,9 +150,9 @@ preloadRender = do
|
|||||||
>>= addUniforms ["lightPos","lumRad"]
|
>>= addUniforms ["lightPos","lumRad"]
|
||||||
barrelShad <- makeShader "texture/barrel" [vert,geom,frag] [2,2,2,1] EPoints
|
barrelShad <- makeShader "texture/barrel" [vert,geom,frag] [2,2,2,1] EPoints
|
||||||
-- blank wallShader
|
-- blank wallShader
|
||||||
wlBlank <- makeShader "wall/blank" [vert,geom,frag] [4,4] EPoints
|
wallBlankShad <- makeShaderUsingVAO "wall/blank" [vert,geom,frag] EPoints wpColVAO
|
||||||
-- textured wallShader
|
-- textured wallShader
|
||||||
wlTexture <- makeShader "wall/texture" [vert,geom,frag] [4,4] EPoints
|
wallTextureShad <- makeShaderUsingVAO "wall/texture" [vert,geom,frag] EPoints wpColVAO
|
||||||
>>= addTexture "data/texture/grayscaleDirt.png"
|
>>= addTexture "data/texture/grayscaleDirt.png"
|
||||||
---- texture array shader
|
---- texture array shader
|
||||||
textArrayShad <- makeShader "texture/arrayPos" [vert,frag] [3,3] ETriangles
|
textArrayShad <- makeShader "texture/arrayPos" [vert,frag] [3,3] ETriangles
|
||||||
@@ -200,12 +200,12 @@ preloadRender = do
|
|||||||
, _shapeShader = bslista {_shadVAO = shPosColVAO }
|
, _shapeShader = bslista {_shadVAO = shPosColVAO }
|
||||||
, _shapeEBO = shEBO
|
, _shapeEBO = shEBO
|
||||||
, _silhouetteEBO = silEBO
|
, _silhouetteEBO = silEBO
|
||||||
, _lightingCapShader = lightingCapShad { _shadVAO = shPosVAO }
|
, _lightingCapShader = lightingCapShad
|
||||||
, _lightingLineShadowShader = lightingLineShadowShad {_shadVAO = shEdgeVAO}
|
, _lightingLineShadowShader = lightingLineShadowShad
|
||||||
, _lightingOccludeShader = wsShad {_shadVAO = wpVAO}
|
, _lightingOccludeShader = lightingOccludeShad
|
||||||
, _wallBlankShader = wlBlank { _shadVAO = wpColVAO }
|
, _wallBlankShader = wallBlankShad
|
||||||
, _wallTextureShader = wlTexture { _shadVAO = wpColVAO }
|
, _wallTextureShader = wallTextureShad
|
||||||
, _windowShader = wlBlank { _shadVAO = winColVAO }
|
, _windowShader = wallBlankShad { _shadVAO = winColVAO }
|
||||||
, _textureArrayShader = textArrayShad
|
, _textureArrayShader = textArrayShad
|
||||||
, _fullscreenShader = fsShad
|
, _fullscreenShader = fsShad
|
||||||
, _fullLightingShader = fullLightingShad
|
, _fullLightingShader = fullLightingShad
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ module Shader.Compile
|
|||||||
, makeByteStringShaderUsingVAO
|
, makeByteStringShaderUsingVAO
|
||||||
, makeShaderSized
|
, makeShaderSized
|
||||||
, makeShaderUsingShaderVAO
|
, makeShaderUsingShaderVAO
|
||||||
|
, makeShaderUsingVAO
|
||||||
, makeSourcedShader
|
, makeSourcedShader
|
||||||
, setupVAO
|
, setupVAO
|
||||||
, setupVertexAttribPointer
|
, setupVertexAttribPointer
|
||||||
@@ -67,6 +68,23 @@ makeByteStringShaderUsingVAO s shaderlist pm fs = do
|
|||||||
, _shadUnis = []
|
, _shadUnis = []
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-- | Takes the VAO from elsewhere
|
||||||
|
makeShaderUsingVAO
|
||||||
|
:: String -- ^ First part of the name of the shader
|
||||||
|
-> [ShaderType] -- ^ Filetype extensions
|
||||||
|
-> EPrimitiveMode
|
||||||
|
-> VAO
|
||||||
|
-> IO FullShader
|
||||||
|
makeShaderUsingVAO s shaderlist pm theVAO = do
|
||||||
|
prog <- makeSourcedShader s shaderlist
|
||||||
|
return $ FullShader
|
||||||
|
{ _shadProg = prog
|
||||||
|
, _shadVAO = theVAO
|
||||||
|
, _shadPrim = pm
|
||||||
|
, _shadTex = Nothing
|
||||||
|
, _shadUnis = []
|
||||||
|
}
|
||||||
|
|
||||||
-- | Takes the VAO from another shader
|
-- | Takes the VAO from another shader
|
||||||
makeShaderUsingShaderVAO
|
makeShaderUsingShaderVAO
|
||||||
:: String -- ^ First part of the name of the shader
|
:: String -- ^ First part of the name of the shader
|
||||||
|
|||||||
Reference in New Issue
Block a user