SuperTuxKart
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
CameraFPS Class Reference

Handles the game camera. More...

#include <camera_fps.hpp>

Inheritance diagram for CameraFPS:
Inheritance graph
[legend]

Public Member Functions

virtual void update (float dt) OVERRIDE
 Called once per time frame to move the camera to the right position. More...
 
void applyMouseMovement (float x, float y)
 Applies mouse movement to the first person camera. More...
 
void setSmoothMovement (bool value)
 Sets if the first person camera should be moved smooth. More...
 
bool getSmoothMovement ()
 If the first person camera should be moved smooth. More...
 
void setAttachedFpsCam (bool value)
 Sets if the first person camera should be moved with the kart. More...
 
bool getAttachedFpsCam ()
 If the first person camera should be moved with the kart. More...
 
void setMaximumVelocity (float vel)
 Sets the angular velocity for this camera. More...
 
float getMaximumVelocity ()
 Returns the current angular velocity. More...
 
void setDirection (core::vector3df target)
 Sets the vector, the first person camera should look at. More...
 
const core::vector3df & getDirection ()
 Gets the vector, the first person camera should look at. More...
 
void setUpVector (core::vector3df target)
 Sets the up vector, the first person camera should use. More...
 
const core::vector3df & getUpVector ()
 Gets the up vector, the first person camera should use. More...
 
void setAngularVelocity (float vel)
 Sets the angular velocity for this camera. More...
 
float getAngularVelocity ()
 Returns the current target angular velocity. More...
 
void setLinearVelocity (core::vector3df vel)
 Sets the linear velocity for this camera. More...
 
const core::vector3df & getLinearVelocity ()
 Returns the current linear velocity. More...
 
- Public Member Functions inherited from Camera
void setMode (Mode mode)
 Sets the mode of the camera. More...
 
Mode getMode ()
 Set the camera to the given mode. More...
 
void setKart (AbstractKart *new_kart)
 Changes the owner of this camera to the new kart. More...
 
virtual void setInitialTransform ()
 Saves the current kart position as initial starting position for the camera.
 
virtual void activate (bool alsoActivateInIrrlicht=true)
 Sets viewport etc. More...
 
CameraType getType ()
 Returns the type of this camera. More...
 
void setFoV ()
 Sets the field of view for the irrlicht camera. More...
 
int getIndex () const
 Returns the camera index (or player kart index, which is the same). More...
 
core::matrix4 getPreviousPVMatrix () const
 Returns the project-view matrix of the previous frame. More...
 
void setPreviousPVMatrix (core::matrix4 mat)
 Returns the project-view matrix of the previous frame. More...
 
const AbstractKartgetKart () const
 Returns the kart to which this camera is attached. More...
 
AbstractKartgetKart ()
 Returns the kart to which this camera is attached. More...
 
void setAmbientLight (const video::SColor &color)
 Sets the ambient light for this camera. More...
 
const video::SColor & getAmbientLight () const
 Returns the current ambient light. More...
 
const core::recti & getViewport () const
 Returns the viewport of this camera. More...
 
const core::vector2df & getScaling () const
 Returns the scaling in x/y direction for this camera. More...
 
scene::ICameraSceneNode * getCameraSceneNode ()
 Returns the camera scene node. More...
 
Vec3 getXYZ ()
 Returs the absolute position of the camera. More...
 

Static Public Member Functions

static bool isFPS ()
 
- Static Public Member Functions inherited from Camera
static CameracreateCamera (AbstractKart *kart, const int index)
 Creates a new camera and adds it to the list of all cameras. More...
 
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. More...
 
static CameraType getDefaultCameraType ()
 Returns the default type for each camera that will be created. More...
 
static unsigned int getNumCameras ()
 Returns the number of cameras used. More...
 
static CameragetCamera (unsigned int n)
 Returns a camera. More...
 
static CameragetActiveCamera ()
 Returns the currently active camera. More...
 
static void removeAllCameras ()
 Remove all cameras. More...
 

Private Member Functions

void positionCamera (float dt, float above_kart, float cam_angle, float side_way, float distance, float smoothing)
 
 CameraFPS (int camera_index, AbstractKart *kart)
 
virtual ~CameraFPS ()
 Removes the camera scene node from the scene.
 

Private Attributes

float m_position_speed
 The speed at which the camera changes position. More...
 
float m_target_speed
 The speed at which the camera target changes position. More...
 
float m_rotation_range
 Factor of the effects of steering in camera aim. More...
 
bool m_smooth
 Smooth acceleration with the first person camera. More...
 
bool m_attached
 Attache the first person camera to a kart. More...
 
float m_angular_velocity
 The speed at which the up-vector rotates, only used for the first person camera. More...
 
float m_target_angular_velocity
 Target angular velocity. More...
 
float m_max_velocity
 Maximum velocity for fps camera. More...
 
core::vector3df m_lin_velocity
 Linear velocity of the camera, used for end and first person camera. More...
 
core::vector3df m_target_velocity
 Velocity of the target of the camera, used for end and first person camera. More...
 
core::vector3df m_target_direction
 The target direction for the camera, only used for the first person camera. More...
 
core::vector3df m_direction_velocity
 The speed at which the direction changes, only used for the first person camera. More...
 
core::vector3df m_target_up_vector
 The up vector the camera should have, only used for the first person camera. More...
 
