Moved more shaders, cleaned up unused code and other left-over bits.
This commit is contained in:
parent
e0b1e876f0
commit
d64428db34
@ -571,6 +571,27 @@ public:
|
||||
} // MLAAGatherSHader
|
||||
}; // MLAAGatherSHader
|
||||
|
||||
// ============================================================================
|
||||
class SunLightShader : public TextureShader<SunLightShader, 2,
|
||||
core::vector3df, video::SColorf>
|
||||
{
|
||||
public:
|
||||
SunLightShader()
|
||||
{
|
||||
loadProgram(OBJECT, GL_VERTEX_SHADER, "screenquad.vert",
|
||||
GL_FRAGMENT_SHADER, "utils/decodeNormal.frag",
|
||||
GL_FRAGMENT_SHADER, "utils/SpecularBRDF.frag",
|
||||
GL_FRAGMENT_SHADER, "utils/DiffuseBRDF.frag",
|
||||
GL_FRAGMENT_SHADER, "utils/getPosFromUVDepth.frag",
|
||||
GL_FRAGMENT_SHADER, "utils/SunMRP.frag",
|
||||
GL_FRAGMENT_SHADER, "sunlight.frag");
|
||||
|
||||
assignSamplerNames(0, "ntex", ST_NEAREST_FILTERED,
|
||||
1, "dtex", ST_NEAREST_FILTERED);
|
||||
assignUniforms("direction", "col");
|
||||
} // SunLightShader
|
||||
}; // SunLightShader
|
||||
|
||||
// ============================================================================
|
||||
|
||||
PostProcessing::PostProcessing(IVideoDriver* video_driver)
|
||||
@ -827,10 +848,10 @@ void PostProcessing::renderSunlight(const core::vector3df &direction,
|
||||
glBlendFunc(GL_ONE, GL_ONE);
|
||||
glBlendEquation(GL_FUNC_ADD);
|
||||
|
||||
FullScreenShader::SunLightShader::getInstance()
|
||||
SunLightShader::getInstance()
|
||||
->setTextureUnits(irr_driver->getRenderTargetTexture(RTT_NORMAL_AND_DEPTH),
|
||||
irr_driver->getDepthStencilTexture());
|
||||
DrawFullScreenEffect<FullScreenShader::SunLightShader>(direction, col);
|
||||
DrawFullScreenEffect<SunLightShader>(direction, col);
|
||||
} // renderSunlight
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@ -259,6 +259,20 @@ public:
|
||||
} // NVWorkaroundRadianceHintsConstructionShader
|
||||
}; // NVWorkaroundRadianceHintsConstructionShader
|
||||
|
||||
// ============================================================================
|
||||
class FogShader : public TextureShader<FogShader, 1, float, core::vector3df>
|
||||
{
|
||||
public:
|
||||
FogShader()
|
||||
{
|
||||
loadProgram(OBJECT, GL_VERTEX_SHADER, "screenquad.vert",
|
||||
GL_FRAGMENT_SHADER, "utils/getPosFromUVDepth.frag",
|
||||
GL_FRAGMENT_SHADER, "fog.frag");
|
||||
assignUniforms("density", "col");
|
||||
assignSamplerNames(0, "tex", ST_NEAREST_FILTERED);
|
||||
} // FogShader
|
||||
}; // FogShader
|
||||
|
||||
// ============================================================================
|
||||
static void renderPointLights(unsigned count)
|
||||
{
|
||||
@ -529,9 +543,9 @@ void IrrDriver::renderAmbientScatter()
|
||||
glBlendEquation(GL_FUNC_ADD);
|
||||
glBlendFunc(GL_ONE, GL_ONE);
|
||||
|
||||
FullScreenShader::FogShader::getInstance()
|
||||
FogShader::getInstance()
|
||||
->setTextureUnits(irr_driver->getDepthStencilTexture());
|
||||
DrawFullScreenEffect<FullScreenShader::FogShader>(1.f / (40.f * start), col);
|
||||
DrawFullScreenEffect<FogShader>(1.f / (40.f * start), col);
|
||||
} // renderAmbientScatter
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@ -344,42 +344,6 @@ void Shaders::check(const int num)
|
||||
}
|
||||
} // check
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
void bypassUBO(GLuint Program)
|
||||
{
|
||||
GLint VM = glGetUniformLocation(Program, "ViewMatrix");
|
||||
glUniformMatrix4fv(VM, 1, GL_FALSE, irr_driver->getViewMatrix().pointer());
|
||||
GLint PM = glGetUniformLocation(Program, "ProjectionMatrix");
|
||||
glUniformMatrix4fv(PM, 1, GL_FALSE, irr_driver->getProjMatrix().pointer());
|
||||
GLint IVM = glGetUniformLocation(Program, "InverseViewMatrix");
|
||||
glUniformMatrix4fv(IVM, 1, GL_FALSE, irr_driver->getInvViewMatrix().pointer());
|
||||
GLint IPM = glGetUniformLocation(Program, "InverseProjectionMatrix");
|
||||
glUniformMatrix4fv(IPM, 1, GL_FALSE, irr_driver->getInvProjMatrix().pointer());
|
||||
GLint Screen = glGetUniformLocation(Program, "screen");
|
||||
glUniform2f(Screen, irr_driver->getCurrentScreenSize().X, irr_driver->getCurrentScreenSize().Y);
|
||||
GLint bLmn = glGetUniformLocation(Program, "blueLmn[0]");
|
||||
glUniform1fv(bLmn, 9, irr_driver->blueSHCoeff);
|
||||
GLint gLmn = glGetUniformLocation(Program, "greenLmn[0]");
|
||||
glUniform1fv(gLmn, 9, irr_driver->greenSHCoeff);
|
||||
GLint rLmn = glGetUniformLocation(Program, "redLmn[0]");
|
||||
glUniform1fv(rLmn, 9, irr_driver->redSHCoeff);
|
||||
GLint sundir = glGetUniformLocation(Program, "sun_direction");
|
||||
glUniform3f(sundir, irr_driver->getSunDirection().X, irr_driver->getSunDirection().Y, irr_driver->getSunDirection().Z);
|
||||
GLint suncol = glGetUniformLocation(Program, "sun_col");
|
||||
glUniform3f(suncol, irr_driver->getSunColor().getRed(), irr_driver->getSunColor().getGreen(), irr_driver->getSunColor().getBlue());
|
||||
GLint sunangle = glGetUniformLocation(Program, "sun_angle");
|
||||
glUniform1f(sunangle, 0.54f);
|
||||
}
|
||||
|
||||
namespace UtilShader
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
using namespace UtilShader;
|
||||
|
||||
|
||||
|
||||
|
||||
unsigned getGLSLVersion()
|
||||
{
|
||||
@ -438,34 +402,3 @@ namespace MeshShader
|
||||
|
||||
}
|
||||
|
||||
namespace FullScreenShader
|
||||
{
|
||||
|
||||
SunLightShader::SunLightShader()
|
||||
{
|
||||
loadProgram(OBJECT,
|
||||
GL_VERTEX_SHADER, "screenquad.vert",
|
||||
GL_FRAGMENT_SHADER, "utils/decodeNormal.frag",
|
||||
GL_FRAGMENT_SHADER, "utils/SpecularBRDF.frag",
|
||||
GL_FRAGMENT_SHADER, "utils/DiffuseBRDF.frag",
|
||||
GL_FRAGMENT_SHADER, "utils/getPosFromUVDepth.frag",
|
||||
GL_FRAGMENT_SHADER, "utils/SunMRP.frag",
|
||||
GL_FRAGMENT_SHADER, "sunlight.frag");
|
||||
|
||||
assignSamplerNames(0, "ntex", ST_NEAREST_FILTERED,
|
||||
1, "dtex", ST_NEAREST_FILTERED);
|
||||
assignUniforms("direction", "col");
|
||||
}
|
||||
|
||||
FogShader::FogShader()
|
||||
{
|
||||
loadProgram(OBJECT,
|
||||
GL_VERTEX_SHADER, "screenquad.vert",
|
||||
GL_FRAGMENT_SHADER, "utils/getPosFromUVDepth.frag",
|
||||
GL_FRAGMENT_SHADER, "fog.frag");
|
||||
|
||||
assignUniforms("density", "col");
|
||||
assignSamplerNames(0, "tex", ST_NEAREST_FILTERED);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -78,23 +78,6 @@ static void DrawFullScreenEffect(Args...args)
|
||||
glDrawArrays(GL_TRIANGLES, 0, 3);
|
||||
}
|
||||
|
||||
namespace FullScreenShader
|
||||
{
|
||||
|
||||
|
||||
class SunLightShader : public TextureShader<SunLightShader, 2, core::vector3df, video::SColorf>
|
||||
{
|
||||
public:
|
||||
SunLightShader();
|
||||
};
|
||||
|
||||
class FogShader : public TextureShader<FogShader, 1, float, core::vector3df>
|
||||
{
|
||||
public:
|
||||
FogShader();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#define FOREACH_SHADER(ACT) \
|
||||
ACT(ES_NORMAL_MAP) \
|
||||
|
Loading…
Reference in New Issue
Block a user