K3dCamera Class Reference

#include <K3dCamera.h>

Inheritance diagram for K3dCamera:

K3dCameraObj List of all members.

Public Member Functions

 K3dCamera (K3dGameData *_pGameData)
 ~K3dCamera ()
 Get or set camera view (descent, first person or spectate).
ECameraViewGetCameraView ()
 Get or set camera speed.
float & GetCameraSpeed ()
K3dVector3ObjGetCameraPos ()
 Get or set camera position.
K3dVector3ObjGetCameraRot ()
 Get or set camera rotation.
bool & GetIsMouseMove ()
 Get or set mouse.
K3dVector3ObjGetPosition ()
 Set or get position.
const K3dVector3ObjGetPosition () const
K3dVector3ObjGetForward ()
 Set or get forward vector.
const K3dVector3ObjGetForward () const
K3dVector3ObjGetView ()
const K3dVector3ObjGetView () const
K3dMatrixGetMatrix ()
 Set or get matrix.
const K3dMatrixGetMatrix () const
K3dMatrixGetRotMatrix ()
 Set or get rotation matrix.
const K3dMatrixGetRotMatrix () const
K3dMatrixGetPrevMatrix ()
 Set or get previous matrix.
const K3dMatrixGetPrevMatrix () const
K3dVector3ObjGetUp ()
 Set or Get Up vector.
const K3dVector3ObjGetUp () const
K3dVector3ObjGetRight ()
 Set or Get right vector.
const K3dVector3ObjGetRight () const
void UpdateCamera ()
 Update camera, pripare camera data for camera moving.
void Look ()
 Look at the scene by camera.
void GoForward ()
 Go forward by camera.
void GoBackward ()
 Go backward by camera.
void GoUp ()
 Go up by camera.
void GoDown ()
 Go down by camera.
void StrafeLeft ()
 Strafe left by camera.
void StrafeRight ()
 Strafe right by camera.
void TurnLeft ()
 Turn left by camera.
void TurnRight ()
 Turn right by camera.
void TurnUp ()
 Rotate up by camera.
void TurnDown ()
 Rotate down by camera.
void LurchLeft ()
 Camera rotate left by Z axis.
void LurchRight ()
 Camera rotate right by Z axis.
void MouseRotate ()
 Camera rotation by mouse move.
void RestrictCamView ()
 Restrict camera view. Up and down view is max 90 degree.
void ChangeMatrix ()
 Change camera matrix.

Private Member Functions

void Move (const float _fSpeed)
 Move camera by speed.
void Init ()
 Init camera.
void SetStrafeDirection ()
 Set move direction for strafe.

Private Attributes

K3dGameDatam_pGameData
 Global game data, data centered game system.
K3dVector3Workm_pVector3Work
 Pointer to vector3 worker.
K3dVector3Obj m_kPosition
 Camera position.
K3dVector3Obj m_kForward
 Forward direction vector.
K3dVector3Obj m_kUp
 Up direction vector.
K3dVector3Obj m_kRight
 Right direction vector.
K3dVector3Obj m_kView
 View direction vector.
K3dMatrix m_kMatrix
 Actual camera matrix.
K3dMatrix m_kPrevMatrix
 Matrix in previous frame.
K3dMatrix m_kRotMatrix
 Actual rotation matrix.
bool m_bIsMouseMove
 Mouse move switch.
ECameraView m_eCamView
 Camera view as descent, first person or spectate.
K3dVector3Obj m_kAngle
 Rotation angle.
float m_fSpeed
 Camera speed.
float m_fSpeedAccel
 Camera speed acceleration.

Detailed Description

Definition at line 51 of file K3dCamera.h.


Constructor & Destructor Documentation

K3dCamera::K3dCamera ( K3dGameData _pGameData  ) 

Definition at line 35 of file K3dCamera.cpp.

References K3dSceneData::GetVector3Work(), Init(), m_pGameData, and m_pVector3Work.

K3dCamera::~K3dCamera (  ) 

Get or set camera view (descent, first person or spectate).

Definition at line 42 of file K3dCamera.cpp.


Member Function Documentation

void K3dCamera::Move ( const float  _fSpeed  )  [private]

Move camera by speed.

Parameters:
_fSpeed Camera speed

Definition at line 216 of file K3dCamera.cpp.

References K3dVector3Work::AddScalar(), K3dVector3::GetScalar(), K_CAM_FIRST_PERSON, K_CAM_SPECTATE, m_eCamView, m_kForward, m_kPosition, m_pVector3Work, and K3dVector3Work::SubtractScalar().

Referenced by StrafeLeft(), and StrafeRight().

void K3dCamera::Init (  )  [private]

Init camera.

Definition at line 48 of file K3dCamera.cpp.

References K3dOptionsData::GetGraphicOption(), TGraphicOption::iHeight, TGraphicOption::iWidth, m_bIsMouseMove, m_fSpeed, m_fSpeedAccel, m_kUp, m_kView, m_pGameData, and K3dVector3::Set().

Referenced by K3dCamera().

void K3dCamera::SetStrafeDirection (  )  [private]

Set move direction for strafe.

Definition at line 368 of file K3dCamera.cpp.

References K3dMatrix::ChangeVectorXGL(), K3dMatrix::ChangeVectorZGL(), m_kAngle, m_kForward, K3dMatrix::MultiplyTranspose(), K3dMatrix::RotationXGL(), K3dMatrix::RotationYGL(), K3dVector3::Set(), K3dVector3::SetX(), K3dVector3::SetY(), and K3dVector3::SetZ().

Referenced by StrafeLeft(), and StrafeRight().

ECameraView& K3dCamera::GetCameraView (  )  [inline]

Get or set camera speed.

Definition at line 79 of file K3dCamera.h.

References m_eCamView.

float& K3dCamera::GetCameraSpeed (  )  [inline]

Definition at line 85 of file K3dCamera.h.

References m_fSpeedAccel.

K3dVector3Obj& K3dCamera::GetCameraPos (  )  [inline]

Get or set camera position.

Definition at line 91 of file K3dCamera.h.

References m_kPosition.

Referenced by K3dAim::CalcAimRay(), K3dFontBmp::DrawCameraPosition(), K3dVM::GetCamPos(), and K3dObjectWork::GetDistance().

K3dVector3Obj& K3dCamera::GetCameraRot (  )  [inline]

Get or set camera rotation.

Definition at line 97 of file K3dCamera.h.

References m_kAngle.

bool& K3dCamera::GetIsMouseMove (  )  [inline]

Get or set mouse.

Definition at line 103 of file K3dCamera.h.

References m_bIsMouseMove.

K3dVector3Obj & K3dCamera::GetPosition (  ) 

Set or get position.

Definition at line 144 of file K3dCamera.cpp.

References m_kPosition.

Referenced by K3dSphereWork::MoveByMouse().

const K3dVector3Obj & K3dCamera::GetPosition (  )  const

Definition at line 148 of file K3dCamera.cpp.

References m_kPosition.

K3dVector3Obj & K3dCamera::GetForward (  ) 

Set or get forward vector.

Definition at line 154 of file K3dCamera.cpp.

References m_kForward.

const K3dVector3Obj & K3dCamera::GetForward (  )  const

Definition at line 159 of file K3dCamera.cpp.

References m_kForward.

K3dVector3Obj& K3dCamera::GetView (  )  [inline]

Definition at line 112 of file K3dCamera.h.

References m_kView.

Referenced by K3dAim::CalcAimRay(), and K3dVM::GetCamDir().

const K3dVector3Obj& K3dCamera::GetView (  )  const [inline]

Definition at line 116 of file K3dCamera.h.

References m_kView.

K3dMatrix & K3dCamera::GetMatrix (  ) 

Set or get matrix.

Definition at line 195 of file K3dCamera.cpp.

References m_kMatrix.

const K3dMatrix & K3dCamera::GetMatrix (  )  const

Definition at line 199 of file K3dCamera.cpp.

References m_kMatrix.

K3dMatrix & K3dCamera::GetRotMatrix (  ) 

Set or get rotation matrix.

Definition at line 185 of file K3dCamera.cpp.

References m_kRotMatrix.

const K3dMatrix & K3dCamera::GetRotMatrix (  )  const

Definition at line 189 of file K3dCamera.cpp.

References m_kRotMatrix.

K3dMatrix & K3dCamera::GetPrevMatrix (  ) 

Set or get previous matrix.

Definition at line 205 of file K3dCamera.cpp.

References m_kPrevMatrix.

const K3dMatrix & K3dCamera::GetPrevMatrix (  )  const

Definition at line 209 of file K3dCamera.cpp.

References m_kPrevMatrix.

K3dVector3Obj & K3dCamera::GetUp (  ) 

Set or Get Up vector.

Definition at line 165 of file K3dCamera.cpp.

References m_kUp.

Referenced by K3dAim::CalcAimRay().

const K3dVector3Obj & K3dCamera::GetUp (  )  const

Definition at line 169 of file K3dCamera.cpp.

References m_kUp.

K3dVector3Obj & K3dCamera::GetRight (  ) 

Set or Get right vector.

Definition at line 175 of file K3dCamera.cpp.

References m_kRight.

Referenced by K3dAim::CalcAimRay().

const K3dVector3Obj & K3dCamera::GetRight (  )  const

Definition at line 179 of file K3dCamera.cpp.

References m_kRight.

void K3dCamera::UpdateCamera (  ) 

Update camera, pripare camera data for camera moving.

Definition at line 75 of file K3dCamera.cpp.

References ChangeMatrix(), K3dSceneData::GetKeyMap(), K3dSceneData::GetTimer(), GoBackward(), GoDown(), GoForward(), GoUp(), K3dKeyMap::IsKeyPressed(), K_GO_BACKWARD, K_GO_DOWN, K_GO_FORWARD, K_GO_UP, K_LURCH_LEFT, K_LURCH_RIGHT, K_STRAFE_LEFT, K_STRAFE_RIGHT, K_TURN_DOWN, K_TURN_LEFT, K_TURN_RIGHT, K_TURN_UP, LurchLeft(), LurchRight(), m_bIsMouseMove, m_fSpeed, m_fSpeedAccel, m_pGameData, MouseRotate(), StrafeLeft(), StrafeRight(), K3dTimer::SynchronizeSpeed(), TurnDown(), TurnLeft(), TurnRight(), and TurnUp().

Referenced by K3dMngGeometry::UpdateMngGeometry().

void K3dCamera::Look (  ) 

Look at the scene by camera.

Definition at line 512 of file K3dCamera.cpp.

References K3dMatrix::GetMatrix(), and m_kMatrix.

Referenced by K3dMngGeometry::DrawMngGeometry().

void K3dCamera::GoForward (  ) 

Go forward by camera.

Definition at line 285 of file K3dCamera.cpp.

References K3dVector3Work::AddScalar(), K3dVector3::GetScalar(), K_CAM_DESCENT, K_CAM_FIRST_PERSON, K_CAM_SPECTATE, m_eCamView, m_fSpeed, m_kForward, m_kPosition, m_pVector3Work, and K3dVector3Work::SubtractScalar().

Referenced by UpdateCamera().

void K3dCamera::GoBackward (  ) 

Go backward by camera.

Definition at line 312 of file K3dCamera.cpp.

References K3dVector3Work::AddScalar(), K3dVector3::GetScalar(), K_CAM_DESCENT, K_CAM_FIRST_PERSON, K_CAM_SPECTATE, m_eCamView, m_fSpeed, m_kForward, m_kPosition, m_pVector3Work, and K3dVector3Work::SubtractScalar().

Referenced by UpdateCamera().

void K3dCamera::GoUp (  ) 

Go up by camera.

Definition at line 339 of file K3dCamera.cpp.

References K3dVector3Work::AddScalar(), K_CAM_DESCENT, m_eCamView, m_fSpeed, m_kPosition, m_kUp, and m_pVector3Work.

Referenced by UpdateCamera().

void K3dCamera::GoDown (  ) 

Go down by camera.

Definition at line 354 of file K3dCamera.cpp.

References K_CAM_DESCENT, m_eCamView, m_fSpeed, m_kPosition, m_kUp, m_pVector3Work, and K3dVector3Work::SubtractScalar().

Referenced by UpdateCamera().

void K3dCamera::StrafeLeft (  ) 

Strafe left by camera.

Definition at line 413 of file K3dCamera.cpp.

References K_CAM_DESCENT, m_eCamView, m_fSpeed, m_kPosition, m_kRight, Move(), and SetStrafeDirection().

Referenced by UpdateCamera().

void K3dCamera::StrafeRight (  ) 

Strafe right by camera.

Definition at line 430 of file K3dCamera.cpp.

References K_CAM_DESCENT, m_eCamView, m_fSpeed, m_kPosition, m_kRight, Move(), and SetStrafeDirection().

Referenced by UpdateCamera().

void K3dCamera::TurnLeft (  ) 

Turn left by camera.

Definition at line 447 of file K3dCamera.cpp.

References m_fSpeed, m_kAngle, m_pVector3Work, and K3dVector3Work::SubtractScalar().

Referenced by UpdateCamera().

void K3dCamera::TurnRight (  ) 

Turn right by camera.

Definition at line 453 of file K3dCamera.cpp.

References K3dVector3Work::AddScalar(), m_fSpeed, m_kAngle, and m_pVector3Work.

Referenced by UpdateCamera().

void K3dCamera::TurnUp (  ) 

Rotate up by camera.

Definition at line 460 of file K3dCamera.cpp.

References K3dVector3Work::AddScalar(), K_CAM_DESCENT, m_eCamView, m_fSpeed, m_kAngle, m_pVector3Work, and RestrictCamView().

Referenced by UpdateCamera().

void K3dCamera::TurnDown (  ) 

Rotate down by camera.

Definition at line 476 of file K3dCamera.cpp.

References K_CAM_DESCENT, m_eCamView, m_fSpeed, m_kAngle, m_pVector3Work, RestrictCamView(), and K3dVector3Work::SubtractScalar().

Referenced by UpdateCamera().

void K3dCamera::LurchLeft (  ) 

Camera rotate left by Z axis.

Definition at line 492 of file K3dCamera.cpp.

References K_CAM_DESCENT, m_eCamView, m_fSpeed, m_kAngle, m_pVector3Work, and K3dVector3Work::SubtractScalar().

Referenced by UpdateCamera().

void K3dCamera::LurchRight (  ) 

Camera rotate right by Z axis.

Definition at line 502 of file K3dCamera.cpp.

References K3dVector3Work::AddScalar(), K_CAM_DESCENT, m_eCamView, m_fSpeed, m_kAngle, and m_pVector3Work.

Referenced by UpdateCamera().

void K3dCamera::MouseRotate (  ) 

Camera rotation by mouse move.

Definition at line 250 of file K3dCamera.cpp.

References K3dVector3Work::AddScalar(), K3dOptionsData::GetGraphicOption(), K3dSceneData::GetMouse(), TGraphicOption::iHeight, TGraphicOption::iWidth, K_CAM_FIRST_PERSON, K_CAM_SPECTATE, m_eCamView, m_kAngle, m_pGameData, m_pVector3Work, K3dMouse::MousePosition(), and RestrictCamView().

Referenced by UpdateCamera().

void K3dCamera::RestrictCamView (  ) 

Restrict camera view. Up and down view is max 90 degree.

Definition at line 236 of file K3dCamera.cpp.

References K3dMath::K_FI, and m_kAngle.

Referenced by MouseRotate(), TurnDown(), and TurnUp().

void K3dCamera::ChangeMatrix (  ) 

Change camera matrix.

Definition at line 519 of file K3dCamera.cpp.

References K3dMatrix::ChangeVector(), K3dMatrix::ChangeVectorGL(), K3dMatrix::ChangeVectorXGL(), K3dMatrix::ChangeVectorYGL(), K3dMatrix::ChangeVectorZGL(), K3dQuaternion::FromAxisAngle(), K3dMatrix::Inverse(), K3dMatrix::InverseTranslation(), K_CAM_DESCENT, K_CAM_FIRST_PERSON, K_CAM_SPECTATE, m_eCamView, m_kAngle, m_kForward, m_kMatrix, m_kPosition, m_kPrevMatrix, m_kRight, m_kRotMatrix, m_kUp, m_kView, K3dMatrix::Multiply(), K3dMatrix::MultiplyTranspose(), K3dVector3::Reset(), K3dMatrix::RotationXGL(), K3dMatrix::RotationYGL(), K3dVector3::Set(), K3dVector3::SetX(), K3dVector3::SetY(), K3dVector3::SetZ(), and K3dQuaternion::ToRotationMatrix().

Referenced by UpdateCamera().


