From 0cf6e4266a7d00c9dfec579f24716647187ffc5c Mon Sep 17 00:00:00 2001 From: Vincent Lejeune Date: Wed, 12 Feb 2014 17:24:37 +0100 Subject: [PATCH] Graphics: Clean some dead code. Still leave some shadow related code as comment, I will need later to port cand's work on penumbra shadow. --- src/graphics/gpuparticles.cpp | 7 ---- src/graphics/gpuparticles.hpp | 1 - src/graphics/post_processing.cpp | 2 -- src/graphics/render.cpp | 55 -------------------------------- src/graphics/rtts.cpp | 3 -- src/graphics/rtts.hpp | 3 -- src/graphics/shaders.cpp | 3 -- src/graphics/shaders.hpp | 2 -- src/graphics/sun.cpp | 37 ++------------------- 9 files changed, 2 insertions(+), 111 deletions(-) diff --git a/src/graphics/gpuparticles.cpp b/src/graphics/gpuparticles.cpp index 9f9894e6f..01487e970 100644 --- a/src/graphics/gpuparticles.cpp +++ b/src/graphics/gpuparticles.cpp @@ -65,13 +65,6 @@ ParticleSystemProxy::ParticleSystemProxy(bool createDefaultEmitter, const core::vector3df& position, const core::vector3df& rotation, const core::vector3df& scale) : CParticleSystemSceneNode(createDefaultEmitter, parent, mgr, id, position, rotation, scale), m_alpha_additive(false) { - fakemat.Lighting = false; - fakemat.ZWriteEnable = false; - fakemat.MaterialType = irr_driver->getShader(ES_RAIN); - fakemat.setTexture(0, getMaterial(0).getTexture(0)); - fakemat.BlendOperation = video::EBO_NONE; - fakemat.FrontfaceCulling = false; - fakemat.BackfaceCulling = false; glGenBuffers(1, &initial_values_buffer); glGenBuffers(2, tfb_buffers); glGenBuffers(1, &quaternionsbuffer); diff --git a/src/graphics/gpuparticles.hpp b/src/graphics/gpuparticles.hpp index 5228ed0e1..bb43ff84b 100644 --- a/src/graphics/gpuparticles.hpp +++ b/src/graphics/gpuparticles.hpp @@ -26,7 +26,6 @@ public: class ParticleSystemProxy : public scene::CParticleSystemSceneNode { protected: - video::SMaterial fakemat; GLuint tfb_buffers[2], initial_values_buffer, heighmapbuffer, heightmaptexture, quaternionsbuffer; GLuint current_simulation_vao, non_current_simulation_vao; GLuint current_hm_simulation_vao, non_currenthm__simulation_vao; diff --git a/src/graphics/post_processing.cpp b/src/graphics/post_processing.cpp index 1602eb97d..655cee47c 100644 --- a/src/graphics/post_processing.cpp +++ b/src/graphics/post_processing.cpp @@ -853,8 +853,6 @@ void PostProcessing::render() renderPassThrough(irr_driver->getRTT(RTT_NORMAL_AND_DEPTH)); else if (irr_driver->getSSAOViz()) renderPassThrough(irr_driver->getRTT(RTT_SSAO)); - else if (irr_driver->getShadowViz()) - renderPassThrough(static_cast(irr_driver->getRTT(RTT_SHADOW0))->DepthBufferTexture); else renderColorLevel(in); } diff --git a/src/graphics/render.cpp b/src/graphics/render.cpp index 04ab62daf..e34370e77 100644 --- a/src/graphics/render.cpp +++ b/src/graphics/render.cpp @@ -474,12 +474,6 @@ void IrrDriver::renderShadows(//ShadowImportanceProvider * const sicb, const Vec3 *vmin, *vmax; World::getWorld()->getTrack()->getAABB(&vmin, &vmax); - ITexture *ShadowRTT[] = { - m_rtts->getRTT(RTT_SHADOW0), - m_rtts->getRTT(RTT_SHADOW1), - m_rtts->getRTT(RTT_SHADOW2) - }; - const float oldfar = camnode->getFarValue(); const float oldnear = camnode->getNearValue(); float FarValues[] = @@ -562,7 +556,6 @@ void IrrDriver::renderShadows(//ShadowImportanceProvider * const sicb, glDisable(GL_BLEND); glEnable(GL_CULL_FACE); glCullFace(GL_FRONT); -// m_video_driver->setRenderTarget(ShadowRTT[0], true, true); glBindFramebuffer(GL_FRAMEBUFFER, m_rtts->getShadowFBO()); glViewport(0, 0, 1024, 1024); glClear(GL_DEPTH_BUFFER_BIT); @@ -682,11 +675,6 @@ void IrrDriver::renderGlow(video::SOverrideMaterial &overridemat, const u32 glowcount = glows.size(); ColorizeProvider * const cb = (ColorizeProvider *) m_shaders->m_callbacks[ES_COLORIZE]; -/* overridemat.Material.MaterialType = m_shaders->getShader(ES_COLORIZE); - overridemat.EnableFlags = video::EMF_MATERIAL_TYPE; - overridemat.EnablePasses = scene::ESNRP_SOLID; - overridemat.Enabled = true;*/ - glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE); glStencilFunc(GL_ALWAYS, 1, ~0); glEnable(GL_STENCIL_TEST); @@ -710,25 +698,6 @@ void IrrDriver::renderGlow(video::SOverrideMaterial &overridemat, cur->render(); } - // Second round for transparents; it's a no-op for solids -/* m_scene_manager->setCurrentRendertime(scene::ESNRP_TRANSPARENT); - overridemat.Material.MaterialType = m_shaders->getShader(ES_COLORIZE_REF); - for (u32 i = 0; i < glowcount; i++) - { - const GlowData &dat = glows[i]; - scene::ISceneNode * const cur = dat.node; - - // Quick box-based culling - const core::aabbox3df nodebox = cur->getTransformedBoundingBox(); - if (!nodebox.intersectsWithBox(cambox)) - continue; - - cb->setColor(dat.r, dat.g, dat.b); - cur->render(); - } - overridemat.Enabled = false; - overridemat.EnablePasses = 0;*/ - glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP); glDisable(GL_STENCIL_TEST); @@ -984,18 +953,6 @@ void IrrDriver::renderDisplacement(video::SOverrideMaterial &overridemat, glClearColor(0, 0, 0, 0); glClear(GL_COLOR_BUFFER_BIT); - overridemat.Enabled = 1; - overridemat.EnableFlags = video::EMF_MATERIAL_TYPE | video::EMF_TEXTURE0; - overridemat.Material.MaterialType = m_shaders->getShader(ES_DISPLACE); - - overridemat.Material.TextureLayer[0].Texture = - irr_driver->getTexture(FileManager::TEXTURE, "displace.png"); - overridemat.Material.TextureLayer[0].BilinearFilter = - overridemat.Material.TextureLayer[0].TrilinearFilter = true; - overridemat.Material.TextureLayer[0].AnisotropicFilter = 0; - overridemat.Material.TextureLayer[0].TextureWrapU = - overridemat.Material.TextureLayer[0].TextureWrapV = video::ETC_REPEAT; - DisplaceProvider * const cb = (DisplaceProvider *)irr_driver->getCallback(ES_DISPLACE); cb->update(); @@ -1008,7 +965,6 @@ void IrrDriver::renderDisplacement(video::SOverrideMaterial &overridemat, for (int i = 0; i < displacingcount; i++) { - m_scene_manager->setCurrentRendertime(scene::ESNRP_SOLID); m_displacing[i]->render(); @@ -1016,18 +972,7 @@ void IrrDriver::renderDisplacement(video::SOverrideMaterial &overridemat, m_displacing[i]->render(); } - overridemat.Enabled = 0; - // Blur it - video::SMaterial minimat; - minimat.Lighting = false; - minimat.ZWriteEnable = false; - minimat.ZBuffer = video::ECFN_ALWAYS; - minimat.setFlag(video::EMF_TRILINEAR_FILTER, true); - - minimat.TextureLayer[0].TextureWrapU = - minimat.TextureLayer[0].TextureWrapV = video::ETC_CLAMP_TO_EDGE; - m_post_processing->renderGaussian3Blur(m_rtts->getRTT(RTT_DISPLACE), m_rtts->getRTT(RTT_TMP2), 1.f / UserConfigParams::m_width, 1.f / UserConfigParams::m_height); m_video_driver->setRenderTarget(m_rtts->getRTT(RTT_COLOR), false, false); diff --git a/src/graphics/rtts.cpp b/src/graphics/rtts.cpp index 0489a41b5..077dc6fdf 100644 --- a/src/graphics/rtts.cpp +++ b/src/graphics/rtts.cpp @@ -90,9 +90,6 @@ RTT::RTT() rtts[RTT_SSAO] = drv->addRenderTargetTexture(ssaosize, "rtt.ssao", ECF_R8, stencil); - rtts[RTT_SHADOW0] = drv->addRenderTargetTexture(shadowsize0, "rtt.shadow0", ECF_A8R8G8B8, stencil); - rtts[RTT_SHADOW1] = drv->addRenderTargetTexture(shadowsize1, "rtt.shadow1", ECF_A8R8G8B8, stencil); - rtts[RTT_SHADOW2] = drv->addRenderTargetTexture(shadowsize2, "rtt.shadow2", ECF_A8R8G8B8, stencil); rtts[RTT_WARPV] = drv->addRenderTargetTexture(warpvsize, "rtt.warpv", ECF_A8R8G8B8, stencil); rtts[RTT_WARPH] = drv->addRenderTargetTexture(warphsize, "rtt.warph", ECF_A8R8G8B8, stencil); diff --git a/src/graphics/rtts.hpp b/src/graphics/rtts.hpp index 813fc084a..9282f885e 100644 --- a/src/graphics/rtts.hpp +++ b/src/graphics/rtts.hpp @@ -51,9 +51,6 @@ enum TypeRTT RTT_SSAO, - RTT_SHADOW0, - RTT_SHADOW1, - RTT_SHADOW2, RTT_COLLAPSE, RTT_COLLAPSEH, RTT_COLLAPSEV, diff --git a/src/graphics/shaders.cpp b/src/graphics/shaders.cpp index 9f50109cb..9a82c7e55 100644 --- a/src/graphics/shaders.cpp +++ b/src/graphics/shaders.cpp @@ -145,8 +145,6 @@ void Shaders::loadShaders() m_shaders[ES_COLORIZE] = glslmat(std::string(""), dir + "colorize.frag", m_callbacks[ES_COLORIZE], EMT_SOLID); - m_shaders[ES_COLORIZE_REF] = glslmat(std::string(""), dir + "colorize_ref.frag", - m_callbacks[ES_COLORIZE], EMT_SOLID); m_shaders[ES_OBJECTPASS] = glsl_noinput(dir + "objectpass.vert", dir + "objectpass.frag"); m_shaders[ES_OBJECT_UNLIT] = glsl_noinput(dir + "objectpass.vert", dir + "objectpass.frag"); @@ -154,7 +152,6 @@ void Shaders::loadShaders() m_shaders[ES_OBJECTPASS_RIMLIT] = glsl_noinput(dir + "objectpass_rimlit.vert", dir + "objectpass_rimlit.frag"); m_shaders[ES_SUNLIGHT] = glsl_noinput(std::string(""), dir + "sunlight.frag"); - m_shaders[ES_SUNLIGHT_SHADOW] = glsl_noinput(dir + "pass.vert", dir + "pass.frag"); m_shaders[ES_MLAA_COLOR1] = glsl(dir + "mlaa_offset.vert", dir + "mlaa_color1.frag", m_callbacks[ES_MLAA_COLOR1]); diff --git a/src/graphics/shaders.hpp b/src/graphics/shaders.hpp index c00c5c5b9..c0b8352e7 100644 --- a/src/graphics/shaders.hpp +++ b/src/graphics/shaders.hpp @@ -538,12 +538,10 @@ public: ACT(ES_GAUSSIAN3V) \ ACT(ES_MIPVIZ) \ ACT(ES_COLORIZE) \ - ACT(ES_COLORIZE_REF) \ ACT(ES_OBJECT_UNLIT) \ ACT(ES_OBJECTPASS) \ ACT(ES_OBJECTPASS_REF) \ ACT(ES_SUNLIGHT) \ - ACT(ES_SUNLIGHT_SHADOW) \ ACT(ES_OBJECTPASS_RIMLIT) \ ACT(ES_MLAA_COLOR1) \ ACT(ES_MLAA_BLEND2) \ diff --git a/src/graphics/sun.cpp b/src/graphics/sun.cpp index e18fb8796..dd20a74b4 100644 --- a/src/graphics/sun.cpp +++ b/src/graphics/sun.cpp @@ -37,39 +37,6 @@ using namespace core; SunNode::SunNode(scene::ISceneManager* mgr, scene::ISceneNode* parent, float r, float g, float b): LightNode(mgr, parent, 0., r, g, b) { - sq = new ScreenQuad(irr_driver->getVideoDriver()); - - SMaterial &m = sq->getMaterial(); - - m.MaterialType = irr_driver->getShader(ES_SUNLIGHT); - m.setTexture(0, irr_driver->getRTT(RTT_NORMAL_AND_DEPTH)); - m.setTexture(2, irr_driver->getTexture(file_manager->getAsset(FileManager::TEXTURE,"cloudshadow.png"))); - m.setFlag(EMF_BILINEAR_FILTER, false); - m.MaterialTypeParam = pack_textureBlendFunc(EBF_ONE, EBF_ONE); - m.BlendOperation = EBO_ADD; - - if (UserConfigParams::m_shadows) - { -// m.setTexture(3, irr_driver->getRTT(RTT_SHADOW)); - m.setTexture(4, irr_driver->getRTT(RTT_WARPH)); - m.setTexture(5, irr_driver->getRTT(RTT_WARPV)); - - m.TextureLayer[4].BilinearFilter = - m.TextureLayer[5].BilinearFilter = true; - - m.MaterialType = irr_driver->getShader(ES_SUNLIGHT_SHADOW); - } - - for (u32 i = 0; i < MATERIAL_MAX_TEXTURES; i++) - { - m.TextureLayer[i].TextureWrapU = m.TextureLayer[i].TextureWrapV = - ETC_CLAMP_TO_EDGE; - } - - m.TextureLayer[2].TextureWrapU = m.TextureLayer[2].TextureWrapV = ETC_REPEAT; - - m.TextureLayer[2].TrilinearFilter = true; - m_color[0] = r; m_color[1] = g; m_color[2] = b; @@ -89,7 +56,7 @@ void SunNode::render() cb->setPosition(pos.X, pos.Y, pos.Z); return; - array mrt; +/* array mrt; mrt.reallocate(2); mrt.push_back(irr_driver->getRTT(RTT_TMP2)); mrt.push_back(irr_driver->getRTT(RTT_TMP3)); @@ -151,5 +118,5 @@ void SunNode::render() tmpsq.getMaterial().BlendOperation = EBO_ADD; irr_driver->getVideoDriver()->setRenderTarget(irr_driver->getRTT(RTT_TMP1), false, false); - tmpsq.render(false); + tmpsq.render(false);*/ }