Main Page   Namespace List   Class Hierarchy   Alphabetical List   Data Structures   File List   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)
ExCCameraGetCurrentCam (void)
void NextCam (void)
void PrevCam (void)
void SetCurrentCam (ExId Id)
void Draw (int x, int y)
void Reset (void)
void Init (void)
bool Init (char *FileName)
ExId NewObject (void)
ExCCameraGet (char *Name)
ExCCameraGet (ExId Id)
ExId Add (ExCCamera Object)
bool Remove (ExId Id)
ExId GetIdByName (char *Name)
char * GetNameById (ExId Id)

Data Fields

bool m_multiview
std::ostrstream * Consol
void(* WriteToConsol )(const char *Label)

Private Attributes

ExManagerPVSManagerPVS
ExManagerCollisionManagerCollision
ExManagerIdManagerId
std::vector< ExCCameram_VecCamera
std::vector< ExCCamera
>::iterator 
m_ItVecCamera
ExId m_CurrentCam
ExId m_MultSlot1
ExId m_MultSlot2
ExId m_MultSlot3
ExId m_MultSlot4
int itcount


Constructor & Destructor Documentation

ExManagerCam void   
 

Definition at line 25 of file ExManagerCam.cpp.

References ExManagerCam(), Guard, itcount, m_CurrentCam, m_multiview, and UnGuard.

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(), Guard, and UnGuard.

00036 {
00037 Guard(ExManagerCam::~ExManagerCam(void))
00038 UnGuard
00039 }


Member Function Documentation

ExId Add ExCCamera    Object
 

Definition at line 147 of file ExManagerCam.cpp.

References Add(), ExId, Guard, m_CurrentCam, and UnGuard.

Referenced by Add().

