2007-05-27 12:01:53 -04:00
|
|
|
// $Id$
|
|
|
|
//
|
|
|
|
// SuperTuxKart - a fun racing game with go-kart
|
|
|
|
// Copyright (C) 2004-2005 Steve Baker <sjbaker1@airmail.net>
|
|
|
|
// Copyright (C) 2006 SuperTuxKart-Team, Steve Baker
|
|
|
|
//
|
|
|
|
// This program is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU General Public License
|
2008-06-12 20:53:52 -04:00
|
|
|
// as published by the Free Software Foundation; either version 3
|
2007-05-27 12:01:53 -04:00
|
|
|
// of the License, or (at your option) any later version.
|
|
|
|
//
|
1) Removed race_setup and race_mode data structures. All this
information is now only managed by the race_manager, no
more in-between objects to transfer information along.
2) The scores for grand prix are now defined in the stk_config.dat
file (10, 8, 6, 5, 4, .., 1, 0, 0) points
3) Bugfix: unlock information wasn't saved anymore. Added specific
saving after unlocking, plus re-inserted the 'generic' save
at the end of STK again.
4) bugfix/work around: Visual Studio complains about incompatible
iterators in sdldrv - apparently caused by using erase, and
then keep on using the iterator.
5) Fixed bug when running a race in a GP again (scores/times
were added each time).
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@1681 178a84e3-b1eb-0310-8ba1-8eac791a3b58
2008-04-09 09:52:48 -04:00
|
|
|
|
2007-05-27 12:01:53 -04:00
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with this program; if not, write to the Free Software
|
|
|
|
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
|
2009-02-01 17:54:00 -05:00
|
|
|
#ifndef HEADER_CAMERA_HPP
|
|
|
|
#define HEADER_CAMERA_HPP
|
2007-05-27 12:01:53 -04:00
|
|
|
|
2008-12-01 17:43:50 -05:00
|
|
|
#include "utils/vec3.hpp"
|
2009-02-10 00:30:59 -05:00
|
|
|
#include "irrlicht.h"
|
|
|
|
using namespace irr;
|
2009-08-02 19:42:03 -04:00
|
|
|
|
2008-05-05 02:58:42 -04:00
|
|
|
class Kart;
|
2007-05-27 12:01:53 -04:00
|
|
|
|
|
|
|
class Camera
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
enum Mode {
|
2008-05-05 02:58:42 -04:00
|
|
|
CM_NORMAL, // Normal camera mode
|
2009-05-12 16:23:27 -04:00
|
|
|
CM_CLOSEUP, // Closer to kart
|
|
|
|
CM_REVERSE, // Looking backwards
|
1) Removed race_setup and race_mode data structures. All this
information is now only managed by the race_manager, no
more in-between objects to transfer information along.
2) The scores for grand prix are now defined in the stk_config.dat
file (10, 8, 6, 5, 4, .., 1, 0, 0) points
3) Bugfix: unlock information wasn't saved anymore. Added specific
saving after unlocking, plus re-inserted the 'generic' save
at the end of STK again.
4) bugfix/work around: Visual Studio complains about incompatible
iterators in sdldrv - apparently caused by using erase, and
then keep on using the iterator.
5) Fixed bug when running a race in a GP again (scores/times
were added each time).
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@1681 178a84e3-b1eb-0310-8ba1-8eac791a3b58
2008-04-09 09:52:48 -04:00
|
|
|
CM_LEADER_MODE, // for deleted player karts in follow the leader
|
2008-05-19 23:33:48 -04:00
|
|
|
CM_FINAL, // Final camera to show the end of the race
|
2007-05-27 12:01:53 -04:00
|
|
|
CM_SIMPLE_REPLAY
|
|
|
|
};
|
2009-05-06 15:47:14 -04:00
|
|
|
|
2009-08-02 19:42:03 -04:00
|
|
|
private:
|
2009-02-10 00:30:59 -05:00
|
|
|
scene::ICameraSceneNode
|
|
|
|
*m_camera;
|
2009-05-06 15:47:14 -04:00
|
|
|
Mode m_mode; // Camera's mode
|
|
|
|
Vec3 m_position; // The ultimate position which the camera wants to obtain
|
|
|
|
Vec3 m_temp_position; // The position the camera currently has
|
|
|
|
Vec3 m_target; // The ultimate target which the camera wants to obtain
|
|
|
|
Vec3 m_temp_target; // The target the camera currently has
|
|
|
|
|
|
|
|
int m_index;
|
|
|
|
|
|
|
|
float m_distance; // Distance between the camera and the kart
|
|
|
|
float m_angle_up; // Angle between the ground and the camera (with the kart as the vertex of the angle)
|
|
|
|
float m_angle_around; // Angle around the kart (should actually match the rotation of the kart)
|
|
|
|
float m_position_speed; // The speed at which the camera changes position
|
|
|
|
float m_target_speed; // The speed at which the camera changes targets
|
2009-05-08 12:07:01 -04:00
|
|
|
float m_rotation_range; // Factor of the effects of steering in camera aim
|
2009-05-06 15:47:14 -04:00
|
|
|
|
|
|
|
const Kart *m_kart; // The kart that the camera follows
|
2007-05-27 12:01:53 -04:00
|
|
|
|
2008-05-19 23:33:48 -04:00
|
|
|
private:
|
2009-02-10 00:30:59 -05:00
|
|
|
|
2007-05-27 12:01:53 -04:00
|
|
|
public:
|
2009-02-01 17:54:00 -05:00
|
|
|
Camera (int camera_index, const Kart* kart);
|
|
|
|
~Camera ();
|
|
|
|
void setMode (Mode mode_); /** Set the camera to the given mode */
|
2008-07-24 21:06:50 -04:00
|
|
|
Mode getMode();
|
2009-02-01 17:54:00 -05:00
|
|
|
void reset ();
|
|
|
|
void setInitialTransform();
|
|
|
|
void update (float dt);
|
2009-11-23 00:20:05 -05:00
|
|
|
scene::ICameraSceneNode *getCameraSceneNode()
|
|
|
|
{
|
|
|
|
return m_camera;
|
|
|
|
}
|
2007-05-27 12:01:53 -04:00
|
|
|
} ;
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* EOF */
|