Main Page   Namespace List   Class Hierarchy   Alphabetical List   Data Structures   File List   Namespace Members   Data Fields   Globals  

ExManagerCamera Class Reference

#include <ExManagerCamera.h>

Inheritance diagram for ExManagerCamera:

ExManagerObject< ExCCamera * > ExManager

Public Methods

void SetManagerModel (ExManagerModel *Model)
void Reset (void)
void Init (void)
void Draw (void)
bool Add (ExCCamera Camera)
bool Add (ExCCameraFree Camera)
bool Add (ExCCameraChase Camera)
ExCCameraGetCurrentObject (void)
ExCCameraGetObject (ExNihilo::ExId id)
ExCAction InputCommand (ExCCommand Command)
ExCAction InputAction (ExCAction Action)

Static Public Methods

ExManagerCamera * CreateSingleton (void)

Private Methods

 ExManagerCamera (void)
 ~ExManagerCamera (void)

Private Attributes

ExManagerModelManagerModel
std::vector< ExCCameram_VecCamera
std::vector< ExCCameraFreem_VecCameraFree
std::vector< ExCCameraChasem_VecCameraChase

Static Private Attributes

bool m_flag = false
ExManagerCamera * m_instance = NULL

Constructor & Destructor Documentation

ExManagerCamera void    [private]
 

Definition at line 42 of file ExManagerCamera.cpp.

00043 {
00044         
00045 }

~ExManagerCamera void    [private]
 

Definition at line 47 of file ExManagerCamera.cpp.

00048 {
00049 }


Member Function Documentation

bool Add ExCCameraChase    Camera
 

Definition at line 116 of file ExManagerCamera.cpp.

References ExManagerObject::Add(), Add(), Guard, m_VecCameraChase, ManagerModel, and ExCCameraChase::SetManagerModel().

00117 {
00118 Guard(bool ExManagerCamera::Add(ExCCameraChase Camera))
00119         Camera.SetManagerModel(ManagerModel);
00120         m_VecCameraChase.push_back(Camera);
00121         return ExManagerObject<ExCCamera *>::Add(&m_VecCameraChase.at(m_VecCameraChase.size()-1));
00122 UnGuard
00123 }

bool Add ExCCameraFree    Camera
 

Definition at line 108 of file ExManagerCamera.cpp.

References ExManagerObject::Add(), Add(), Guard, and m_VecCameraFree.

00109 {
00110 Guard(bool ExManagerCamera::Add(ExCCameraFree Camera))
00111         m_VecCameraFree.push_back(Camera);
00112         return ExManagerObject<ExCCamera *>::Add(&m_VecCameraFree.at(m_VecCameraFree.size()-1));
00113 UnGuard
00114 }

bool Add ExCCamera    Camera
 

Definition at line 100 of file ExManagerCamera.cpp.

References ExManagerObject::Add(), Add(), Guard, and m_VecCamera.

Referenced by Add(), and Init().

00101 {
00102 Guard(bool ExManagerCamera::Add(ExCCamera Camera))
00103         m_VecCamera.push_back(Camera);
00104         return ExManagerObject<ExCCamera *>::Add(&m_VecCamera.at(m_VecCamera.size()-1));
00105 UnGuard
00106 }

ExManagerCamera * CreateSingleton void    [static]
 

Definition at line 28 of file ExManagerCamera.cpp.

References CreateSingleton(), Guard, m_flag, and m_instance.

Referenced by CreateSingleton(), and main().

00028                                                      {
00029 Guard(ExManagerCamera* ExManagerCamera::CreateSingleton(void))
00030         if(!m_flag)
00031         {
00032                 m_flag = true; // We are creating the error log now, so set flag to true
00033                 m_instance = new ExManagerCamera; // Create the error log
00034         }else
00035         {
00036                 std::cout<<"Error singleton already created"<<std::endl;
00037         }
00038         return m_instance; 
00039 UnGuard
00040 }

void Draw void   
 

Reimplemented from ExManagerObject< ExCCamera * >.

Definition at line 84 of file ExManagerCamera.cpp.

References ExCCamera::Draw(), Draw(), GetCurrentObject(), and Guard.

Referenced by Draw(), and ExManagerOutput::DrawScene().

00085 {
00086 Guard(void ExManagerCamera::Draw(void))
00087         glMatrixMode(GL_PROJECTION);
00088         glLoadIdentity();
00089         glViewport(0,0,glutGet(GLUT_WINDOW_WIDTH),glutGet(GLUT_WINDOW_HEIGHT));
00090         gluPerspective(GetCurrentObject()->GetZoom(),
00091                 (1.0f *glutGet(GLUT_WINDOW_WIDTH)/glutGet(GLUT_WINDOW_HEIGHT)),
00092                 GetCurrentObject()->GetClipNear(),
00093                 GetCurrentObject()->GetClipFar());
00094         glMatrixMode(GL_MODELVIEW);
00095         glLoadIdentity();
00096         GetCurrentObject()->Draw();     
00097 UnGuard
00098 }

