Merge branch 'master' of github.com:supertuxkart/stk-code

This commit is contained in:
hiker 2014-12-18 16:54:38 +11:00
commit d3224712c9
6 changed files with 26 additions and 42 deletions

View File

@ -580,7 +580,7 @@ static GLXContext getMeAGLContext(Display *display, GLXFBConfig glxFBConfig)
irr::video::useCoreContext = false; irr::video::useCoreContext = false;
// fall back to legacy context // fall back to legacy context
os::Printer::log("Creating legacy OpenGL 2.1 context...", ELL_INFORMATION); os::Printer::log("Creating legacy OpenGL 2.1 context...", ELL_INFORMATION);
Context = glXCreateContextAttribsARB(display, glxFBConfig, 0, True, legacyctx); Context = glXCreateNewContext(display, glxFBConfig, GLX_RGBA_TYPE, NULL, True);
return Context; return Context;
} }

View File

@ -544,32 +544,6 @@ void PostProcessing::renderSSAO()
DrawFullScreenEffect<FullScreenShader::SSAOShader>(irr_driver->getSSAORadius(), irr_driver->getSSAOK(), irr_driver->getSSAOSigma()); DrawFullScreenEffect<FullScreenShader::SSAOShader>(irr_driver->getSSAORadius(), irr_driver->getSSAOK(), irr_driver->getSSAOSigma());
} }
void PostProcessing::renderFog()
{
const Track * const track = World::getWorld()->getTrack();
// This function is only called once per frame - thus no need for setters.
const float start = track->getFogStart();
const SColor tmpcol = track->getFogColor();
core::vector3df col( tmpcol.getRed() / 255.0f,
tmpcol.getGreen() / 255.0f,
tmpcol.getBlue() / 255.0f );
glDisable(GL_DEPTH_TEST);
glEnable(GL_BLEND);
glBlendEquation(GL_FUNC_ADD);
glBlendFunc(GL_ONE, GL_ONE);
FullScreenShader::FogShader::getInstance()->SetTextureUnits(irr_driver->getDepthStencilTexture());
DrawFullScreenEffect<FullScreenShader::FogShader>(1.f / (40.f * start), col);
glEnable(GL_DEPTH_TEST);
glDisable(GL_BLEND);
}
void PostProcessing::renderMotionBlur(unsigned cam, FrameBuffer &in_fbo, FrameBuffer &out_fbo) void PostProcessing::renderMotionBlur(unsigned cam, FrameBuffer &in_fbo, FrameBuffer &out_fbo)
{ {
MotionBlurProvider * const cb = (MotionBlurProvider *)irr_driver-> MotionBlurProvider * const cb = (MotionBlurProvider *)irr_driver->

View File

@ -77,7 +77,6 @@ public:
void renderSunlight(const core::vector3df &direction, const video::SColorf &col); void renderSunlight(const core::vector3df &direction, const video::SColorf &col);
void renderShadowedSunlight(const core::vector3df &direction, const video::SColorf &col, const std::vector<core::matrix4> &sun_ortho_matrix, unsigned depthtex); void renderShadowedSunlight(const core::vector3df &direction, const video::SColorf &col, const std::vector<core::matrix4> &sun_ortho_matrix, unsigned depthtex);
void renderFog();
void renderSSAO(); void renderSSAO();
void renderEnvMap(const float *bSHCoeff, const float *gSHCoeff, const float *rSHCoeff, unsigned skycubemap); void renderEnvMap(const float *bSHCoeff, const float *gSHCoeff, const float *rSHCoeff, unsigned skycubemap);
void renderRHDebug(unsigned SHR, unsigned SHG, unsigned SHB, const core::matrix4 &rh_matrix, const core::vector3df &rh_extend); void renderRHDebug(unsigned SHR, unsigned SHG, unsigned SHB, const core::matrix4 &rh_matrix, const core::vector3df &rh_extend);

View File

@ -190,35 +190,42 @@ void IrrDriver::renderLightsScatter(unsigned pointlightcount)
getFBO(FBO_HALF1).Bind(); getFBO(FBO_HALF1).Bind();
glClearColor(0., 0., 0., 0.); glClearColor(0., 0., 0., 0.);
glClear(GL_COLOR_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT);
m_post_processing->renderFog();
glEnable(GL_BLEND);
glBlendEquation(GL_FUNC_ADD);
glBlendFunc(GL_ONE, GL_ONE);
glEnable(GL_DEPTH_TEST);
glDepthMask(GL_FALSE);
const Track * const track = World::getWorld()->getTrack(); const Track * const track = World::getWorld()->getTrack();
const float start = track->getFogStart(); // This function is only called once per frame - thus no need for setters.
core::vector3df col(1., 1., 1.); float start = track->getFogStart() + .001;
const video::SColor tmpcol = track->getFogColor();
core::vector3df col(tmpcol.getRed() / 255.0f,
tmpcol.getGreen() / 255.0f,
tmpcol.getBlue() / 255.0f);
glDisable(GL_DEPTH_TEST);
glDepthMask(GL_FALSE);
glEnable(GL_BLEND);
glBlendEquation(GL_FUNC_ADD);
glBlendFunc(GL_ONE, GL_ONE);
FullScreenShader::FogShader::getInstance()->SetTextureUnits(irr_driver->getDepthStencilTexture());
DrawFullScreenEffect<FullScreenShader::FogShader>(1.f / (40.f * start), col);
glEnable(GL_DEPTH_TEST);
core::vector3df col2(1., 1., 1.);
glUseProgram(LightShader::PointLightScatterShader::getInstance()->Program); glUseProgram(LightShader::PointLightScatterShader::getInstance()->Program);
glBindVertexArray(LightShader::PointLightScatterShader::getInstance()->vao); glBindVertexArray(LightShader::PointLightScatterShader::getInstance()->vao);
LightShader::PointLightScatterShader::getInstance()->SetTextureUnits(irr_driver->getDepthStencilTexture()); LightShader::PointLightScatterShader::getInstance()->SetTextureUnits(irr_driver->getDepthStencilTexture());
LightShader::PointLightScatterShader::getInstance()->setUniforms(1.f / (40.f * start), col); LightShader::PointLightScatterShader::getInstance()->setUniforms(1.f / (40.f * start), col2);
glDrawArraysInstanced(GL_TRIANGLE_STRIP, 0, 4, MIN2(pointlightcount, MAXLIGHT)); glDrawArraysInstanced(GL_TRIANGLE_STRIP, 0, 4, MIN2(pointlightcount, MAXLIGHT));
// ***
// That might be a performance issue but if disabled the quality is severly affected (the picture looks jagged)
// It should be an option if there is a gain in FPS
glDisable(GL_BLEND); glDisable(GL_BLEND);
m_post_processing->renderGaussian6Blur(getFBO(FBO_HALF1), getFBO(FBO_HALF2), 5., 5.); m_post_processing->renderGaussian6Blur(getFBO(FBO_HALF1), getFBO(FBO_HALF2), 5., 5.);
glEnable(GL_BLEND); glEnable(GL_BLEND);
// ***
glDisable(GL_DEPTH_TEST);
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
getFBO(FBO_COLORS).Bind(); getFBO(FBO_COLORS).Bind();
m_post_processing->renderPassThrough(getRenderTargetTexture(RTT_HALF1)); m_post_processing->renderPassThrough(getRenderTargetTexture(RTT_HALF1));

View File

@ -380,6 +380,7 @@ void IrrDriver::renderSkybox(const scene::ICameraSceneNode *camera)
if (SkyboxTextures.empty()) if (SkyboxTextures.empty())
return; return;
glBindVertexArray(MeshShader::SkyboxShader::getInstance()->cubevao); glBindVertexArray(MeshShader::SkyboxShader::getInstance()->cubevao);
glEnable(GL_DEPTH_TEST);
glDisable(GL_CULL_FACE); glDisable(GL_CULL_FACE);
assert(SkyboxTextures.size() == 6); assert(SkyboxTextures.size() == 6);

View File

@ -300,6 +300,7 @@ const video::ITexture* IconButtonWidget::getTexture()
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
video::ITexture* IconButtonWidget::getDeactivatedTexture(video::ITexture* texture) video::ITexture* IconButtonWidget::getDeactivatedTexture(video::ITexture* texture)
{ {
#ifdef DO_NOT_USE_IT_CAUSES_BUG_1780_FONT_CORRUPTION
video::ITexture* t; video::ITexture* t;
std::string name = texture->getName().getPath().c_str(); std::string name = texture->getName().getPath().c_str();
@ -332,6 +333,8 @@ video::ITexture* IconButtonWidget::getDeactivatedTexture(video::ITexture* textur
} }
return t; return t;
#endif
return texture;
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------