Use funto's motion blur effect only when using a zipper, but more visibly so

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@9456 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2011-08-10 01:46:58 +00:00
parent ef9d15c7f0
commit ca4bffe34d
5 changed files with 23 additions and 10 deletions

View File

@ -402,9 +402,6 @@ void Camera::getCameraSettings(float *above_kart, float *cam_angle,
*/
void Camera::update(float dt)
{
// Initially, disable motion blur
irr_driver->getPostProcessing()->setCameraSpeed(0.0f);
// The following settings give a debug camera which shows the track from
// high above the kart straight down.
if(UserConfigParams::m_camera_debug)
@ -447,9 +444,6 @@ void Camera::update(float dt)
m_camera->setTarget(current_target);
return;
}
// Apply the motion blur according to the speed of the kart
irr_driver->getPostProcessing()->setCameraSpeed(m_kart->getSpeed());
positionCamera(dt, above_kart, cam_angle, side_way, distance, smoothing);
} // update

View File

@ -1373,6 +1373,8 @@ void IrrDriver::update(float dt)
m_video_driver->endScene();
getPostProcessing()->update(dt);
// Enable this next print statement to get render information printed
// E.g. number of triangles rendered, culled etc. The stats is only
// printed while the race is running and not while the in-game menu

View File

@ -101,6 +101,15 @@ void PostProcessing::endCapture()
irr_driver->getVideoDriver()->setRenderTarget(0, true, true, 0);
}
void PostProcessing::update(float dt)
{
if (m_boost_amount > 0.0f)
{
m_boost_amount -= dt*5.0f;
if (m_boost_amount < 0.0f) m_boost_amount = 0.0f;
}
}
/** Render the post-processed scene */
void PostProcessing::render()
{
@ -126,9 +135,11 @@ void PostProcessing::render()
}
/** Set the boost amount according to the speed of the camera */
void PostProcessing::setCameraSpeed(float cam_speed)
void PostProcessing::giveBoost()
{
m_boost_amount = core::clamp(MOTION_BLUR_FACTOR * (cam_speed - MOTION_BLUR_OFFSET), 0.0f, 1.0f);
m_boost_amount = 5.0f;
//printf("setCameraSpeed(%f)\n", cam_speed);
//m_boost_amount = core::clamp(MOTION_BLUR_FACTOR * (cam_speed - MOTION_BLUR_OFFSET), 0.0f, 1.0f);
}
/** Implement IShaderConstantsSetCallback. Shader constants setter for post-processing */

View File

@ -48,14 +48,16 @@ public:
void beginCapture();
void endCapture();
void update(float dt);
/** Render the post-processed scene */
void render();
/** Is the hardware able to use post-processing? */
inline bool isSupported() const {return m_supported;}
/** Set the boost amount according to the speed of the camera */
void setCameraSpeed(float cam_speed);
/** Use motion blur for a short time */
void giveBoost();
/** Implement IShaderConstantsSetCallback. Shader constants setter for post-processing */
virtual void OnSetConstants(video::IMaterialRendererServices *services, s32 user_data);

View File

@ -387,6 +387,10 @@ void PlayerController::handleZipper(bool play_sound)
{
m_wee_sound->play();
}
// Apply the motion blur according to the speed of the kart
irr_driver->getPostProcessing()->giveBoost();
} // handleZipper
//-----------------------------------------------------------------------------