From: <vin...@us...> - 2014-01-13 13:07:17
|
Revision: 15037 http://sourceforge.net/p/supertuxkart/code/15037 Author: vincentlj Date: 2014-01-13 13:07:12 +0000 (Mon, 13 Jan 2014) Log Message: ----------- Clean PointLight Provider and snow provider. Modified Paths: -------------- main/trunk/src/graphics/callbacks.cpp main/trunk/src/graphics/callbacks.hpp main/trunk/src/graphics/light.cpp main/trunk/src/graphics/light.hpp main/trunk/src/graphics/shaders.cpp main/trunk/src/graphics/shaders.hpp Modified: main/trunk/src/graphics/callbacks.cpp =================================================================== --- main/trunk/src/graphics/callbacks.cpp 2014-01-13 12:56:27 UTC (rev 15036) +++ main/trunk/src/graphics/callbacks.cpp 2014-01-13 13:07:12 UTC (rev 15037) @@ -269,15 +269,6 @@ //------------------------------------- -void SnowEffectProvider::OnSetConstants(IMaterialRendererServices *srv, int) -{ - const float time = irr_driver->getDevice()->getTimer()->getTime() / 1000.0f; - - srv->setVertexShaderConstant("time", &time, 1); -} - -//------------------------------------- - void MotionBlurProvider::OnSetConstants(IMaterialRendererServices *srv, int) { // We need the maximum texture coordinates: @@ -412,30 +403,6 @@ //------------------------------------- -void PointLightProvider::OnSetConstants(IMaterialRendererServices *srv, int) -{ - srv->setVertexShaderConstant("screen", m_screen, 2); - srv->setVertexShaderConstant("spec", &m_specular, 1); - srv->setVertexShaderConstant("invproj", irr_driver->getInvProjMatrix().pointer(), 16); - srv->setVertexShaderConstant("energy[0]", m_energy.data(), m_energy.size()); - srv->setVertexShaderConstant("col[0]", m_color.data(), m_color.size()); - srv->setVertexShaderConstant("center[0]", m_pos.data(), m_pos.size()); - srv->setVertexShaderConstant("viewm", irr_driver->getViewMatrix().pointer(), 16); - - if (!firstdone) - { - int tex = 0; - srv->setVertexShaderConstant("ntex", &tex, 1); - - tex = 1; - srv->setVertexShaderConstant("dtex", &tex, 1); - - firstdone = true; - } -} - -//------------------------------------- - void SunLightProvider::OnSetConstants(IMaterialRendererServices *srv, int) { const int hasclouds = World::getWorld()->getTrack()->hasClouds() && Modified: main/trunk/src/graphics/callbacks.hpp =================================================================== --- main/trunk/src/graphics/callbacks.hpp 2014-01-13 12:56:27 UTC (rev 15036) +++ main/trunk/src/graphics/callbacks.hpp 2014-01-13 13:07:12 UTC (rev 15037) @@ -236,14 +236,6 @@ // -class SnowEffectProvider: public CallBase -{ -public: - virtual void OnSetConstants(video::IMaterialRendererServices *srv, int); -}; - -// - class MotionBlurProvider: public CallBase { public: @@ -371,49 +363,7 @@ }; // -class PointLightProvider: public CallBase -{ -public: - PointLightProvider() - { - m_screen[0] = (float)UserConfigParams::m_width; - m_screen[1] = (float)UserConfigParams::m_height; - m_specular = 200; - } - - virtual void OnSetConstants(video::IMaterialRendererServices *srv, int); - - void setColor(const std::vector<float> &col) - { - m_color = col; - } - - void setPosition(const std::vector<float> &pos) - { - m_pos = pos; - return; - } - - void setSpecular(float s) - { - m_specular = s; - } - - void setEnergy(const std::vector<float> &e) { - m_energy = e; - } - -private: - std::vector<float> m_color; - std::vector<float> m_pos; - std::vector<float> m_energy; - float m_screen[2]; - float m_specular; -}; - -// - class SunLightProvider: public CallBase { public: Modified: main/trunk/src/graphics/light.cpp =================================================================== --- main/trunk/src/graphics/light.cpp 2014-01-13 12:56:27 UTC (rev 15036) +++ main/trunk/src/graphics/light.cpp 2014-01-13 13:07:12 UTC (rev 15037) @@ -57,45 +57,6 @@ return; } -void LightNode::renderLightSet(const std::vector<float> &positions, const std::vector<float> &colors, const std::vector<float> &energy) -{ - assert (colors.size() == positions.size() && positions.size() == (energy.size() * 4)); - ScreenQuad *sq = new ScreenQuad(irr_driver->getVideoDriver()); - SMaterial &mat = sq->getMaterial(); - - mat.Lighting = false; - mat.MaterialType = irr_driver->getShader(ES_POINTLIGHT); - - mat.setTexture(0, irr_driver->getRTT(RTT_NORMAL_AND_DEPTH)); - - for (u32 i = 0; i < MATERIAL_MAX_TEXTURES; ++i) - { - mat.TextureLayer[i].TextureWrapU = - mat.TextureLayer[i].TextureWrapV = ETC_CLAMP_TO_EDGE; - } - - mat.setFlag(EMF_BILINEAR_FILTER, false); - mat.setFlag(EMF_ZWRITE_ENABLE, false); - - mat.MaterialTypeParam = pack_textureBlendFunc(EBF_ONE, EBF_ONE); - mat.BlendOperation = EBO_ADD; - - PointLightProvider * const cb = (PointLightProvider *) irr_driver->getCallback(ES_POINTLIGHT); - cb->setColor(colors); - cb->setPosition(positions); - cb->setEnergy(energy); - // Irrlicht's ScreenQuad reset the matrixes, we need to keep them - IVideoDriver * const drv = irr_driver->getVideoDriver(); - matrix4 tmpworld = drv->getTransform(ETS_WORLD); - matrix4 tmpview = drv->getTransform(ETS_VIEW); - matrix4 tmpproj = drv->getTransform(ETS_PROJECTION); - sq->render(false); - drv->setTransform(ETS_WORLD, tmpworld); - drv->setTransform(ETS_VIEW, tmpview); - drv->setTransform(ETS_PROJECTION, tmpproj); - return; -} - void LightNode::OnRegisterSceneNode() { // This node is only drawn manually. Modified: main/trunk/src/graphics/light.hpp =================================================================== --- main/trunk/src/graphics/light.hpp 2014-01-13 12:56:27 UTC (rev 15036) +++ main/trunk/src/graphics/light.hpp 2014-01-13 13:07:12 UTC (rev 15037) @@ -44,7 +44,6 @@ virtual ~LightNode(); virtual void render() OVERRIDE; - static void renderLightSet(const std::vector<float> &positions, const std::vector<float> &colors, const std::vector<float> &energy); virtual const core::aabbox3d<f32>& getBoundingBox() const OVERRIDE { Modified: main/trunk/src/graphics/shaders.cpp =================================================================== --- main/trunk/src/graphics/shaders.cpp 2014-01-13 12:56:27 UTC (rev 15036) +++ main/trunk/src/graphics/shaders.cpp 2014-01-13 13:07:12 UTC (rev 15037) @@ -47,7 +47,6 @@ m_callbacks[ES_GLOW] = new GlowProvider(); m_callbacks[ES_OBJECTPASS] = new ObjectPassProvider(); m_callbacks[ES_LIGHTBLEND] = new LightBlendProvider(); - m_callbacks[ES_POINTLIGHT] = new PointLightProvider(); m_callbacks[ES_SUNLIGHT] = new SunLightProvider(); m_callbacks[ES_MLAA_COLOR1] = new MLAAColor1Provider(); m_callbacks[ES_MLAA_BLEND2] = new MLAABlend2Provider(); @@ -160,9 +159,6 @@ m_shaders[ES_LIGHTBLEND] = glslmat(dir + "pass.vert", dir + "lightblend.frag", m_callbacks[ES_LIGHTBLEND], EMT_ONETEXTURE_BLEND); - m_shaders[ES_POINTLIGHT] = glslmat(dir + "pass.vert", dir + "pointlight.frag", - m_callbacks[ES_POINTLIGHT], EMT_ONETEXTURE_BLEND); - m_shaders[ES_SUNLIGHT] = glslmat(std::string(""), dir + "sunlight.frag", m_callbacks[ES_SUNLIGHT], EMT_SOLID); m_shaders[ES_SUNLIGHT_SHADOW] = glslmat(dir + "pass.vert", dir + "sunlightshadow.frag", Modified: main/trunk/src/graphics/shaders.hpp =================================================================== --- main/trunk/src/graphics/shaders.hpp 2014-01-13 12:56:27 UTC (rev 15036) +++ main/trunk/src/graphics/shaders.hpp 2014-01-13 13:07:12 UTC (rev 15037) @@ -50,7 +50,6 @@ ACT(ES_OBJECTPASS) \ ACT(ES_OBJECTPASS_REF) \ ACT(ES_LIGHTBLEND) \ - ACT(ES_POINTLIGHT) \ ACT(ES_SUNLIGHT) \ ACT(ES_SUNLIGHT_SHADOW) \ ACT(ES_OBJECTPASS_RIMLIT) \ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |