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

# ExManagerCam Class Reference

`#include <ExManagerCam.h>`

## Public Methods
| ExManagerCam (void)
| ~ExManagerCam (void)
void | SetManagerPVS (ExManagerPVS *PVS)
void | SetManagerCollision (ExManagerCollision *Collision)
void | SetManagerId (ExManagerId *Id)
ExCCamera * | GetCurrentCam (void)
void | NextCam (void)
void | PrevCam (void)
void | SetCurrentCam (ExNihilo::ExId Id)
void | Draw (int x, int y)
void | Reset (void)
void | Init (void)
bool | Init (std::string FileName)
ExNihilo::ExId | NewObject (void)
ExCCamera * | Get (std::string Name)
ExCCamera * | Get (ExNihilo::ExId Id)
ExNihilo::ExId | Add (ExCCamera Object)
bool | Remove (ExNihilo::ExId Id)
ExNihilo::ExId | GetIdByName (std::string Name)
std::string | GetNameById (ExNihilo::ExId Id)
## Data Fields
bool | m_multiview
std::ostrstream * | Consol
## Private Attributes
ExManagerPVS * | ManagerPVS
ExManagerCollision * | ManagerCollision
ExManagerId * | ManagerId
std::vector< ExCCamera > | m_VecCamera
std::vector< ExCCamera >::iterator | m_ItVecCamera
ExNihilo::ExId | m_CurrentCam
ExNihilo::ExId | m_MultSlot1
ExNihilo::ExId | m_MultSlot2
ExNihilo::ExId | m_MultSlot3
ExNihilo::ExId | m_MultSlot4
int | itcount

## Constructor & Destructor Documentation

ExManagerCam | ( | void |  | ) |

| Definition at line 25 of file ExManagerCam.cpp. References ExManagerCam(), Guard, itcount, m_CurrentCam, and m_multiview. Referenced by ExManagerCam(), and ~ExManagerCam().
    00026 {
    00027 Guard(ExManagerCam::ExManagerCam(void))
    00028         m_CurrentCam=0;
    00029         m_multiview=false;
    00030         itcount=0;
    00031 UnGuard
    00032 }

~ExManagerCam | ( | void |  | ) |

| Definition at line 35 of file ExManagerCam.cpp. References ExManagerCam(), and Guard.
    00036 {
    00037 Guard(ExManagerCam::~ExManagerCam(void))
    00038 UnGuard
    00039 }

## Member Function Documentation

ExNihilo::ExId Add | ( | ExCCamera | Object | ) |

| Definition at line 147 of file ExManagerCam.cpp. References Add(), Guard, and m_CurrentCam. Referenced by Add().
    00148 {
    00149 Guard(ExNihilo::ExId ExManagerCam::Add(ExCCamera Object))
    00150         return m_CurrentCam;
    00151 UnGuard
    00152 }

void Draw | ( | int | x,
|  | int | y
| ) |

| Definition at line 235 of file ExManagerCam.cpp. References ExCCamera::Draw(), Draw(), Get(), GetCurrentCam(), Guard, itcount, m_multiview, m_MultSlot1, m_MultSlot2, m_MultSlot3, and m_MultSlot4. Referenced by Draw().
    00236 {
    00237 Guard(void ExManagerCam::Draw(int x,int y))
    00238         if(!m_multiview)
    00239         {
    00240                 glMatrixMode(GL_PROJECTION);
    00241                 glLoadIdentity();
    00242                 glViewport(0,0,x,y);
    00243                 gluPerspective(GetCurrentCam()->GetZoom(),
    00244                         (1.0f *x/y),
    00245                         GetCurrentCam()->GetClipNear(),
    00246                         GetCurrentCam()->GetClipFar());
    00247                 glMatrixMode(GL_MODELVIEW);
    00248                 glLoadIdentity();
    00249                 GetCurrentCam()->Draw();
    00250         }else
    00251         {
    00252                 int width = glutGet(GLUT_WINDOW_WIDTH);
    00253                 int height = glutGet(GLUT_WINDOW_HEIGHT);
    00254                 width = (width+1)/2;
    00255                 height = (height+1)/2;
    00256                 bool perspective=false;
    00257                 float ratio = (float)width/height;
    00258                 switch(itcount)
    00259                 {
    00260                 case 0:
    00261                         glViewport(0, 0, width, height);
    00262                         glMatrixMode(GL_PROJECTION);
    00263                         glLoadIdentity();
    00264                         gluOrtho2D(0, width, 0, height);
    00265                         glMatrixMode(GL_MODELVIEW);
    00266                         //glLoadIdentity();
    00267                         glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    00268                         glViewport(0, 0, width, height);
    00269                         glScissor(0, 0, width, height);
    00270
    00271                         glMatrixMode(GL_PROJECTION);
    00272                         //glLoadIdentity();
    00273                         if (perspective)
    00274                         gluPerspective(60, ratio, 1, 256);
    00275                         else
    00276                         glOrtho(-ratio, ratio, -ratio, ratio, 1, 256);
    00277                         glMatrixMode(GL_MODELVIEW);
    00278                         glLoadIdentity();
    00279                         Get(m_MultSlot1)->Draw();
    00280             break;
    00281                 case 1:
    00282                         glViewport(width, 0, width, height);
    00283                         glScissor(width, 0, width, height);
    00284
    00285                         glMatrixMode(GL_PROJECTION);
    00286                         //glLoadIdentity();
    00287                         if (perspective)
    00288                         gluPerspective(60, ratio, 1, 256);
    00289                         else
    00290                         glOrtho(-ratio, ratio, -ratio, ratio, 1, 256);
    00291                         glMatrixMode(GL_MODELVIEW);
    00292                         glLoadIdentity();
    00293                         Get(m_MultSlot2)->Draw();
    00294                         break;
    00295                 case 2:
    00296                         glViewport(0, height, width, height);
    00297                         glScissor(0, height, width, height);
    00298
    00299                         glMatrixMode(GL_PROJECTION);
    00300                         //glLoadIdentity();
    00301                         if (perspective)
    00302                         gluPerspective(60, ratio, 1, 256);
    00303                         else
    00304                         glOrtho(-ratio, ratio, -ratio, ratio, 1, 256);
    00305                         glMatrixMode(GL_MODELVIEW);
    00306                         glLoadIdentity();
    00307                         Get(m_MultSlot3)->Draw();
    00308                         break;
    00309                 case 3:
    00310                         glViewport(width, height, width, height);
    00311                         glScissor(width, height, width, height);
    00312
    00313                         glMatrixMode(GL_PROJECTION);
    00314                         //glLoadIdentity();
    00315                         if (perspective)
    00316                         gluPerspective(60, ratio, 1, 256);
    00317                         else
    00318                         glOrtho(-ratio, ratio, -ratio, ratio, 1, 256);
    00319                         glMatrixMode(GL_MODELVIEW);
    00320                         glLoadIdentity();
    00321                         Get(m_MultSlot4)->Draw();
    00322                         break;
    00323                 }
    00324         itcount++;
    00325         }
    00326 UnGuard
    00327 }

ExCCamera * Get | ( | ExNihilo::ExId | Id | ) |

| Definition at line 172 of file ExManagerCam.cpp. References Get(), Guard, m_ItVecCamera, and m_VecCamera.
    00173 {
    00174 Guard(std::vector<ExCCamera>::iterator ExManagerCam::Get(ExNihilo::ExId Id))
    00175         int i=0;
    00176         for(m_ItVecCamera=m_VecCamera.begin();m_ItVecCamera!=m_VecCamera.end();m_ItVecCamera++,i++)
    00177         {
    00178                 if(m_ItVecCamera->GetId()==Id)
    00179                 {
    00180                         return &m_VecCamera.at(i);
    00181                 }
    00182         }
    00183         return NULL;
    00184 UnGuard
    00185 }

ExCCamera * Get | ( | std::string | Name | ) |

| Definition at line 156 of file ExManagerCam.cpp. References Get(), Guard, m_ItVecCamera, and m_VecCamera. Referenced by Draw(), and Get().
    00157 {
    00158 Guard(ExCCamera * ExManagerCam::Get(std::string Name))
    00159         int i=0;
    00160         for(m_ItVecCamera=m_VecCamera.begin();m_ItVecCamera!=m_VecCamera.end();m_ItVecCamera++,i++)
    00161         {
    00162                 if(m_ItVecCamera->GetName()==Name)
    00163                 {
    00164                         return &m_VecCamera.at(i);
    00165                 }
    00166         }
    00167         return NULL;
    00168 UnGuard
    00169 }

ExCCamera * GetCurrentCam | ( | void |  | ) |

| Definition at line 41 of file ExManagerCam.cpp. References GetCurrentCam(), Guard, m_CurrentCam, m_ItVecCamera, and m_VecCamera. Referenced by Draw(), and GetCurrentCam().
    00042 {
    00043 Guard(ExCCamera *  ExManagerCam::GetCurrentCam(void))
    00044         int i=0;
    00045         for(m_ItVecCamera=m_VecCamera.begin();m_ItVecCamera!=m_VecCamera.end();m_ItVecCamera++,i++)
    00046         {
    00047                 if(m_ItVecCamera->GetId()==m_CurrentCam)
    00048                 {
    00049                         return &m_VecCamera.at(i);
    00050                 }
    00051         }
    00052 UnGuard
    00053 return NULL;
    00054 }

ExNihilo::ExId GetIdByName | ( | std::string | Name | ) |

| Definition at line 206 of file ExManagerCam.cpp. References ExNihilo::ExId, GetIdByName(), Guard, m_ItVecCamera, and m_VecCamera. Referenced by GetIdByName().
    00207 {
    00208 Guard(ExId ExManagerCam::GetIdByName(std::string Name))
    00209         for(m_ItVecCamera=m_VecCamera.begin();m_ItVecCamera!=m_VecCamera.end();m_ItVecCamera++)
    00210         {
    00211                 if(m_ItVecCamera->GetName()==Name)
    00212                 {
    00213                         return m_ItVecCamera->GetId();
    00214                 }
    00215         }
    00216         return -1;
    00217 UnGuard
    00218 }

std::string GetNameById | ( | ExNihilo::ExId | Id | ) |

| Definition at line 221 of file ExManagerCam.cpp. References GetNameById(), Guard, m_ItVecCamera, and m_VecCamera. Referenced by GetNameById().
    00222 {
    00223 Guard(std::string ExManagerCam::GetNameById(ExNihilo::ExId Id))
    00224         for(m_ItVecCamera=m_VecCamera.begin();m_ItVecCamera!=m_VecCamera.end();m_ItVecCamera++)
    00225         {
    00226                 if(m_ItVecCamera->GetId()==Id)
    00227                 {
    00228                         return m_ItVecCamera->GetName();
    00229                 }
    00230         }
    00231         return NULL;
    00232 UnGuard
    00233 }

bool Init | ( | std::string | FileName | ) |

| Definition at line 114 of file ExManagerCam.cpp. References Guard, and Init().
    00115 {
    00116 Guard(bool  ExManagerCam::Init(std::string FileName))
    00117         //openf file and load object
    00118         return true;
    00119 UnGuard
    00120 }

void Init | ( | void |  | ) |

| Definition at line 122 of file ExManagerCam.cpp. References Guard, Init(), m_MultSlot1, m_MultSlot2, m_MultSlot3, m_MultSlot4, and NewObject(). Referenced by Init(), and Reset().
    00123 {
    00124 Guard(void  ExManagerCam::Init(void))
    00125         m_MultSlot1=NewObject();
    00126         m_MultSlot2=NewObject();
    00127         m_MultSlot3=NewObject();
    00128         m_MultSlot4=NewObject();
    00129 UnGuard
    00130 }

ExNihilo::ExId NewObject | ( | void |  | ) |

| Definition at line 132 of file ExManagerCam.cpp. References ExCObject::GetId(), Guard, m_CurrentCam, m_VecCamera, ManagerId, NewObject(), ExCObject::SetIdName(), and ExCObject3D::SetPosition(). Referenced by Init(), and NewObject().
    00133 {
    00134 Guard(ExNihilo::ExId  ExManagerCam::NewObject(void))
    00135         char *Name;
    00136         ExCCamera Camera1;
    00137         Name= new char[strlen("CAMERA ")+3];
    00138         sprintf(Name,"CAMERA %d",m_VecCamera.size()+1);
    00139         Camera1.SetIdName(ManagerId->GetNewIdName(Name));
    00140         Camera1.SetPosition(0.0f,2.0f,0.0f);
    00141         m_VecCamera.push_back(Camera1);
    00142         m_CurrentCam=Camera1.GetId();
    00143         return m_CurrentCam;
    00144 UnGuard
    00145 }

void NextCam | ( | void |  | ) |

| Definition at line 56 of file ExManagerCam.cpp. References Guard, m_CurrentCam, m_ItVecCamera, m_VecCamera, and NextCam(). Referenced by NextCam().
    00057 {
    00058 Guard(void  ExManagerCam::NextCam(void))
    00059         int i=0;
    00060         for(m_ItVecCamera=m_VecCamera.begin();m_ItVecCamera!=m_VecCamera.end();m_ItVecCamera++,i++)
    00061         {
    00062                 if(m_ItVecCamera->GetId()==m_CurrentCam)
    00063                 {
    00064                         m_ItVecCamera++;
    00065                         if(m_ItVecCamera==m_VecCamera.end())
    00066                         {
    00067                                 m_ItVecCamera=m_VecCamera.begin();
    00068                         }
    00069                         m_CurrentCam=m_ItVecCamera->GetId();
    00070                 }
    00071         }
    00072 UnGuard
    00073 }

void PrevCam | ( | void |  | ) |

| Definition at line 75 of file ExManagerCam.cpp. References Guard, m_CurrentCam, m_ItVecCamera, m_VecCamera, and PrevCam(). Referenced by PrevCam().
    00076 {
    00077 Guard(void  ExManagerCam::PrevCam(void))
    00078         int i=0;
    00079         for(m_ItVecCamera=m_VecCamera.begin();m_ItVecCamera!=m_VecCamera.end();m_ItVecCamera++,i++)
    00080         {
    00081                 if(m_ItVecCamera->GetId()==m_CurrentCam)
    00082                 {
    00083                         if(m_ItVecCamera==m_VecCamera.begin())
    00084                         {
    00085                                 m_ItVecCamera=m_VecCamera.end()-1;
    00086                         }else
    00087                         {
    00088                                 m_ItVecCamera--;
    00089                         }
    00090                         m_CurrentCam=m_ItVecCamera->GetId();
    00091                 }
    00092         }
    00093 UnGuard
    00094 }

bool Remove | ( | ExNihilo::ExId | Id | ) |

| Definition at line 190 of file ExManagerCam.cpp. References Guard, m_ItVecCamera, m_VecCamera, and Remove(). Referenced by Remove().
    00191 {
    00192 Guard(bool ExManagerCam::Remove(ExNihilo::ExId Id))
    00193         for(m_ItVecCamera=m_VecCamera.begin();m_ItVecCamera!=m_VecCamera.end();m_ItVecCamera++)
    00194         {
    00195                 if(m_ItVecCamera->GetId()==Id)
    00196                 {
    00197                         m_VecCamera.erase(m_ItVecCamera);
    00198                         return true;
    00199                 }
    00200         }
    00201         return false;
    00202 UnGuard
    00203 }

