Tweak bloom, remove pistol spread

This commit is contained in:
jgk
2021-08-21 11:32:50 +02:00
parent 778d18276b
commit a730dd66e0
9 changed files with 46 additions and 45 deletions
+18 -25
View File
@@ -1,48 +1,41 @@
#version 430 core
in vec2 vTexPos;
out vec4 fColor;
const vec2 winSize = vec2 (300,300);
const vec2 winSize = vec2 (300.0,300.0);
// note that the above opening bracket should be the first in this file
// this is so that the window size can be extracted and the shader recompiled on
// the fly
uniform sampler2D screenTexture;
const float hOff = 3.0 / winSize.x;
const float vOff = 3.0 / winSize.y;
const float frac = 1.0 / 9;
const vec2 off[9] = vec2[]
const float hOff = 3 / winSize.x;
const float vOff = 3 / winSize.y;
//const vec2 off[9] = vec2[]
// ( vec2( hOff, vOff )
// , vec2( hOff, 0.0 )
// , vec2( hOff,-vOff )
// , vec2( 0.0, vOff )
// , vec2( 0.0, 0.0 )
// , vec2( 0.0,-hOff )
// , vec2(-hOff, vOff )
// , vec2(-hOff, 0.0 )
// , vec2(-hOff,-vOff )
// );
const vec2 fiveOff[5] = vec2[]
( vec2( hOff, vOff )
, vec2( hOff, 0.0 )
, vec2( hOff,-vOff )
, vec2( 0.0, vOff )
, vec2( 0.0, 0.0 )
, vec2( 0.0,-hOff )
, vec2(-hOff, vOff )
, vec2(-hOff, 0.0 )
, vec2(-hOff,-vOff )
);
const vec2 fiveOff[5] = vec2[]
( vec2( vOff, hOff )
, vec2( vOff,-hOff )
, vec2( 0.0, 0.0 )
, vec2(-vOff, hOff )
, vec2(-vOff,-hOff )
);
vec4 combinef (vec4 ac, vec4 bc)
//{ return vec4 (max(ac.x,bc.x),max(ac.y,bc.y),max(ac.z,bc.z),ac.w + bc.w -
// ac.w*bc.w);
//{ return vec4 (max(ac.x,bc.x),max(ac.y,bc.y),max(ac.z,bc.z),ac.w + bc.w);
{ return vec4 (ac.rgb + bc.rgb * bc.a , ac.a + bc.a );
}
void main()
{
vec4 sumFive = vec4 (0,0,0,0);
vec4 sumFive = vec4 (0.0,0.0,0.0,0.0);
for (int i=0; i<5; i++)
{
sumFive += vec4(texture(screenTexture, vTexPos + fiveOff[i]));
}
fColor = vec4 ( max( (sumFive / 10) , texture(screenTexture,vTexPos) ) );
//fColor = max(texture(screenTexture,vTexPos), sumFive / 5);
fColor = vec4 ( (sumFive / 5).rgb, max((sumFive/5).a,texture(screenTexture,vTexPos).a) );
//fColor = vec4 ( (sumFive / 5).rgb, max((sumFive/5.0).a,texture(screenTexture,vTexPos).a) );
// vec4 sampleTex[9];
// for(int i=0; i<9; i++)
// {
+1 -1
View File
@@ -61,7 +61,7 @@ pistol = defaultGun
, _itUseModifiers =
[ hammerCheckI
, shootWithSoundI 0
, withRandomDirI 0.1
-- , withRandomDirI 0.1
, withMuzFlareI
]
, _itLeftClickUse = Nothing
+1 -1
View File
@@ -50,7 +50,7 @@ shootBezier targetp cr w = w & particles %~ (theBullet :)
where
theBullet = aCurveBulAt
(Just cid)
white
(V4 200 200 200 1)
startp
(controlp +.+ randPos)
(targetp +.+ randPos')
+1 -1
View File
@@ -10,7 +10,7 @@ basicBullet = BulletAmmo
{ _amString = "BULLET"
, _amBulEff = destroyOnImpact bulHitCr bulHitWall' bulHitFF'
, _amBulWth = 2
, _amBulVel = V2 30 0
, _amBulVel = V2 50 0
}
hvBullet :: Ammo
hvBullet = BulletAmmo
+9 -6
View File
@@ -62,7 +62,6 @@ moveLaser phaseV pos dir w pt
xp = pos +.+ 800 *.* unitVectorAtAngle dir
(a,g) = randomR (-0.7,0.7) $ _randGen w
reflectDir wall = a + argV (reflectIn (uncurry (-.-) (_wlLine wall)) (xp -.- pos))
(colID,_) = randomR (0,11) $ _randGen w
f :: [Wall] -> Point2 -> Point2 -> (Maybe (Point2,Either3 Creature Wall ForceField),[Point2])
f seenWs x y = case find (h' seenWs) $ thingsHitExceptCrLongLine Nothing x y w of
Just (p,E3x2 wl)
@@ -103,14 +102,18 @@ moveLaser phaseV pos dir w pt
Just (p,E3x1 cr)
-> over (creatures . ix (_crID cr) . crState . crDamage) ((:) $ Lasering 19 pos p xp)
-- . over worldEvents ((.) $ flareAt yellow (flarePos p))
Just (p,E3x2 wl) -> createSpark 8 colID (p +.+ safeNormalizeV (pos -.- p))
Just (p,E3x2 wl) -> createSparkCol 8 (V4 20 (-5) 0 1) (p +.+ safeNormalizeV (pos -.- p))
(reflectDir wl) Nothing
_ -> id
pic = setDepth 20 $ pictures
[ fadeLine pos (head ps) 0.2 40 yellow
, setLayer 1 $ color (withAlpha 0.9 white) $ vThickLine (pos:ps)
, setLayer 1 $ color (withAlpha 0.5 yellow) $ vvThickLine (pos:ps)
pic = setLayer 1 $ pictures
[ setDepth 19 . color (brightX 0 0.5 yellow) $ lineOfThickness 20 (pos:ps)
, setDepth 19.5 . color (brightX 10 1 yellow) $ lineOfThickness 3 (pos:ps)
]
-- $ pictures
--[ fadeLine pos (head ps) 0.2 40 yellow
--, setLayer 1 $ color (withAlpha 0.9 white) $ vThickLine (pos:ps)
--, setLayer 1 $ color (withAlpha 0.5 yellow) $ vvThickLine (pos:ps)
--]
fadeLine :: Point2 -> Point2 -> Float -> Float -> Color -> Picture
fadeLine sp ep alph width col = setLayer 1 $ polygonCol
+1 -1
View File
@@ -19,7 +19,7 @@ aGenBulAt maycid pos vel hiteff width = Bul'
{ _ptDraw = drawBul
, _ptUpdate' = mvGenBullet
, _btVel' = vel
, _btColor' = V4 100 100 50 1.5
, _btColor' = V4 2 2 2 2
, _btTrail' = [pos]
, _btPassThrough' = maycid
, _btWidth' = width
+3 -3
View File
@@ -112,7 +112,7 @@ doDrawing pdata w = do
textureBinding Texture2D $= Just (snd $ _fboBloom pdata)
blend $= Disabled
drawShader (_bloomBlurShader pdata) 4
replicateM_ 2 $ pingPongBetween (_fboFourth1 pdata) (_fboFourth2 pdata) (_bloomBlurShader pdata)
replicateM_ 5 $ pingPongBetween (_fboFourth1 pdata) (_fboFourth2 pdata) (_bloomBlurShader pdata)
blend $= Enabled
viewport $= (Position 0 0
, divideSize (w ^. config . shadow_resolution) $ Size (round $ fstV2 wins) (round $ sndV2 wins))
@@ -142,8 +142,8 @@ doDrawing pdata w = do
textureBinding Texture2D $= Just (snd $ _fboFourth1 pdata)
drawShader (_fullscreenShader pdata) 4
blendFunc $= (SrcAlpha, OneMinusSrcAlpha)
textureBinding Texture2D $= Just (snd $ _fboBloom pdata)
drawShader (_fullscreenShader pdata) 4
-- textureBinding Texture2D $= Just (snd $ _fboBloom pdata)
-- drawShader (_fullscreenShader pdata) 4
depthFunc $= Just Lequal
--mapM_ (uncurry $ drawShaderLay 2) (vnums IM.! 2)
+7 -7
View File
@@ -303,10 +303,10 @@ drawTeslaArc pt = pic
where
ps' = _ptPoints pt
pic = setLayer 1 $ pictures
[ setDepth 20.5 $ color (_ptColor pt) $ line ps'
, setDepth 20 $ color (withAlpha 0.02 cyan) $ lineOfThickness 20 ps'
, setDepth 20 $ color (withAlpha 0.02 cyan) $ lineOfThickness 25 ps'
, setDepth 20 $ color (withAlpha 0.02 cyan) $ lineOfThickness 30 ps'
[ setDepth 20.5 $ color (brightX 2 2 $ _ptColor pt) $ lineOfThickness 3 ps'
-- , setDepth 20 $ color (withAlpha 0.02 cyan) $ lineOfThickness 20 ps'
-- , setDepth 20 $ color (withAlpha 0.02 cyan) $ lineOfThickness 25 ps'
-- , setDepth 20 $ color (withAlpha 0.02 cyan) $ lineOfThickness 30 ps'
]
-- todo: fix electrical damage location
moveTeslaArc
@@ -326,13 +326,13 @@ moveTeslaArc p d w pt
| otherwise = (w , Just $ pt & ptTimer -~ 1)
where
t = _ptTimer pt
ps = take 15 $ p : map f (crsLightChain p d 0 w)
ps = take 25 $ p : map f (crsLightChain p d 0 w)
f (E3x1 cr) = _crPos cr
f (E3x2 p1) = p1
f (E3x3 p1) = p1
ps' = lightningMids d pers ps
pers = evalState (sequence $ repeat $ randInCirc 5) $ _randGen w
(nc,g) = randomR (0::Int,11) $ _randGen w
(nc,g) = randomR (0::Int,5) $ _randGen w
theColor = f2 nc
f2 0 = cyan
f2 1 = azure
@@ -452,7 +452,7 @@ createSpark time colid pos dir maycid w
{ _ptDraw = drawBul
, _ptUpdate' = mvGenBullet
, _btVel' = rotateV dir (V2 5 0)
, _btColor' = numColor colid
, _btColor' = brightX 100 1.5 $ numColor colid
, _btTrail' = [pos]
, _btPassThrough' = maycid
, _btWidth' = 1
+5
View File
@@ -50,6 +50,7 @@ module Picture
, light
, dark
, bright
, brightX
, mixColors
, zeroZ
, setDepth
@@ -381,6 +382,10 @@ dim :: Color -> Color
{-# INLINE dim #-}
dim (V4 r g b a) = V4 (r/1.2) (g/1.2) (b/1.2) a
brightX :: Float -> Float -> Color -> Color
{-# INLINE brightX #-}
brightX cm am (V4 r g b a) = V4 (r*cm) (g*cm) (b*cm) (a*am)
bright :: Color -> Color
{-# INLINE bright #-}
bright (V4 r g b a) = V4 (r*1.2) (g*1.2) (b*1.2) a