parent
6d7adcf08d
commit
56f1dff65d
@ -10,7 +10,7 @@ vec4 getPosFromUVDepth(vec3 uvDepth, mat4 InverseProjectionMatrix);
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 uv = 2. * gl_FragCoord.xy / screen;
|
||||
vec2 uv = gl_FragCoord.xy / screen;
|
||||
float z = texture(tex, uv).x;
|
||||
vec4 xpos = getPosFromUVDepth(vec3(uv, z), InverseProjectionMatrix);
|
||||
|
||||
|
@ -343,6 +343,7 @@ private:
|
||||
void renderGlow(std::vector<GlowData>& glows);
|
||||
void renderSSAO();
|
||||
void renderLights(unsigned pointlightCount, bool hasShadow);
|
||||
void renderAmbientScatter();
|
||||
void renderLightsScatter(unsigned pointlightCount);
|
||||
void renderShadowsDebug();
|
||||
void doScreenShot();
|
||||
|
@ -422,12 +422,13 @@ void IrrDriver::renderScene(scene::ICameraSceneNode * const camnode, unsigned po
|
||||
m_rtts->getFBO(FBO_COLORS).Bind();
|
||||
}
|
||||
|
||||
// Render ambient scattering
|
||||
if (CVS->isDefferedEnabled() && World::getWorld() != NULL &&
|
||||
World::getWorld()->isFogEnabled())
|
||||
{
|
||||
PROFILER_PUSH_CPU_MARKER("- Fog", 0xFF, 0x00, 0x00);
|
||||
PROFILER_PUSH_CPU_MARKER("- Ambient scatter", 0xFF, 0x00, 0x00);
|
||||
ScopedGPUTimer Timer(getGPUTimer(Q_FOG));
|
||||
renderLightsScatter(pointlightcount);
|
||||
renderAmbientScatter();
|
||||
PROFILER_POP_CPU_MARKER();
|
||||
}
|
||||
|
||||
@ -438,6 +439,16 @@ void IrrDriver::renderScene(scene::ICameraSceneNode * const camnode, unsigned po
|
||||
PROFILER_POP_CPU_MARKER();
|
||||
}
|
||||
|
||||
// Render discrete lights scattering
|
||||
if (CVS->isDefferedEnabled() && World::getWorld() != NULL &&
|
||||
World::getWorld()->isFogEnabled())
|
||||
{
|
||||
PROFILER_PUSH_CPU_MARKER("- PointLight Scatter", 0xFF, 0x00, 0x00);
|
||||
ScopedGPUTimer Timer(getGPUTimer(Q_FOG));
|
||||
renderLightsScatter(pointlightcount);
|
||||
PROFILER_POP_CPU_MARKER();
|
||||
}
|
||||
|
||||
if (getRH())
|
||||
{
|
||||
glDisable(GL_BLEND);
|
||||
|
@ -228,12 +228,8 @@ void IrrDriver::renderSSAO()
|
||||
|
||||
}
|
||||
|
||||
void IrrDriver::renderLightsScatter(unsigned pointlightcount)
|
||||
void IrrDriver::renderAmbientScatter()
|
||||
{
|
||||
getFBO(FBO_HALF1).Bind();
|
||||
glClearColor(0., 0., 0., 0.);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
const Track * const track = World::getWorld()->getTrack();
|
||||
|
||||
// This function is only called once per frame - thus no need for setters.
|
||||
@ -252,6 +248,28 @@ void IrrDriver::renderLightsScatter(unsigned pointlightcount)
|
||||
|
||||
FullScreenShader::FogShader::getInstance()->SetTextureUnits(irr_driver->getDepthStencilTexture());
|
||||
DrawFullScreenEffect<FullScreenShader::FogShader>(1.f / (40.f * start), col);
|
||||
}
|
||||
|
||||
void IrrDriver::renderLightsScatter(unsigned pointlightcount)
|
||||
{
|
||||
getFBO(FBO_HALF1).Bind();
|
||||
glClearColor(0., 0., 0., 0.);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
const Track * const track = World::getWorld()->getTrack();
|
||||
|
||||
// This function is only called once per frame - thus no need for setters.
|
||||
float start = track->getFogStart() + .001f;
|
||||
const video::SColor tmpcol = track->getFogColor();
|
||||
|
||||
core::vector3df col(tmpcol.getRed() / 255.0f,
|
||||
tmpcol.getGreen() / 255.0f,
|
||||
tmpcol.getBlue() / 255.0f);
|
||||
|
||||
glDepthMask(GL_FALSE);
|
||||
glEnable(GL_BLEND);
|
||||
glBlendEquation(GL_FUNC_ADD);
|
||||
glBlendFunc(GL_ONE, GL_ONE);
|
||||
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
core::vector3df col2(1., 1., 1.);
|
||||
|
Loading…
Reference in New Issue
Block a user