Clean Fog provider.
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@15052 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
badb01c68b
commit
959ad054de
@ -717,32 +717,4 @@ void DisplaceProvider::OnSetConstants(IMaterialRendererServices *srv, int)
|
||||
srv->setVertexShaderConstant("dir2", m_dir2, 2);
|
||||
|
||||
srv->setVertexShaderConstant("screen", m_screen, 2);
|
||||
}
|
||||
|
||||
//-------------------------------------
|
||||
|
||||
void FogProvider::OnSetConstants(IMaterialRendererServices *srv, int)
|
||||
{
|
||||
const Track * const track = World::getWorld()->getTrack();
|
||||
|
||||
// This function is only called once per frame - thus no need for setters.
|
||||
const float fogmax = track->getFogMax();
|
||||
const float startH = track->getFogStartHeight();
|
||||
const float endH = track->getFogEndHeight();
|
||||
const float start = track->getFogStart();
|
||||
const float end = track->getFogEnd();
|
||||
const SColor tmpcol = track->getFogColor();
|
||||
|
||||
const float col[3] = { tmpcol.getRed() / 255.0f,
|
||||
tmpcol.getGreen() / 255.0f,
|
||||
tmpcol.getBlue() / 255.0f };
|
||||
|
||||
srv->setPixelShaderConstant("fogmax", &fogmax, 1);
|
||||
srv->setPixelShaderConstant("startH", &startH, 1);
|
||||
srv->setPixelShaderConstant("endH", &endH, 1);
|
||||
srv->setPixelShaderConstant("start", &start, 1);
|
||||
srv->setPixelShaderConstant("end", &end, 1);
|
||||
srv->setPixelShaderConstant("col", col, 3);
|
||||
srv->setVertexShaderConstant("ipvmat", m_invprojview.pointer(), 16);
|
||||
srv->setVertexShaderConstant("campos", m_campos, 3);
|
||||
}
|
||||
}
|
@ -608,32 +608,4 @@ private:
|
||||
float m_dir[2], m_dir2[2];
|
||||
};
|
||||
|
||||
//
|
||||
|
||||
class FogProvider: public CallBase
|
||||
{
|
||||
public:
|
||||
virtual void OnSetConstants(video::IMaterialRendererServices *srv, int);
|
||||
|
||||
void updateIPVMatrix()
|
||||
{
|
||||
// Update the campos and IPV matrix, only once per frame since it's costly
|
||||
const core::vector3df &campos =
|
||||
irr_driver->getSceneManager()->getActiveCamera()->getAbsolutePosition();
|
||||
m_campos[0] = campos.X;
|
||||
m_campos[1] = campos.Y;
|
||||
m_campos[2] = campos.Z;
|
||||
|
||||
const video::IVideoDriver * const drv = irr_driver->getVideoDriver();
|
||||
|
||||
m_invprojview = drv->getTransform(video::ETS_PROJECTION);
|
||||
m_invprojview *= drv->getTransform(video::ETS_VIEW);
|
||||
m_invprojview.makeInverse();
|
||||
}
|
||||
|
||||
private:
|
||||
core::matrix4 m_invprojview;
|
||||
float m_campos[3];
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -674,10 +674,6 @@ void IrrDriver::renderLights(const core::aabbox3df& cambox,
|
||||
video::SColor(0, 0, 0, 0));
|
||||
|
||||
m_scene_manager->drawAll(scene::ESNRP_CAMERA);
|
||||
FogProvider * const fogcb = (FogProvider *) irr_driver->
|
||||
getCallback(ES_FOG);
|
||||
fogcb->updateIPVMatrix();
|
||||
|
||||
|
||||
const u32 lightcount = m_lights.size();
|
||||
const core::vector3df &campos =
|
||||
|
@ -59,7 +59,6 @@ Shaders::Shaders()
|
||||
m_callbacks[ES_SHADOWGEN] = new ShadowGenProvider();
|
||||
m_callbacks[ES_CAUSTICS] = new CausticsProvider();
|
||||
m_callbacks[ES_DISPLACE] = new DisplaceProvider();
|
||||
m_callbacks[ES_FOG] = new FogProvider();
|
||||
|
||||
for(s32 i=0 ; i < ES_COUNT ; i++)
|
||||
m_shaders[i] = -1;
|
||||
@ -197,9 +196,6 @@ void Shaders::loadShaders()
|
||||
m_shaders[ES_PASSFAR] = glsl(dir + "farplane.vert", dir + "colorize.frag",
|
||||
m_callbacks[ES_COLORIZE]);
|
||||
|
||||
m_shaders[ES_FOG] = glslmat(dir + "pass.vert", dir + "fog.frag",
|
||||
m_callbacks[ES_FOG], EMT_ONETEXTURE_BLEND);
|
||||
|
||||
// Check that all successfully loaded
|
||||
for (s32 i = 0; i < ES_COUNT; i++) {
|
||||
|
||||
|
@ -67,7 +67,6 @@ using namespace irr;
|
||||
ACT(ES_CAUSTICS) \
|
||||
ACT(ES_DISPLACE) \
|
||||
ACT(ES_PASSFAR) \
|
||||
ACT(ES_FOG)
|
||||
|
||||
#define ENUM(a) a,
|
||||
#define STR(a) #a,
|
||||
|
Loading…
Reference in New Issue
Block a user