Member Data Documentation

K3dGameData* K3dCamera::m_pGameData [private]

Global game data, data centered game system.

Definition at line 53 of file K3dCamera.h.

Referenced by Init(), K3dCamera(), MouseRotate(), and UpdateCamera().

K3dVector3Work* K3dCamera::m_pVector3Work [private]

Pointer to vector3 worker.

Definition at line 54 of file K3dCamera.h.

Referenced by GoBackward(), GoDown(), GoForward(), GoUp(), K3dCamera(), LurchLeft(), LurchRight(), MouseRotate(), Move(), TurnDown(), TurnLeft(), TurnRight(), and TurnUp().

K3dVector3Obj K3dCamera::m_kPosition [private]

Camera position.

Definition at line 55 of file K3dCamera.h.

Referenced by ChangeMatrix(), GetCameraPos(), GetPosition(), GoBackward(), GoDown(), GoForward(), GoUp(), Move(), StrafeLeft(), and StrafeRight().

K3dVector3Obj K3dCamera::m_kForward [private]

Forward direction vector.

Definition at line 56 of file K3dCamera.h.

Referenced by ChangeMatrix(), GetForward(), GoBackward(), GoForward(), Move(), and SetStrafeDirection().

K3dVector3Obj K3dCamera::m_kUp [private]

Up direction vector.

Definition at line 57 of file K3dCamera.h.

Referenced by ChangeMatrix(), GetUp(), GoDown(), GoUp(), and Init().

K3dVector3Obj K3dCamera::m_kRight [private]

Right direction vector.

Definition at line 58 of file K3dCamera.h.

Referenced by ChangeMatrix(), GetRight(), StrafeLeft(), and StrafeRight().

K3dVector3Obj K3dCamera::m_kView [private]

View direction vector.

Definition at line 59 of file K3dCamera.h.

Referenced by ChangeMatrix(), GetView(), and Init().

K3dMatrix K3dCamera::m_kMatrix [private]

Actual camera matrix.

Definition at line 60 of file K3dCamera.h.

Referenced by ChangeMatrix(), GetMatrix(), and Look().

K3dMatrix K3dCamera::m_kPrevMatrix [private]

Matrix in previous frame.

Definition at line 61 of file K3dCamera.h.

Referenced by ChangeMatrix(), and GetPrevMatrix().

K3dMatrix K3dCamera::m_kRotMatrix [private]

Actual rotation matrix.

Definition at line 62 of file K3dCamera.h.

Referenced by ChangeMatrix(), and GetRotMatrix().

bool K3dCamera::m_bIsMouseMove [private]

Mouse move switch.

Definition at line 63 of file K3dCamera.h.

Referenced by GetIsMouseMove(), Init(), and UpdateCamera().

ECameraView K3dCamera::m_eCamView [private]

Camera view as descent, first person or spectate.

Definition at line 64 of file K3dCamera.h.

Referenced by ChangeMatrix(), GetCameraView(), GoBackward(), GoDown(), GoForward(), GoUp(), LurchLeft(), LurchRight(), MouseRotate(), Move(), StrafeLeft(), StrafeRight(), TurnDown(), and TurnUp().

K3dVector3Obj K3dCamera::m_kAngle [private]

Rotation angle.

Definition at line 65 of file K3dCamera.h.

Referenced by ChangeMatrix(), GetCameraRot(), LurchLeft(), LurchRight(), MouseRotate(), RestrictCamView(), SetStrafeDirection(), TurnDown(), TurnLeft(), TurnRight(), and TurnUp().

float K3dCamera::m_fSpeed [private]

Camera speed.

Definition at line 66 of file K3dCamera.h.

Referenced by GoBackward(), GoDown(), GoForward(), GoUp(), Init(), LurchLeft(), LurchRight(), StrafeLeft(), StrafeRight(), TurnDown(), TurnLeft(), TurnRight(), TurnUp(), and UpdateCamera().

float K3dCamera::m_fSpeedAccel [private]

Camera speed acceleration.

Definition at line 67 of file K3dCamera.h.

Referenced by GetCameraSpeed(), Init(), and UpdateCamera().


The documentation for this class was generated from the following files:
Generated on Thu Aug 16 23:53:31 2007 for K3dEngine by  doxygen 1.5.0