ExCCamera * GetCurrentObject void   
 

Reimplemented from ExManagerObject< ExCCamera * >.

Definition at line 125 of file ExManagerCamera.cpp.

References GetCurrentObject(), GetObject(), Guard, and ExManagerObject< ExCCamera * >::m_CurrentObjectId.

Referenced by Draw(), GetCurrentObject(), InputAction(), InputCommand(), and ExManagerOutput::Reshape().

00126 {
00127 Guard(ExCCamera* ExManagerCamera::GetCurrentObject(void))
00128         return GetObject(m_CurrentObjectId);
00129 UnGuard
00130 }

ExCCamera * GetObject ExNihilo::ExId    id
 

Reimplemented from ExManagerObject< ExCCamera * >.

Definition at line 132 of file ExManagerCamera.cpp.

References GetObject(), Guard, m_VecCamera, m_VecCameraChase, and m_VecCameraFree.

Referenced by GetCurrentObject(), and GetObject().

00133 {
00134 Guard(ExCCamera *ExManagerCamera::GetObject(ExNihilo::ExId id))
00135         unsigned int i;
00136         for(i =0;i<m_VecCamera.size();++i)
00137         {
00138                 if(m_VecCamera.at(i).GetId()==id)return &m_VecCamera.at(i);
00139         }
00140         for(i =0;i<m_VecCameraFree.size();++i)
00141         {
00142                 if(m_VecCameraFree.at(i).GetId()==id)return &m_VecCameraFree.at(i);
00143         }
00144         for(i =0;i<m_VecCameraChase.size();++i)
00145         {
00146                 if(m_VecCameraChase.at(i).GetId()==id)return &m_VecCameraChase.at(i);
00147         }
00148         return NULL;
00149 UnGuard
00150 }

void Init void    [virtual]
 

Reimplemented from ExManagerObject< ExCCamera * >.

Definition at line 62 of file ExManagerCamera.cpp.

References Add(), Guard, ExManagerObject::Init(), Init(), ExManagerObject< ExCCamera * >::SetCurrentObject(), and ExCObject::SetName().

Referenced by Init(), InitManager(), and Reset().

00063 {
00064 Guard(void ExManagerCamera::Init(void))
00065         ExManagerObject<ExCCamera *>::Init();
00066 
00067 
00068 
00069         ExCCamera Camera;
00070         Camera.SetName("Camera");
00071         ExManagerCamera::Add(Camera);
00072         ExManagerCamera::Add(Camera);
00073         
00074 
00075 /*
00076         ExCCameraChase CameraChase;
00077         Camera.SetName("CameraChase");
00078         ExManagerCamera::Add(CameraChase);
00079         ExManagerCamera::Add(CameraChase);*/
00080         SetCurrentObject("Camera");
00081 UnGuard
00082 }

ExCAction InputAction ExCAction    Action [virtual]
 

Reimplemented from ExManager.

Definition at line 160 of file ExManagerCamera.cpp.

References CAMERA_CURRENT_DECREASE_ZOOM, CAMERA_CURRENT_INCREASE_ZOOM, CAMERA_CURRENT_START_DECREASE_ZOOM, CAMERA_CURRENT_START_INCREASE_ZOOM, CAMERA_CURRENT_STOP_DECREASE_ZOOM, CAMERA_CURRENT_STOP_INCREASE_ZOOM, CAMERA_SET_ANGLE_X, CAMERA_SET_ANGLE_Y, CAMERA_SET_ANGLE_Z, CAMERA_SET_POS_X, CAMERA_SET_POS_Y, CAMERA_SET_POS_Z, CAMERA_SET_TARGET_POS_X, CAMERA_SET_TARGET_POS_Y, CAMERA_SET_TARGET_POS_Z, ExManager::Consol, GetCurrentObject(), Guard, InputAction(), ExCAction::m_Action, ExCObject3D::m_AngleX, ExCObject3D::m_AngleY, ExCObject3D::m_AngleZ, ExCAction::m_Param, ExCObject3D::m_Position, ExCObject3D::m_speed, ExCObject3D::m_Target, ExManagerObject< ExCCamera * >::NextObject(), ExManagerObject< ExCCamera * >::PreviousObject(), ROTATE_X_DOWN, ROTATE_X_UP, ROTATE_Y_DOWN, ROTATE_Y_UP, ROTATE_Z_DOWN, ROTATE_Z_UP, ExCVec3D::SetX(), ExCVec3D::SetY(), ExCVec3D::SetZ(), ExCCamera::StartAction(), ExCCamera::StopAction(), ZOOM_DOWN, ZOOM_UP, ExCCamera::ZoomIn(), and ExCCamera::ZoomOut().

