enable vignette during races

This commit is contained in:
samuncle 2014-11-03 21:53:44 +01:00
parent 3cec4b25fb
commit d7caebe847
4 changed files with 15 additions and 6 deletions

View File

@ -4,7 +4,7 @@ uniform sampler2D tex;
uniform sampler2D logluminancetex;
uniform float exposure = .09;
uniform float Lwhite = 1.;
uniform float vignette_weight = 0.;
uniform float vignette_weight;
out vec4 FragColor;

View File

@ -535,11 +535,11 @@ static void renderGodRay(GLuint tex, const core::vector2df &sunpos)
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
}
static void toneMap(FrameBuffer &fbo, GLuint rtt)
static void toneMap(FrameBuffer &fbo, GLuint rtt, float vignette_weight)
{
fbo.Bind();
FullScreenShader::ToneMapShader::getInstance()->SetTextureUnits(rtt);
DrawFullScreenEffect<FullScreenShader::ToneMapShader>();
DrawFullScreenEffect<FullScreenShader::ToneMapShader>(vignette_weight);
}
static void renderDoF(FrameBuffer &fbo, GLuint rtt)
@ -737,7 +737,15 @@ FrameBuffer *PostProcessing::render(scene::ICameraSceneNode * const camnode, boo
{
PROFILER_PUSH_CPU_MARKER("- Tonemap", 0xFF, 0x00, 0x00);
ScopedGPUTimer Timer(irr_driver->getGPUTimer(Q_TONEMAP));
toneMap(*out_fbo, in_fbo->getRTT()[0]);
// only enable vignette during race
if(isRace)
{
toneMap(*out_fbo, in_fbo->getRTT()[0], 1.0);
}
else
{
toneMap(*out_fbo, in_fbo->getRTT()[0], 0.0);
}
std::swap(in_fbo, out_fbo);
PROFILER_POP_CPU_MARKER();
}

View File

@ -1569,7 +1569,7 @@ namespace FullScreenShader
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/getRGBfromCIEXxy.frag").c_str(),
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/utils/getCIEXYZ.frag").c_str(),
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/tonemap.frag").c_str());
AssignUniforms();
AssignUniforms("vignette_weight");
AssignSamplerNames(Program, 0, "text");
}

View File

@ -377,9 +377,10 @@ public:
BloomBlendShader();
};
class ToneMapShader : public ShaderHelperSingleton<ToneMapShader>, public TextureRead<Nearest_Filtered>
class ToneMapShader : public ShaderHelperSingleton<ToneMapShader, float>, public TextureRead<Nearest_Filtered>
{
public:
ToneMapShader();
};