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

Handles the normal racing camera. More...

#include <camera_normal.hpp>

Inheritance diagram for CameraNormal:
Inheritance graph
[legend]

Public Member Functions

void snapToPosition ()
 
bool isDebug ()
 
bool isFPS ()
 
virtual void update (float dt) OVERRIDE
 Called once per time frame to move the camera to the right position. More...
 
void setAmbientLight (const video::SColor &color)
 Sets the ambient light for this camera. More...
 
float getDistanceToKart () const
 
const video::SColor & getAmbientLight () const
 Returns the current ambient light. 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...
 

Private Member Functions

void moveCamera (float dt, bool smooth)
 Moves the camera smoothly from the current camera position (and target) to the new position and target. More...
 
void handleEndCamera (float dt)
 
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. More...
 
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. More...
 
 CameraNormal (Camera::CameraType type, int camera_index, AbstractKart *kart)
 Constructor for the normal camera. More...
 

Private Attributes

video::SColor m_ambient_light
 Current ambient light for this camera. More...
 
float m_distance
 Distance between the camera and the kart. More...
 
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...
 
Vec3 m_camera_offset
 
btVector3 m_kart_position
 
btQuaternion m_kart_rotation
 

Friends

class Camera
 
class CameraDebug
 
class CameraEnd
 

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
}
 
- 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...
 
- 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 normal racing camera.

Constructor & Destructor Documentation

◆ CameraNormal()

CameraNormal::CameraNormal ( Camera::CameraType  type,
int  camera_index,
AbstractKart kart 
)
private

Constructor for the normal camera.

This is the only camera constructor except for the base class that takes a camera type as parameter. This is because debug and end camera use the normal camera as their base class.

Parameters
typeThe type of the camera that is created (can be CM_TYPE_END or CM_TYPE_DEBUG).
camera_indexIndex of this camera.
KartPointer to the kart for which this camera is used.

Member Function Documentation

◆ getAmbientLight()

const video::SColor& CameraNormal::getAmbientLight ( ) const
inline

Returns the current ambient light.

◆ getCameraSettings()

void CameraNormal::getCameraSettings ( float *  above_kart,
float *  cam_angle,
float *  sideway,
float *  distance,
bool *  smoothing,
float *  cam_roll_angle 
)
private

Determine the camera settings for the current frame.

Parameters
above_kartHow far above the camera should aim at.
cam_angleAngle above the kart plane for the camera.
sidewaySideway movement of the camera.
distanceDistance from kart.
cam_roll_angleRoll camera for gyroscope steering effect.

◆ moveCamera()

void CameraNormal::moveCamera ( float  dt,
bool  smooth 
)
private

Moves the camera smoothly from the current camera position (and target) to the new position and target.

Parameters
dtDelta time,
iffalse, the camera instantly moves to the endpoint, or else it smoothly moves

◆ positionCamera()

void CameraNormal::positionCamera ( float  dt,
float  above_kart,
float  cam_angle,
float  side_way,
float  distance,
float  smoothing,
float  cam_roll_angle 
)
private

Actually sets the camera based on the given parameter.

Parameters
above_kartHow far above the camera should aim at.
cam_angleAngle above the kart plane for the camera.
sidewaySideway movement of the camera.
distanceDistance from kart.
cam_roll_angleRoll camera for gyroscope steering effect.

◆ setAmbientLight()

void CameraNormal::setAmbientLight ( const video::SColor &  color)
inline

Sets the ambient light for this camera.

◆ update()

void CameraNormal::update ( float  dt)
virtual

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

Parameters
dtTime step.

Reimplemented from Camera.

Reimplemented in CameraEnd, and CameraDebug.

Member Data Documentation

◆ m_ambient_light

video::SColor CameraNormal::m_ambient_light
private

Current ambient light for this camera.

◆ m_distance

float CameraNormal::m_distance
private

Distance between the camera and the kart.

◆ m_position_speed

float CameraNormal::m_position_speed
private

The speed at which the camera changes position.

◆ m_rotation_range

float CameraNormal::m_rotation_range
private

Factor of the effects of steering in camera aim.

◆ m_target_speed

float CameraNormal::m_target_speed
private

The speed at which the camera target changes position.


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