Add "cap" shadow shader

This commit is contained in:
2021-08-29 18:13:55 +01:00
parent d23f36ea95
commit eba8ff121c
12 changed files with 66 additions and 8 deletions
-3
View File
@@ -21,7 +21,6 @@ import qualified Data.IntMap.Strict as IM
import qualified Data.Vector as V
import Data.List
import Data.Monoid
defaultCreature :: Creature
defaultCreature = Creature
{ _crPos = V2 0 0
@@ -178,7 +177,6 @@ defaultPP = PressPlate
, _ppID = -1
, _ppText = "Pressure plate"
}
defaultTLS :: TempLightSource
defaultTLS = TLS
{ _tlsPos = 0
@@ -192,4 +190,3 @@ defaultTLS = TLS
| _tlsTime t <= 0
= (w, Nothing)
| otherwise = (w, Just $ t & tlsTime -~ 1)
+1 -1
View File
@@ -274,7 +274,7 @@ withMuzFlareI :: ChainEffect
withMuzFlareI f it cr w = tempLightForAt 3 pos2 -- . muzzleFlashAt pos2
$ f it cr w
where
pos = _crPos cr +.+ _crRad cr *.* unitVectorAtAngle (_crDir cr)
--pos = _crPos cr +.+ _crRad cr *.* unitVectorAtAngle (_crDir cr)
pos2 = _crPos cr +.+ (2 * _crRad cr) *.* unitVectorAtAngle (_crDir cr)
{- | Applies the effect to a randomly rotated creature. -}
withRandomDirI
-1
View File
@@ -19,7 +19,6 @@ colorLightAt col pos i =
lightAt :: Point3 -> Int -> LightSource
lightAt = colorLightAt 0.75
tLightFade :: Int -> Float -> (Int -> Float) -> Point2 -> TempLightSource
tLightFade 0 rmax intensityF (V2 x y) = TLS
{ _tlsPos = V3 x y 0
+2 -1
View File
@@ -60,8 +60,8 @@ doDrawing pdata w = do
let addC (V2 xx yy) = V3 xx yy 0
nsurfVs <- pokePoint3s (shadVBOptr $ _lightingSurfaceShader pdata)
$ youBox w
++ polyToTris (map addC $ screenPolygon w)
++ concatMap polyToGeoRender (foregroundPics w)
++ polyToTris (map addC $ screenPolygon w)
-- bind wall points, silhouette data, surface geometry
uncurry bindShaderBuffers $ unzip
[ ( _wallTextureShader pdata, nWalls)
@@ -174,6 +174,7 @@ doDrawing pdata w = do
viewport $= (Position 0 0, Size (round $ fstV2 wins) (round $ sndV2 wins))
depthFunc $= Just Always
blendFunc $= (One,Zero)
-- perform any radial distortion
case _radDistortion w of
[] -> do
+5 -2
View File
@@ -4,10 +4,11 @@ Explosions: creation of shockwave and particles at a given point.
module Dodge.WorldEvent.Explosion
where
import Dodge.Data
import Dodge.Default
import Dodge.Base.Zone
import Dodge.Base.Collide
import Dodge.WorldEvent.SpawnParticle
import Dodge.WorldEvent.Flash
--import Dodge.WorldEvent.Flash
import Dodge.RandomHelp
import Dodge.SoundLogic
import Dodge.SoundLogic.Synonyms
@@ -69,9 +70,11 @@ makeExplosionAt
makeExplosionAt p w
= soundOncePos grenadeBang p
. addFlames
. explosionFlashAt p
-- . explosionFlashAt p
. over tempLightSources (theTLS :)
$ makeShockwaveAt [] p 50 50 1 white w
where
theTLS = defaultTLS {_tlsPos = addZ 20 p, _tlsIntensity = V3 1 0.5 0, _tlsTime = 20, _tlsRad = 150}
fVs = replicateM 15 (randInCirc 1) & evalState $ _randGen w
fPs'' = replicateM 15 (fmap (15 *.*.*) randInHemisphere) & evalState $ _randGen w
(fPs',zs) = let (a,b,c) = unzip3 $ map fromV3 fPs''