Tweak bloom, remove pistol spread

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