SuperTuxKart
|
This is the base class for all cameras. More...
#include <camera.hpp>
Public Types | |
enum | CameraType { CM_TYPE_NORMAL , CM_TYPE_DEBUG , CM_TYPE_FPS , CM_TYPE_END } |
The different camera types that can be used. More... | |
enum | Mode { CM_NORMAL , CM_CLOSEUP , CM_REVERSE , CM_LEADER_MODE , CM_SPECTATOR_SOCCER , CM_SPECTATOR_TOP_VIEW , CM_SIMPLE_REPLAY , CM_FALLING } |
Public Member Functions | |
void | setMode (Mode mode) |
Sets the mode of the camera. | |
Mode | getMode () |
Set the camera to the given mode. | |
Mode | getPreviousMode () |
Returns the last known mode of the camera. | |
bool | isSpectatorMode () |
Returns true if camera is a spectator camera. | |
void | setNextSpectatorMode () |
Switch to next spectator mode (a -> soccer -> top view -> a) | |
void | setKart (AbstractKart *new_kart) |
Changes the owner of this camera to the new kart. | |
virtual void | setInitialTransform () |
Saves the current kart position as the initial starting position for the camera. | |
virtual void | activate (bool alsoActivateInIrrlicht=true) |
Sets viewport etc. | |
virtual void | update (float dt) |
Called once per time frame to move the camera to the right position. | |
CameraType | getType () |
Returns the type of this camera. | |
void | setFoV () |
Sets the field of view for the irrlicht camera. | |
int | getIndex () const |
Returns the camera index (or player kart index, which is the same). | |
core::matrix4 | getPreviousPVMatrix () const |
Returns the project-view matrix of the previous frame. | |
void | setPreviousPVMatrix (core::matrix4 mat) |
Returns the project-view matrix of the previous frame. | |
const AbstractKart * | getKart () const |
Returns the kart to which this camera is attached. | |
AbstractKart * | getKart () |
Returns the kart to which this camera is attached. | |
void | setAmbientLight (const video::SColor &color) |
Sets the ambient light for this camera. | |
const video::SColor & | getAmbientLight () const |
Returns the current ambient light. | |
const core::recti & | getViewport () const |
Returns the viewport of this camera. | |
const core::vector2df & | getScaling () const |
Returns the scaling in x/y direction for this camera. | |
scene::ICameraSceneNode * | getCameraSceneNode () |
Returns the camera scene node. | |
Vec3 | getXYZ () |
Returs the absolute position of the camera. | |
void | setupCamera () |
Sets up the viewport, aspect ratio, field of view, and scaling for this camera. | |
Static Public Member Functions | |
static Camera * | createCamera (AbstractKart *kart, const int index) |
Creates a new camera and adds it to the list of all cameras. | |
static void | resetAllCameras () |
static void | changeCamera (unsigned int camera_index, CameraType type) |
static void | setDefaultCameraType (CameraType type) |
Sets the default type for each camera that will be created. | |
static CameraType | getDefaultCameraType () |
Returns the default type for each camera that will be created. | |
static unsigned int | getNumCameras () |
Returns the number of cameras used. | |
static Camera * | getCamera (unsigned int n) |
Returns a camera. | |
static Camera * | getActiveCamera () |
Returns the currently active camera. | |
static void | removeAllCameras () |
Remove all cameras. | |
Protected Member Functions | |
Camera (CameraType type, int camera_index, AbstractKart *kart) | |
virtual | ~Camera () |
Removes the camera scene node from the scene. | |
virtual void | reset () |
Reset is called when a new race starts. | |
Static Protected Member Functions | |
static Camera * | createCamera (unsigned int index, CameraType type, AbstractKart *kart) |
Creates a camera of the specified type, but does not add it to the list of all cameras. | |
Protected Attributes | |
scene::ICameraSceneNode * | m_camera |
The camera scene node. | |
AbstractKart * | m_kart |
The kart that the camera follows. | |
Private Attributes | |
core::matrix4 | m_previous_pv_matrix |
The project-view matrix of the previous frame, used for the blur shader. | |
Mode | m_mode |
Camera's mode. | |
Mode | m_previous_mode |
CameraType | m_type |
The type of the camera. | |
unsigned int | m_index |
The index of this camera which is the index of the kart it is attached to. | |
video::SColor | m_ambient_light |
Current ambient light for this camera. | |
AbstractKart * | m_original_kart |
A pointer to the original kart the camera was pointing at when it was created. | |
core::recti | m_viewport |
The viewport for this camera (portion of the game window covered by this camera) | |
core::vector2df | m_scaling |
The scaling necessary for each axis. | |
float | m_fov |
Field of view for the camera. | |
float | m_aspect |
Aspect ratio for camera. | |
Static Private Attributes | |
static Camera * | s_active_camera = NULL |
static CameraType | m_default_type = Camera::CM_TYPE_NORMAL |
The default type for any newly created camera. | |
static std::vector< Camera * > | m_all_cameras |
List of all cameras. | |
This is the base class for all cameras.
It also includes some static functions to keep track of all cameras (e.g. a static function to create a camera, get a camera with a specified index).
enum Camera::CameraType |
The different camera types that can be used.
Enumerator | |
---|---|
CM_TYPE_DEBUG | A debug camera. |
CM_TYPE_FPS | FPS Camera. |
CM_TYPE_END | End camera. |
enum Camera::Mode |
|
virtual |
Sets viewport etc.
for this camera. Called from irr_driver just before rendering the view for this kart.
|
static |
Creates a new camera and adds it to the list of all cameras.
Also the camera index (which determines which viewport to use in split screen) is set.
|
staticprotected |
Creates a camera of the specified type, but does not add it to the list of all cameras.
This is a helper function for other static functions.
index | Index this camera has in the list of all cameras. |
type | The camera type of the camera to create. |
kart | To which kart the camera is attached (NULL if a free camera). |
|
inlinestatic |
Returns the default type for each camera that will be created.
Used for command line parameters to select a debug etc camera.
Camera::Mode Camera::getMode | ( | ) |
Set the camera to the given mode.
Returns the current mode of the camera.
|
protectedvirtual |
Reset is called when a new race starts.
Make sure that the camera is aligned neutral, and not like in the previous race
|
inlinestatic |
Sets the default type for each camera that will be created.
Used for command line parameters to select a debug etc camera.
void Camera::setKart | ( | AbstractKart * | new_kart | ) |
Changes the owner of this camera to the new kart.
new_kart | The new kart to use this camera. |
void Camera::setMode | ( | Mode | mode | ) |
Sets the mode of the camera.
mode | Mode the camera should be switched to. |
|
virtual |
Called once per time frame to move the camera to the right position.
dt | Time step. |
Reimplemented in CameraDebug, CameraEnd, CameraFPS, and CameraNormal.
|
staticprivate |
The default type for any newly created camera.
Used to store command line parameters.
|
protected |
The kart that the camera follows.
It can't be const, since in profile mode the camera might change its owner. May be NULL (example: cutscene camera)
|
private |
A pointer to the original kart the camera was pointing at when it was created.
Used when restarting a race (since the camera might get attached to another kart if a kart is elimiated).