core::vector3df m_local_position
 Save the local position if the first person camera is attached to the kart. More...
 
core::vector3df m_local_direction
 Save the local direction if the first person camera is attached to the kart. More...
 
core::vector3df m_local_up
 Save the local up vector if the first person camera is attached to the kart. More...
 

Friends

class Camera
 

Additional Inherited Members

- Public Types inherited from Camera
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_SIMPLE_REPLAY, CM_FALLING
}
 
- Protected Member Functions inherited from Camera
 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. More...
 
- Static Protected Member Functions inherited from Camera
static CameracreateCamera (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. More...
 
- Protected Attributes inherited from Camera
scene::ICameraSceneNode * m_camera
 The camera scene node. More...
 
AbstractKartm_kart
 The kart that the camera follows. More...
 

Detailed Description

Handles the game camera.

Member Function Documentation

◆ applyMouseMovement()

void CameraFPS::applyMouseMovement ( float  x,
float  y 
)

Applies mouse movement to the first person camera.

Parameters
xThe horizontal difference of the mouse position.
yThe vertical difference of the mouse position.

◆ getAngularVelocity()

float CameraFPS::getAngularVelocity ( )

Returns the current target angular velocity.

◆ getAttachedFpsCam()

bool CameraFPS::getAttachedFpsCam ( )
inline

If the first person camera should be moved with the kart.

◆ getDirection()

const core::vector3df& CameraFPS::getDirection ( )
inline

Gets the vector, the first person camera should look at.

◆ getLinearVelocity()

const core::vector3df & CameraFPS::getLinearVelocity ( )

Returns the current linear velocity.

◆ getMaximumVelocity()

float CameraFPS::getMaximumVelocity ( )
inline

Returns the current angular velocity.

◆ getSmoothMovement()

bool CameraFPS::getSmoothMovement ( )
inline

If the first person camera should be moved smooth.

◆ getUpVector()

const core::vector3df& CameraFPS::getUpVector ( )
inline

Gets the up vector, the first person camera should use.

◆ setAngularVelocity()

void CameraFPS::setAngularVelocity ( float  vel)

Sets the angular velocity for this camera.

◆ setAttachedFpsCam()

void CameraFPS::setAttachedFpsCam ( bool  value)
inline

Sets if the first person camera should be moved with the kart.

◆ setDirection()

void CameraFPS::setDirection ( core::vector3df  target)
inline

Sets the vector, the first person camera should look at.

◆ setLinearVelocity()

void CameraFPS::setLinearVelocity ( core::vector3df  vel)

Sets the linear velocity for this camera.

◆ setMaximumVelocity()

void CameraFPS::setMaximumVelocity ( float  vel)
inline

Sets the angular velocity for this camera.

◆ setSmoothMovement()

void CameraFPS::setSmoothMovement ( bool  value)
inline

Sets if the first person camera should be moved smooth.

◆ setUpVector()

void CameraFPS::setUpVector ( core::vector3df  target)
inline

Sets the up vector, the first person camera should use.

◆ update()

void CameraFPS::update ( float  dt)
virtual

Called once per time frame to move the camera to the right position.

Parameters
dtTime step.

Reimplemented from Camera.

Member Data Documentation

◆ m_angular_velocity

float CameraFPS::m_angular_velocity
private

The speed at which the up-vector rotates, only used for the first person camera.

◆ m_attached

bool CameraFPS::m_attached
private

Attache the first person camera to a kart.

That means moving the kart also moves the camera.

◆ m_direction_velocity

core::vector3df CameraFPS::m_direction_velocity
private

The speed at which the direction changes, only used for the first person camera.

◆ m_lin_velocity

core::vector3df CameraFPS::m_lin_velocity
private

Linear velocity of the camera, used for end and first person camera.

It's stored relative to the camera direction for the first person view.

◆ m_local_direction

core::vector3df CameraFPS::m_local_direction
private

Save the local direction if the first person camera is attached to the kart.

◆ m_local_position

core::vector3df CameraFPS::m_local_position
private

Save the local position if the first person camera is attached to the kart.

◆ m_local_up

core::vector3df CameraFPS::m_local_up
private

Save the local up vector if the first person camera is attached to the kart.

◆ m_max_velocity

float CameraFPS::m_max_velocity
private

Maximum velocity for fps camera.

◆ m_position_speed

float CameraFPS::m_position_speed
private

The speed at which the camera changes position.

◆ m_rotation_range

float CameraFPS::m_rotation_range
private

Factor of the effects of steering in camera aim.

◆ m_smooth

bool CameraFPS::m_smooth
private

Smooth acceleration with the first person camera.

◆ m_target_angular_velocity

float CameraFPS::m_target_angular_velocity
private

Target angular velocity.

Used for smooth movement in fps perpective.

◆ m_target_direction

core::vector3df CameraFPS::m_target_direction
private

The target direction for the camera, only used for the first person camera.

◆ m_target_speed

float CameraFPS::m_target_speed
private

The speed at which the camera target changes position.

◆ m_target_up_vector

core::vector3df CameraFPS::m_target_up_vector
private

The up vector the camera should have, only used for the first person camera.

◆ m_target_velocity

core::vector3df CameraFPS::m_target_velocity
private

Velocity of the target of the camera, used for end and first person camera.


The documentation for this class was generated from the following files: