SuperTuxKart
Loading...
Searching...
No Matches
camera_normal.hpp
1//
2// SuperTuxKart - a fun racing game with go-kart
3// Copyright (C) 2004-2015 Steve Baker <sjbaker1@airmail.net>
4// Copyright (C) 2006-2015 SuperTuxKart-Team, Steve Baker
5//
6// This program is free software; you can redistribute it and/or
7// modify it under the terms of the GNU General Public License
8// as published by the Free Software Foundation; either version 3
9// of the License, or (at your option) any later version.
10//
11
12// This program is distributed in the hope that it will be useful,
13// but WITHOUT ANY WARRANTY; without even the implied warranty of
14// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15// GNU General Public License for more details.
16//
17// You should have received a copy of the GNU General Public License
18// along with this program; if not, write to the Free Software
19// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20
21#ifndef HEADER_CAMERA_NORMAL_HPP
22#define HEADER_CAMERA_NORMAL_HPP
23
24#include "graphics/camera.hpp"
25
26#include "utils/cpp2011.hpp"
27
32class CameraNormal : public Camera
33{
34
35private:
36
38 video::SColor m_ambient_light;
39
42
45
48
51
52 Vec3 m_camera_offset;
53
54 void moveCamera(float dt, bool smooth, float cam_angle, float distance);
55 void handleEndCamera(float dt);
56 void getCameraSettings(float *above_kart, float *cam_angle,
57 float *side_way, float *distance,
58 bool *smoothing, float *cam_roll_angle);
59
60 void positionCamera(float dt, float above_kart, float cam_angle,
61 float side_way, float distance, float smoothing,
62 float cam_roll_angle);
63
64 btVector3 m_kart_position;
65 btQuaternion m_kart_rotation;
66
67 // Give a few classes access to the constructor (mostly for inheritance)
68 friend class Camera;
69 friend class CameraDebug;
70 friend class CameraEnd;
71 CameraNormal(Camera::CameraType type, int camera_index,
72 AbstractKart* kart);
73 virtual ~CameraNormal() {}
74public:
75
76 void snapToPosition();
77 // ------------------------------------------------------------------------
78 bool isDebug() { return false; }
79 // ------------------------------------------------------------------------
80 bool isFPS() { return false; }
81 // ------------------------------------------------------------------------
82 virtual void update(float dt) OVERRIDE;
83 // ------------------------------------------------------------------------
85 void setAmbientLight(const video::SColor &color) { m_ambient_light=color; }
86 // ------------------------------------------------------------------------
87 void setDistanceToKart(float distance) { m_distance = distance; }
88 // ------------------------------------------------------------------------
89 float getDistanceToKart() const { return m_distance; }
90 // ------------------------------------------------------------------------
92 const video::SColor &getAmbientLight() const {return m_ambient_light; }
93
94}; // class CameraNormal
95
96#endif
97
98/* EOF */
An abstract interface for the actual karts.
Definition: abstract_kart.hpp:62
Handles the debug camera.
Definition: camera_debug.hpp:34
Handles the end race camera.
Definition: camera_end.hpp:34
Handles the normal racing camera.
Definition: camera_normal.hpp:33
float m_target_speed
The speed at which the camera target changes position.
Definition: camera_normal.hpp:47
virtual void update(float dt) OVERRIDE
Called once per time frame to move the camera to the right position.
Definition: camera_normal.cpp:300
float m_distance
Distance between the camera and the kart.
Definition: camera_normal.hpp:41
float m_position_speed
The speed at which the camera changes position.
Definition: camera_normal.hpp:44
float m_rotation_range
Factor of the effects of steering in camera aim.
Definition: camera_normal.hpp:50
video::SColor m_ambient_light
Current ambient light for this camera.
Definition: camera_normal.hpp:38
void positionCamera(float dt, float above_kart, float cam_angle, float side_way, float distance, float smoothing, float cam_roll_angle)
Actually sets the camera based on the given parameter.
Definition: camera_normal.cpp:346
void moveCamera(float dt, bool smooth, float cam_angle, float distance)
Moves the camera smoothly from the current camera position (and target) to the new position and targe...
Definition: camera_normal.cpp:80
void getCameraSettings(float *above_kart, float *cam_angle, float *side_way, float *distance, bool *smoothing, float *cam_roll_angle)
Determine the camera settings for the current frame.
Definition: camera_normal.cpp:191
const video::SColor & getAmbientLight() const
Returns the current ambient light.
Definition: camera_normal.hpp:92
void setAmbientLight(const video::SColor &color)
Sets the ambient light for this camera.
Definition: camera_normal.hpp:85
This is the base class for all cameras.
Definition: camera.hpp:49
CameraType
The different camera types that can be used.
Definition: camera.hpp:53
A wrapper around bullets btVector3 to include conventient conversion functions (e....
Definition: vec3.hpp:35