21#ifndef HEADER_CAMERA_HPP
22#define HEADER_CAMERA_HPP
24#include "io/xml_node.hpp"
25#include "utils/no_copy.hpp"
26#include "utils/aligned_array.hpp"
27#include "utils/leak_check.hpp"
28#include "utils/log.hpp"
29#include "utils/vec3.hpp"
38#include "ICameraSceneNode.h"
75 static Camera* s_active_camera;
134 virtual void reset();
141 static
void resetAllCameras();
142 static
void changeCamera(
unsigned int camera_index,
CameraType type);
182 virtual void activate(
bool alsoActivateInIrrlicht=
true);
183 virtual void update(
float dt);
An abstract interface for the actual karts.
Definition: abstract_kart.hpp:62
This is the base class for all cameras.
Definition: camera.hpp:49
static Camera * getActiveCamera()
Returns the currently active camera.
Definition: camera.hpp:163
virtual void reset()
Reset is called when a new race starts.
Definition: camera.cpp:256
CameraType m_type
The type of the camera.
Definition: camera.hpp:85
core::recti m_viewport
The viewport for this camera (portion of the game window covered by this camera)
Definition: camera.hpp:104
void setPreviousPVMatrix(core::matrix4 mat)
Returns the project-view matrix of the previous frame.
Definition: camera.hpp:199
AbstractKart * m_original_kart
A pointer to the original kart the camera was pointing at when it was created.
Definition: camera.hpp:101
core::matrix4 getPreviousPVMatrix() const
Returns the project-view matrix of the previous frame.
Definition: camera.hpp:195
core::matrix4 m_previous_pv_matrix
The project-view matrix of the previous frame, used for the blur shader.
Definition: camera.hpp:78
unsigned int m_index
The index of this camera which is the index of the kart it is attached to.
Definition: camera.hpp:93
CameraType getType()
Returns the type of this camera.
Definition: camera.hpp:186
virtual void update(float dt)
Called once per time frame to move the camera to the right position.
Definition: camera.cpp:293
virtual void activate(bool alsoActivateInIrrlicht=true)
Sets viewport etc.
Definition: camera.cpp:321
static std::vector< Camera * > m_all_cameras
List of all cameras.
Definition: camera.hpp:117
Vec3 getXYZ()
Returs the absolute position of the camera.
Definition: camera.hpp:230
AbstractKart * getKart()
Returns the kart to which this camera is attached.
Definition: camera.hpp:207
static unsigned int getNumCameras()
Returns the number of cameras used.
Definition: camera.hpp:154
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.
Definition: camera.cpp:76
AbstractKart * m_kart
The kart that the camera follows.
Definition: camera.hpp:127
void setFoV()
Sets the field of view for the irrlicht camera.
Definition: camera.hpp:189
const core::vector2df & getScaling() const
Returns the scaling in x/y direction for this camera.
Definition: camera.hpp:223
void setAmbientLight(const video::SColor &color)
Sets the ambient light for this camera.
Definition: camera.hpp:211
void setMode(Mode mode)
Sets the mode of the camera.
Definition: camera.cpp:197
const core::recti & getViewport() const
Returns the viewport of this camera.
Definition: camera.hpp:219
static CameraType m_default_type
The default type for any newly created camera.
Definition: camera.hpp:89
bool isSpectatorMode()
Returns true if camera is a spectator camera.
Definition: camera.cpp:237
Mode getPreviousMode()
Returns the last known mode of the camera.
Definition: camera.cpp:229
const AbstractKart * getKart() const
Returns the kart to which this camera is attached.
Definition: camera.hpp:203
scene::ICameraSceneNode * m_camera
The camera scene node.
Definition: camera.hpp:121
static void setDefaultCameraType(CameraType type)
Sets the default type for each camera that will be created.
Definition: camera.hpp:147
float m_fov
Field of view for the camera.
Definition: camera.hpp:110
video::SColor m_ambient_light
Current ambient light for this camera.
Definition: camera.hpp:96
static CameraType getDefaultCameraType()
Returns the default type for each camera that will be created.
Definition: camera.hpp:151
core::vector2df m_scaling
The scaling necessary for each axis.
Definition: camera.hpp:107
int getIndex() const
Returns the camera index (or player kart index, which is the same).
Definition: camera.hpp:192
scene::ICameraSceneNode * getCameraSceneNode()
Returns the camera scene node.
Definition: camera.hpp:227
float m_aspect
Aspect ratio for camera.
Definition: camera.hpp:113
void setupCamera()
Sets up the viewport, aspect ratio, field of view, and scaling for this camera.
Definition: camera.cpp:169
static void removeAllCameras()
Remove all cameras.
Definition: camera.hpp:166
virtual ~Camera()
Removes the camera scene node from the scene.
Definition: camera.cpp:142
Mode getMode()
Set the camera to the given mode.
Definition: camera.cpp:221
void setKart(AbstractKart *new_kart)
Changes the owner of this camera to the new kart.
Definition: camera.cpp:154
virtual void setInitialTransform()
Saves the current kart position as the initial starting position for the camera.
Definition: camera.cpp:269
static Camera * getCamera(unsigned int n)
Returns a camera.
Definition: camera.hpp:160
CameraType
The different camera types that can be used.
Definition: camera.hpp:53
@ CM_TYPE_FPS
FPS Camera.
Definition: camera.hpp:56
@ CM_TYPE_END
End camera.
Definition: camera.hpp:57
@ CM_TYPE_DEBUG
A debug camera.
Definition: camera.hpp:55
Mode m_mode
Camera's mode.
Definition: camera.hpp:81
Mode
Definition: camera.hpp:62
@ CM_NORMAL
Normal camera mode.
Definition: camera.hpp:63
@ CM_LEADER_MODE
for deleted player karts in follow the leader
Definition: camera.hpp:66
@ CM_CLOSEUP
Closer to kart.
Definition: camera.hpp:64
@ CM_REVERSE
Looking backwards.
Definition: camera.hpp:65
@ CM_SPECTATOR_TOP_VIEW
for spectator (top view on ball if soccer or top view on kart)
Definition: camera.hpp:68
@ CM_SPECTATOR_SOCCER
for spectator (in soccer mode)
Definition: camera.hpp:67
const video::SColor & getAmbientLight() const
Returns the current ambient light.
Definition: camera.hpp:215
void setNextSpectatorMode()
Switch to next spectator mode (a -> soccer -> top view -> a)
Definition: camera.cpp:245
Utility class, you can inherit from this class to disallow the assignment operator and copy construct...
Definition: no_copy.hpp:26
A wrapper around bullets btVector3 to include conventient conversion functions (e....
Definition: vec3.hpp:35