Skip to content

Commit

Permalink
Desaturate effect
Browse files Browse the repository at this point in the history
  • Loading branch information
yvt committed Oct 31, 2013
1 parent 96319b2 commit 57281c6
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
10 changes: 8 additions & 2 deletions Sources/Client/Client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1610,8 +1610,14 @@ namespace spades {
if(wTime < lastHurtTime + .15f &&
wTime >= lastHurtTime){
float per = 1.f - (wTime - lastHurtTime) / .15f;
per *= .5f + player->GetHealth() / 100.f * .3f;
def.blurVignette += per * 5.f;
per *= .5f - player->GetHealth() / 100.f * .3f;
def.blurVignette += per * 6.f;
}
if(wTime < lastHurtTime + .2f &&
wTime >= lastHurtTime){
float per = 1.f - (wTime - lastHurtTime) / .2f;
per *= .5f - player->GetHealth() / 100.f * .3f;
def.saturation *= std::max(0.f, 1.f - per * 4.f);
}
}

Expand Down
2 changes: 2 additions & 0 deletions Sources/Client/SceneDefinition.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,14 @@ namespace spades {
bool denyCameraBlur;

float blurVignette;
float saturation;

SceneDefinition() {
depthOfFieldNearRange = 0.f;
denyCameraBlur = true;
time = 0;
blurVignette = 0.f;
saturation = 1.f;
}
};
}
Expand Down
5 changes: 3 additions & 2 deletions Sources/Draw/GLColorCorrectionFilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,14 @@ namespace spades {

lens->Use();

const client::SceneDefinition& def = renderer->GetSceneDef();

if(r_bloom) {
// make image sharper
saturation.SetValue(.85f);
saturation.SetValue(.85f * def.saturation);
enhancement.SetValue(0.7f);
}else{
saturation.SetValue(1.f);
saturation.SetValue(1.f * def.saturation);
enhancement.SetValue(0.3f);
}

Expand Down

0 comments on commit 57281c6

Please sign in to comment.