void Reset | ( | void |  | ) |

| Definition at line 105 of file ExManagerCam.cpp. References Guard, Init(), m_VecCamera, and Reset(). Referenced by Reset().
    00106 {
    00107 Guard(void  ExManagerCam::Reset(void))
    00108         m_VecCamera.clear();
    00109         Init();
    00110         //remove all from id
    00111 UnGuard
    00112 }

void SetCurrentCam | ( | ExNihilo::ExId | Id | ) |

| Definition at line 96 of file ExManagerCam.cpp. References Guard, m_CurrentCam, and SetCurrentCam(). Referenced by SetCurrentCam().
    00097 {
    00098 Guard(void  ExManagerCam::SetCurrentCam(ExNihilo::ExId Id))
    00099         //checking if id exist before !!!
    00100         m_CurrentCam=Id;
    00101 UnGuard
    00102 }

void SetManagerCollision | ( | ExManagerCollision * | Collision | ) | `[inline]`

| Definition at line 70 of file ExManagerCam.h.
    00070 {ManagerPVS = PVS;}

void SetManagerId | ( | ExManagerId * | Id | ) | `[inline]`

| Definition at line 71 of file ExManagerCam.h. References ManagerCollision.
    00071 {ManagerCollision = Collision;}

void SetManagerPVS | ( | ExManagerPVS * | PVS | ) | `[inline]`

| Definition at line 69 of file ExManagerCam.h.
    00070 {ManagerPVS = PVS;}

## Field Documentation

std::ostrstream* Consol

| Definition at line 67 of file ExManagerCam.h.

int itcount`[private]`

| Definition at line 56 of file ExManagerCam.h. Referenced by Draw(), and ExManagerCam().

ExNihilo::ExId m_CurrentCam`[private]`

| Definition at line 50 of file ExManagerCam.h. Referenced by Add(), ExManagerCam(), GetCurrentCam(), NewObject(), NextCam(), PrevCam(), and SetCurrentCam().

std::vector<ExCCamera>::iterator m_ItVecCamera`[private]`

| Definition at line 48 of file ExManagerCam.h. Referenced by Get(), GetCurrentCam(), GetIdByName(), GetNameById(), NextCam(), PrevCam(), and Remove().

bool m_multiview

| Definition at line 66 of file ExManagerCam.h. Referenced by Draw(), and ExManagerCam().

ExNihilo::ExId m_MultSlot1`[private]`

| Definition at line 52 of file ExManagerCam.h. Referenced by Draw(), and Init().

ExNihilo::ExId m_MultSlot2`[private]`

| Definition at line 53 of file ExManagerCam.h. Referenced by Draw(), and Init().

ExNihilo::ExId m_MultSlot3`[private]`

| Definition at line 54 of file ExManagerCam.h. Referenced by Draw(), and Init().

ExNihilo::ExId m_MultSlot4`[private]`

| Definition at line 55 of file ExManagerCam.h. Referenced by Draw(), and Init().

std::vector<ExCCamera> m_VecCamera`[private]`

| Definition at line 47 of file ExManagerCam.h. Referenced by Get(), GetCurrentCam(), GetIdByName(), GetNameById(), NewObject(), NextCam(), PrevCam(), Remove(), and Reset().

ExManagerCollision* ManagerCollision`[private]`

| Definition at line 44 of file ExManagerCam.h.

ExManagerId* ManagerId`[private]`

| Definition at line 45 of file ExManagerCam.h. Referenced by NewObject().

ExManagerPVS* ManagerPVS`[private]`

| Definition at line 43 of file ExManagerCam.h.

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

- ExManagerCam.h
- ExManagerCam.cpp