From c8e5c1304ee8a572483535723c8bc061974ee8f3 Mon Sep 17 00:00:00 2001 From: auria Date: Mon, 17 Oct 2011 22:18:27 +0000 Subject: [PATCH] Largely minizime the impacts of anti-aliasing being broken by post processing git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@10006 178a84e3-b1eb-0310-8ba1-8eac791a3b58 --- src/graphics/post_processing.cpp | 19 ++++++++++++++++++- src/graphics/post_processing.hpp | 3 +++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/graphics/post_processing.cpp b/src/graphics/post_processing.cpp index 93109e1e5..82bbf43a3 100644 --- a/src/graphics/post_processing.cpp +++ b/src/graphics/post_processing.cpp @@ -91,6 +91,15 @@ void PostProcessing::beginCapture() race_manager->getNumPlayers() > 1) return; + // don't capture the input when we have no post-processing to add + // it will be faster and this ay we won't lose anti-aliasing + if (m_boost_amount <= 0.0f) + { + m_used_pp_this_frame = false; + return; + } + + m_used_pp_this_frame = true; irr_driver->getVideoDriver()->setRenderTarget(m_render_target, true, true); } @@ -101,7 +110,10 @@ void PostProcessing::endCapture() race_manager->getNumPlayers() > 1) return; - irr_driver->getVideoDriver()->setRenderTarget(0, true, true, 0); + if (m_used_pp_this_frame) + { + irr_driver->getVideoDriver()->setRenderTarget(video::ERT_FRAME_BUFFER, true, true, 0); + } } void PostProcessing::update(float dt) @@ -120,6 +132,11 @@ void PostProcessing::render() race_manager->getNumPlayers() > 1) return; + if (!m_used_pp_this_frame) + { + return; + } + // Draw the fullscreen quad while applying the corresponding post-processing shaders video::IVideoDriver* video_driver = irr_driver->getVideoDriver(); video::S3DVertex vertices[6]; diff --git a/src/graphics/post_processing.hpp b/src/graphics/post_processing.hpp index dc8e6225f..5f844611b 100644 --- a/src/graphics/post_processing.hpp +++ b/src/graphics/post_processing.hpp @@ -36,6 +36,9 @@ private: /** Boost amount, used to tune the motion blur. Must be in the range 0.0 to 1.0 */ float m_boost_amount; + + bool m_used_pp_this_frame; + public: PostProcessing(); virtual ~PostProcessing();