Referenced by InputAction(), and ExManagerCommand::ProcesExCAction().

00161 {
00162 Guard(ExManagerCamera::InputAction(ExCAction Action))
00163         switch(Action.m_Action)
00164         {
00165         case CAMERA_CURRENT_INCREASE_SPEED:
00166                 GetCurrentObject()->m_speed++;
00167                 break;
00168 
00169         case CAMERA_CURRENT_DECREASE_SPEED:
00170                 GetCurrentObject()->m_speed--;
00171                 break;
00172 
00173         case CAMERA_CURRENT_FULL_STOP:
00174                 GetCurrentObject()->m_speed=0;
00175                 break;
00176 
00177         case CAMERA_CURRENT_START_ROTATEX_UP:
00178                 GetCurrentObject()->StartAction(ROTATE_X_UP     );
00179                 break;
00180         
00181         case CAMERA_CURRENT_STOP_ROTATEX_UP:
00182                 GetCurrentObject()->StopAction(ROTATE_X_UP);
00183                 break;
00184         
00185         case CAMERA_CURRENT_ROTATEX_UP:
00186                 GetCurrentObject()->m_AngleX++;
00187                 GetCurrentObject()->m_AngleX++;
00188                 break;
00189         
00190         case CAMERA_CURRENT_START_ROTATEX_DOWN:
00191                 GetCurrentObject()->StartAction(ROTATE_X_DOWN);
00192                 break;
00193         
00194         case CAMERA_CURRENT_STOP_ROTATEX_DOWN:
00195                 GetCurrentObject()->StopAction(ROTATE_X_DOWN);
00196                 break;
00197         
00198         case CAMERA_CURRENT_ROTATEX_DOWN:
00199                 GetCurrentObject()->m_AngleX--;
00200                 GetCurrentObject()->m_AngleX--;
00201                 break;
00202 
00203         case CAMERA_CURRENT_START_ROTATEZ_UP:
00204                 GetCurrentObject()->StartAction(ROTATE_Z_UP);
00205                 break;
00206         
00207         case CAMERA_CURRENT_STOP_ROTATEZ_UP:
00208                 GetCurrentObject()->StopAction(ROTATE_Z_UP);
00209                 break;
00210         
00211         case CAMERA_CURRENT_ROTATEZ_UP:
00212                 GetCurrentObject()->m_AngleZ++;
00213                 GetCurrentObject()->m_AngleZ++;
00214                 break;
00215         
00216         case CAMERA_CURRENT_START_ROTATEZ_DOWN:
00217                 GetCurrentObject()->StartAction(ROTATE_Z_DOWN);
00218                 break;
00219         
00220         case CAMERA_CURRENT_STOP_ROTATEZ_DOWN:
00221                 GetCurrentObject()->StopAction(ROTATE_Z_DOWN);
00222                 break;
00223         
00224         case CAMERA_CURRENT_ROTATEZ_DOWN:
00225                 GetCurrentObject()->m_AngleZ--;
00226                 GetCurrentObject()->m_AngleZ--;
00227                 break;
00228 
00229         case CAMERA_CURRENT_START_ROTATEY_UP:
00230                 GetCurrentObject()->StartAction(ROTATE_Y_UP);
00231                 break;
00232         
00233         case CAMERA_CURRENT_STOP_ROTATEY_UP:
00234                 GetCurrentObject()->StopAction(ROTATE_Y_UP);
00235                 break;
00236         
00237         case CAMERA_CURRENT_ROTATEY_UP:
00238                 GetCurrentObject()->m_AngleY++;
00239                 GetCurrentObject()->m_AngleY++;
00240                 break;
00241         
00242         case CAMERA_CURRENT_START_ROTATEY_DOWN:
00243                 GetCurrentObject()->StartAction(ROTATE_Y_DOWN);
00244                 break;
00245         
00246         case CAMERA_CURRENT_STOP_ROTATEY_DOWN:
00247                 GetCurrentObject()->StopAction(ROTATE_Y_DOWN);
00248                 break;
00249         
00250         case CAMERA_CURRENT_ROTATEY_DOWN:
00251                 GetCurrentObject()->m_AngleY--;
00252                 GetCurrentObject()->m_AngleY--;
00253                 break;
00254                 
00255         case CAMERA_NEXT_CAM:
00256                 NextObject();
00257                 break;
00258         case CAMERA_PREV_CAM:
00259                 PreviousObject();
00260                 break;
00261 
00262         case CAMERA_CURRENT_INCREASE_ZOOM:
00263                 GetCurrentObject()->ZoomOut();
00264                 break;
00265         case CAMERA_CURRENT_START_INCREASE_ZOOM:
00266                 GetCurrentObject()->StartAction(ZOOM_UP);
00267                 break;
00268         case CAMERA_CURRENT_STOP_INCREASE_ZOOM:
00269                 GetCurrentObject()->StopAction(ZOOM_UP);
00270                 break;
00271 
00272         case CAMERA_CURRENT_DECREASE_ZOOM:
00273                 GetCurrentObject()->ZoomIn();
00274                 break;
00275         case CAMERA_CURRENT_START_DECREASE_ZOOM:
00276                 GetCurrentObject()->StartAction(ZOOM_DOWN);
00277                 break;
00278         case CAMERA_CURRENT_STOP_DECREASE_ZOOM:
00279                 GetCurrentObject()->StopAction(ZOOM_DOWN);
00280                 break;  
00281         case CAMERA_SET_POS_X:
00282                 GetCurrentObject()->m_Position.SetX(atof(Action.m_Param.data()));
00283                 break;
00284         case CAMERA_SET_POS_Y:
00285                 GetCurrentObject()->m_Position.SetY(atof(Action.m_Param.data()));
00286                 break;
00287         case CAMERA_SET_POS_Z:
00288                 GetCurrentObject()->m_Position.SetZ(atof(Action.m_Param.data()));
00289                 break;
00290         case CAMERA_SET_TARGET_POS_X:
00291                 GetCurrentObject()->m_Target.SetX(atof(Action.m_Param.data()));
00292                 break;
00293         case CAMERA_SET_TARGET_POS_Y:
00294                 GetCurrentObject()->m_Target.SetY(atof(Action.m_Param.data()));
00295                 break;
00296         case CAMERA_SET_TARGET_POS_Z:
00297                 GetCurrentObject()->m_Target.SetZ(atof(Action.m_Param.data()));
00298                 break;
00299         case CAMERA_SET_ANGLE_X:
00300                 GetCurrentObject()->m_AngleX=atof(Action.m_Param.data());
00301                 break;
00302         case CAMERA_SET_ANGLE_Y:
00303                 GetCurrentObject()->m_AngleY=atof(Action.m_Param.data());
00304                 break;
00305         case CAMERA_SET_ANGLE_Z:
00306                 GetCurrentObject()->m_AngleZ=atof(Action.m_Param.data());
00307                 break;
00308         default:
00309                 *Consol<<"Can not file action in CAMERA_ACTION_MAP"<<std::endl;
00310                 break;
00311         }
00312         return  NOTHING;
00313 UnGuard
00314 }