00148 {
00149 Guard(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, m_MultSlot4, and UnGuard.

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

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 ExId    Id
 

Definition at line 172 of file ExManagerCam.cpp.

References ExId, Get(), Guard, m_ItVecCamera, m_VecCamera, and UnGuard.

00173 {
00174 Guard(std::vector<ExCCamera>::iterator ExManagerCam::Get(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 char *    Name
 

Definition at line 156 of file ExManagerCam.cpp.

References Get(), Guard, m_ItVecCamera, m_VecCamera, and UnGuard.

Referenced by Draw(), and Get().

00157 {
00158 Guard(ExCCamera * ExManagerCam::Get(char * Name))
00159         int i=0;
00160         for(m_ItVecCamera=m_VecCamera.begin();m_ItVecCamera!=m_VecCamera.end();m_ItVecCamera++,i++)
00161         {
00162                 if(strcmp(m_ItVecCamera->GetName(),Name)==0)
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, m_VecCamera, and UnGuard.

Referenced by Draw(), GetCurrentCam(), ExManagerCommand::ProcessAction(), and ExManagerOutput::Reshape().

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 }

ExId GetIdByName char *    Name
 

Definition at line 206 of file ExManagerCam.cpp.

References ExId, GetIdByName(), Guard, m_ItVecCamera, m_VecCamera, and UnGuard.

Referenced by GetIdByName().

00207 {
00208 Guard(ExId ExManagerCam::GetIdByName(char *Name))
00209         for(m_ItVecCamera=m_VecCamera.begin();m_ItVecCamera!=m_VecCamera.end();m_ItVecCamera++)
00210         {
00211                 if(strcmp(m_ItVecCamera->GetName(),Name)==0)
00212                 {
00213                         return m_ItVecCamera->GetId();
00214                 }
00215         }
00216         return -1;
00217 UnGuard
00218 }

char * GetNameById ExId    Id
 

Definition at line 221 of file ExManagerCam.cpp.

References ExId, GetNameById(), Guard, m_ItVecCamera, m_VecCamera, and UnGuard.

Referenced by GetNameById().

00222 {
00223 Guard(char * ExManagerCam::GetNameById(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 char *    FileName
 

Definition at line 114 of file ExManagerCam.cpp.

References Guard, Init(), and UnGuard.

00115 {
00116 Guard(bool  ExManagerCam::Init(char * 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, NewObject(), and UnGuard.

Referenced by Init(), InitManager(), 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 }

ExId NewObject void   
 

Definition at line 132 of file ExManagerCam.cpp.

References ExId, ExCObject::GetId(), ExManagerId::GetNewIdName(), Guard, m_CurrentCam, m_VecCamera, ManagerId, NewObject(), ExCObject::SetIdName(), ExCObject::SetPosition(), and UnGuard.

Referenced by Init(), and NewObject().

00133 {
00134 Guard(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, NextCam(), and UnGuard.

Referenced by NextCam(), and ExManagerCommand::ProcessAction().

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, PrevCam(), and UnGuard.

Referenced by PrevCam(), and ExManagerCommand::ProcessAction().

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 ExId    Id
 

Definition at line 190 of file ExManagerCam.cpp.

References ExId, Guard, m_ItVecCamera, m_VecCamera, Remove(), and UnGuard.

Referenced by Remove().

00191 {
00192 Guard(bool ExManagerCam::Remove(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, Reset(), and UnGuard.

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

00106 {
00107 Guard(void  ExManagerCam::Reset(void))
00108         m_VecCamera.clear();
00109         Init();
00110         //remove all from id
00111 UnGuard
00112 }

void SetCurrentCam ExId    Id
 

Definition at line 96 of file ExManagerCam.cpp.

References ExId, Guard, m_CurrentCam, SetCurrentCam(), and UnGuard.

Referenced by SetCurrentCam().

00097 {
00098 Guard(void  ExManagerCam::SetCurrentCam(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.

Referenced by SetManagerLink().

00070 {ManagerCollision = Collision;}

void SetManagerId ExManagerId   Id [inline]
 

Definition at line 71 of file ExManagerCam.h.

Referenced by SetManagerLink().

00071 {ManagerId      = Id;}

void SetManagerPVS ExManagerPVS   PVS [inline]
 

Definition at line 69 of file ExManagerCam.h.

Referenced by SetManagerLink().

00069 {ManagerPVS = PVS;}


Field Documentation

std::ostrstream* Consol
 

Definition at line 66 of file ExManagerCam.h.

Referenced by SetManagerLink().

int itcount [private]
 

Definition at line 55 of file ExManagerCam.h.

Referenced by Draw(), and ExManagerCam().

ExId m_CurrentCam [private]
 

Definition at line 49 of file ExManagerCam.h.

Referenced by Add(), ExManagerCam(), GetCurrentCam(), NewObject(), NextCam(), PrevCam(), and SetCurrentCam().

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

Definition at line 47 of file ExManagerCam.h.

Referenced by Get(), GetCurrentCam(), GetIdByName(), GetNameById(), NextCam(), PrevCam(), and Remove().

bool m_multiview
 

Definition at line 65 of file ExManagerCam.h.

Referenced by Draw(), ExManagerCam(), and ExManagerCommand::ProcessAction().

ExId m_MultSlot1 [private]
 

Definition at line 51 of file ExManagerCam.h.

Referenced by Draw(), and Init().

ExId m_MultSlot2 [private]
 

Definition at line 52 of file ExManagerCam.h.

Referenced by Draw(), and Init().

ExId m_MultSlot3 [private]
 

Definition at line 53 of file ExManagerCam.h.

Referenced by Draw(), and Init().

ExId m_MultSlot4 [private]
 

Definition at line 54 of file ExManagerCam.h.

Referenced by Draw(), and Init().

std::vector<ExCCamera> m_VecCamera [private]
 

Definition at line 46 of file ExManagerCam.h.

Referenced by Get(), GetCurrentCam(), GetIdByName(), GetNameById(), NewObject(), NextCam(), PrevCam(), Remove(), and Reset().

ExManagerCollision* ManagerCollision [private]
 

Definition at line 43 of file ExManagerCam.h.

ExManagerId* ManagerId [private]
 

Definition at line 44 of file ExManagerCam.h.

Referenced by NewObject().

ExManagerPVS* ManagerPVS [private]
 

Definition at line 42 of file ExManagerCam.h.

void(* WriteToConsol)(const char *Label)
 

Referenced by SetManagerLink().


The documentation for this class was generated from the following files:
Generated on Tue Aug 6 20:27:23 2002 for ExNihilo by doxygen1.2.17