From 01bde2eb8dddab96460b1653f62eb5eb0e676a1d Mon Sep 17 00:00:00 2001 From: auria Date: Mon, 22 Feb 2010 00:15:36 +0000 Subject: [PATCH] Added moving camera in GP end git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@4792 178a84e3-b1eb-0310-8ba1-8eac791a3b58 --- src/states_screens/grand_prix_over.cpp | 31 ++++++++++++++++++++++++-- src/states_screens/grand_prix_over.hpp | 3 +++ 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/src/states_screens/grand_prix_over.cpp b/src/states_screens/grand_prix_over.cpp index 21852a68d..ed9902552 100644 --- a/src/states_screens/grand_prix_over.cpp +++ b/src/states_screens/grand_prix_over.cpp @@ -46,9 +46,15 @@ void GrandPrixOver::init() 1.0f /* texture_percent */, 2.0f /* sphere_percent */); m_camera = irr_driver->addCameraSceneNode(); - m_camera->setPosition( core::vector3df(3.0, 0.0f, -5.0f) ); + m_camera_x = 3.0f; + m_camera_y = 0.0f; + m_camera_z = -5.0f; + m_camera->setPosition( core::vector3df(m_camera_x, m_camera_y, m_camera_z) ); m_camera->setUpVector( core::vector3df(0.0, 1.0, 0.0) ); - m_camera->setTarget( core::vector3df(1.5f, -2.0f, 0.0f) ); + + m_camera_target_x = 1.5f; + m_camera_target_z = 0.0f; + m_camera->setTarget( core::vector3df(m_camera_target_x, -2.0f, m_camera_target_z) ); m_camera->setFOV( DEGREE_TO_RAD*50.0f ); m_camera->updateAbsolutePosition(); @@ -228,6 +234,27 @@ void GrandPrixOver::onUpdate(float dt, irr::video::IVideoDriver* driver) } + if (m_phase > 1) + { + //m_camera_x = 3.0f; + if (m_camera_z < -2.0f) m_camera_z += dt*0.2f; + if (m_camera_x < m_podium_x[1]) m_camera_x += dt*0.1f; + else if (m_camera_x > m_podium_x[1]) m_camera_x -= dt*0.1f; + + if (m_camera_target_x < m_podium_x[1]) m_camera_target_x += dt*0.1f; + + if (m_camera_y > -1.8f) m_camera_y -= dt*0.1f; + //else if (m_camera_y < -3.0f) m_camera_y += dt*0.1f; + + + m_camera->setTarget( core::vector3df(m_camera_target_x, -2.0f, m_camera_target_z) ); + + m_camera->setPosition( core::vector3df(m_camera_x, m_camera_y, m_camera_z) ); + m_camera->setUpVector( core::vector3df(0.0, 1.0, 0.0) ); + m_camera->updateAbsolutePosition(); + } + + // ---- title static const int w = irr_driver->getFrameSize().Width; static const int h = irr_driver->getFrameSize().Height; diff --git a/src/states_screens/grand_prix_over.hpp b/src/states_screens/grand_prix_over.hpp index 23f6308a1..76c518dab 100644 --- a/src/states_screens/grand_prix_over.hpp +++ b/src/states_screens/grand_prix_over.hpp @@ -35,6 +35,9 @@ class GrandPrixOver : public GUIEngine::Screen, public GUIEngine::ScreenSingleto float m_podium_x[3], m_podium_z[3]; float m_kart_rotation[3]; + float m_camera_x, m_camera_y, m_camera_z; + float m_camera_target_x, m_camera_target_z; + public: void onUpdate(float dt, irr::video::IVideoDriver*);