Clean SSAO Provider.
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@15055 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
d84bc88d47
commit
e23d9c23e9
@ -496,26 +496,6 @@ void MLAANeigh3Provider::OnSetConstants(IMaterialRendererServices *srv, int)
|
|||||||
|
|
||||||
//-------------------------------------
|
//-------------------------------------
|
||||||
|
|
||||||
void SSAOProvider::OnSetConstants(IMaterialRendererServices *srv, int)
|
|
||||||
{
|
|
||||||
srv->setPixelShaderConstant("invprojm", irr_driver->getInvProjMatrix().pointer(), 16);
|
|
||||||
srv->setPixelShaderConstant("projm", irr_driver->getProjMatrix().pointer(), 16);
|
|
||||||
srv->setPixelShaderConstant("samplePoints[0]", array, 64);
|
|
||||||
|
|
||||||
if (!firstdone)
|
|
||||||
{
|
|
||||||
int tex = 0;
|
|
||||||
srv->setPixelShaderConstant("normals_and_depth", &tex, 1);
|
|
||||||
|
|
||||||
tex = 1;
|
|
||||||
srv->setPixelShaderConstant("depth", &tex, 1);
|
|
||||||
|
|
||||||
firstdone = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------
|
|
||||||
|
|
||||||
void GodRayProvider::OnSetConstants(IMaterialRendererServices *srv, int)
|
void GodRayProvider::OnSetConstants(IMaterialRendererServices *srv, int)
|
||||||
{
|
{
|
||||||
srv->setPixelShaderConstant("sunpos", m_sunpos, 2);
|
srv->setPixelShaderConstant("sunpos", m_sunpos, 2);
|
||||||
|
@ -422,39 +422,6 @@ public:
|
|||||||
|
|
||||||
//
|
//
|
||||||
|
|
||||||
class SSAOProvider: public CallBase
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
float array[64];
|
|
||||||
public:
|
|
||||||
SSAOProvider() : CallBase() {
|
|
||||||
for (unsigned i = 0; i < 16; i++) {
|
|
||||||
// Generate x/y component between -1 and 1
|
|
||||||
// Use double to avoid denorm and get a true uniform distribution
|
|
||||||
double x = rand();
|
|
||||||
x /= RAND_MAX;
|
|
||||||
x = 2 * x - 1;
|
|
||||||
double y = rand();
|
|
||||||
y /= RAND_MAX;
|
|
||||||
y = 2 * y - 1;
|
|
||||||
|
|
||||||
// compute z so that norm (x,y,z) is one
|
|
||||||
double z = sqrt(x * x + y * y);
|
|
||||||
// Norm factor
|
|
||||||
double w = rand();
|
|
||||||
w /= RAND_MAX;
|
|
||||||
array[4 * i] = (float)x;
|
|
||||||
array[4 * i + 1] = (float)y;
|
|
||||||
array[4 * i + 2] = (float)z;
|
|
||||||
array[4 * i + 3] = (float)w;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void OnSetConstants(video::IMaterialRendererServices *srv, int);
|
|
||||||
};
|
|
||||||
|
|
||||||
//
|
|
||||||
|
|
||||||
class GodRayProvider: public CallBase
|
class GodRayProvider: public CallBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -49,7 +49,6 @@ Shaders::Shaders()
|
|||||||
m_callbacks[ES_MLAA_COLOR1] = new MLAAColor1Provider();
|
m_callbacks[ES_MLAA_COLOR1] = new MLAAColor1Provider();
|
||||||
m_callbacks[ES_MLAA_BLEND2] = new MLAABlend2Provider();
|
m_callbacks[ES_MLAA_BLEND2] = new MLAABlend2Provider();
|
||||||
m_callbacks[ES_MLAA_NEIGH3] = new MLAANeigh3Provider();
|
m_callbacks[ES_MLAA_NEIGH3] = new MLAANeigh3Provider();
|
||||||
m_callbacks[ES_SSAO] = new SSAOProvider();
|
|
||||||
m_callbacks[ES_GODRAY] = new GodRayProvider();
|
m_callbacks[ES_GODRAY] = new GodRayProvider();
|
||||||
m_callbacks[ES_SHADOWPASS] = new ShadowPassProvider();
|
m_callbacks[ES_SHADOWPASS] = new ShadowPassProvider();
|
||||||
m_callbacks[ES_SHADOW_IMPORTANCE] = new ShadowImportanceProvider();
|
m_callbacks[ES_SHADOW_IMPORTANCE] = new ShadowImportanceProvider();
|
||||||
@ -155,8 +154,6 @@ void Shaders::loadShaders()
|
|||||||
m_shaders[ES_MLAA_NEIGH3] = glsl(dir + "mlaa_offset.vert", dir + "mlaa_neigh3.frag",
|
m_shaders[ES_MLAA_NEIGH3] = glsl(dir + "mlaa_offset.vert", dir + "mlaa_neigh3.frag",
|
||||||
m_callbacks[ES_MLAA_NEIGH3]);
|
m_callbacks[ES_MLAA_NEIGH3]);
|
||||||
|
|
||||||
m_shaders[ES_SSAO] = glsl(dir + "pass.vert", dir + "ssao.frag", m_callbacks[ES_SSAO]);
|
|
||||||
|
|
||||||
m_shaders[ES_GODFADE] = glsl(std::string(""), dir + "godfade.frag", m_callbacks[ES_COLORIZE]);
|
m_shaders[ES_GODFADE] = glsl(std::string(""), dir + "godfade.frag", m_callbacks[ES_COLORIZE]);
|
||||||
m_shaders[ES_GODRAY] = glsl(std::string(""), dir + "godray.frag", m_callbacks[ES_GODRAY]);
|
m_shaders[ES_GODRAY] = glsl(std::string(""), dir + "godray.frag", m_callbacks[ES_GODRAY]);
|
||||||
|
|
||||||
|
@ -51,7 +51,6 @@ using namespace irr;
|
|||||||
ACT(ES_MLAA_COLOR1) \
|
ACT(ES_MLAA_COLOR1) \
|
||||||
ACT(ES_MLAA_BLEND2) \
|
ACT(ES_MLAA_BLEND2) \
|
||||||
ACT(ES_MLAA_NEIGH3) \
|
ACT(ES_MLAA_NEIGH3) \
|
||||||
ACT(ES_SSAO) \
|
|
||||||
ACT(ES_GODFADE) \
|
ACT(ES_GODFADE) \
|
||||||
ACT(ES_GODRAY) \
|
ACT(ES_GODRAY) \
|
||||||
ACT(ES_SHADOWPASS) \
|
ACT(ES_SHADOWPASS) \
|
||||||
|
Loading…
Reference in New Issue
Block a user