From 959ad054dec437ae7d545d645504d4ec9e0dae6b Mon Sep 17 00:00:00 2001 From: vincentlj Date: Mon, 13 Jan 2014 17:37:33 +0000 Subject: [PATCH] Clean Fog provider. git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@15052 178a84e3-b1eb-0310-8ba1-8eac791a3b58 --- src/graphics/callbacks.cpp | 30 +----------------------------- src/graphics/callbacks.hpp | 28 ---------------------------- src/graphics/render.cpp | 4 ---- src/graphics/shaders.cpp | 4 ---- src/graphics/shaders.hpp | 1 - 5 files changed, 1 insertion(+), 66 deletions(-) diff --git a/src/graphics/callbacks.cpp b/src/graphics/callbacks.cpp index 756325efa..16166193c 100644 --- a/src/graphics/callbacks.cpp +++ b/src/graphics/callbacks.cpp @@ -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); -} +} \ No newline at end of file diff --git a/src/graphics/callbacks.hpp b/src/graphics/callbacks.hpp index 7a6441b96..e0369e823 100644 --- a/src/graphics/callbacks.hpp +++ b/src/graphics/callbacks.hpp @@ -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 diff --git a/src/graphics/render.cpp b/src/graphics/render.cpp index 805911c69..f38317344 100644 --- a/src/graphics/render.cpp +++ b/src/graphics/render.cpp @@ -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 = diff --git a/src/graphics/shaders.cpp b/src/graphics/shaders.cpp index 121d163f4..075faf758 100644 --- a/src/graphics/shaders.cpp +++ b/src/graphics/shaders.cpp @@ -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++) { diff --git a/src/graphics/shaders.hpp b/src/graphics/shaders.hpp index 03a5500b4..8d68bfbf2 100644 --- a/src/graphics/shaders.hpp +++ b/src/graphics/shaders.hpp @@ -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,