ExCAction InputCommand ExCCommand    Command [virtual]
 

Reimplemented from ExManager.

Definition at line 152 of file ExManagerCamera.cpp.

References GetCurrentObject(), Guard, and InputCommand().

Referenced by InputCommand().

00153 {
00154 Guard(ExManagerCamera::InputCommand(ExCCommand Command))
00155         if(GetCurrentObject()==NULL)return NOTHING;
00156         return  NOTHING;
00157 UnGuard
00158 }

void Reset void    [virtual]
 

Reimplemented from ExManagerObject< ExCCamera * >.

Definition at line 51 of file ExManagerCamera.cpp.

References Guard, Init(), m_VecCamera, m_VecCameraChase, m_VecCameraFree, ExManagerObject::Reset(), and Reset().

Referenced by ExManagerCommand::ProcesExCAction(), and Reset().

00052 {
00053 Guard(void ExManagerCamera::Reset(void))
00054         ExManagerObject<ExCCamera *>::Reset();
00055         m_VecCamera.clear();
00056         m_VecCameraFree.clear();
00057         m_VecCameraChase.clear();
00058         Init();
00059 UnGuard
00060 }

void SetManagerModel ExManagerModel   Model [inline]
 

Definition at line 94 of file ExManagerCamera.h.

Referenced by SetManagerLink().

00095 {ManagerModel = Model;}


Field Documentation

bool m_flag = false [static, private]
 

Definition at line 25 of file ExManagerCamera.cpp.

Referenced by CreateSingleton().

ExManagerCamera * m_instance = NULL [static, private]
 

Definition at line 26 of file ExManagerCamera.cpp.

Referenced by CreateSingleton().

std::vector<ExCCamera> m_VecCamera [private]
 

Definition at line 75 of file ExManagerCamera.h.

Referenced by Add(), GetObject(), and Reset().

std::vector<ExCCameraChase> m_VecCameraChase [private]
 

Definition at line 77 of file ExManagerCamera.h.

Referenced by Add(), GetObject(), and Reset().

std::vector<ExCCameraFree> m_VecCameraFree [private]
 

Definition at line 76 of file ExManagerCamera.h.

Referenced by Add(), GetObject(), and Reset().

ExManagerModel* ManagerModel [private]
 

Definition at line 74 of file ExManagerCamera.h.

Referenced by Add().


The documentation for this class was generated from the following files:
Generated on Tue Dec 10 18:20:34 2002 for ExNihilo by doxygen1.3-rc1