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

ExCCamera Class Reference

#include <ExCCamera.h>

Inheritance diagram for ExCCamera:

ExCObject3D ExCObject ExCCameraChase ExCCameraFirst ExCCameraFree ExCCameraTarget

Public Methods

 ExCCamera (void)
 ~ExCCamera (void)
virtual void Draw (void)
void ZoomIn (void)
void ZoomOut (void)
void ResetZoom (void)
void ZoomIn (float zoom)
void ZoomOut (float zoom)
void SetZoom (float zoom)
void SetZoomMax (float zoom)
void SetZoomMin (float zoom)
void SetZoomDefault (float zoom)
float GetZoomMax (void)
float GetZoomMin (void)
float GetZoom (void)
float GetZoomDefault (void)
void SetClipFar (float clip)
void SetClipNear (float clip)
float GetClipFar (void)
float GetClipNear (void)
void StartAction (int Action)
void StopAction (int Action)
void Process (void)

Data Fields

int m_CurrentAction
std::vector< int > m_VecAction
std::vector< int >::iterator m_ItVecAction

Protected Attributes

bool m_Actif
float m_Zoom
float m_ClipFar
float m_ClipNear
float m_ZoomDefault
float m_ZoomMax
float m_ZoomMin

Constructor & Destructor Documentation

ExCCamera void   
 

Definition at line 27 of file ExCCamera.cpp.

References ExCCamera(), Guard, ExCObject3D::m_AngleX, ExCObject3D::m_AngleY, ExCObject3D::m_AngleZ, m_ClipFar, m_ClipNear, ExCObject3D::m_speed, m_Zoom, m_ZoomDefault, m_ZoomMax, m_ZoomMin, ExCObject::SetName(), and ExCObject::SetType().

Referenced by ExCCamera(), and ~ExCCamera().

00028 {
00029 Guard(ExCCamera::ExCCamera(void))
00030         m_AngleX=0;
00031         m_AngleY=0;
00032         m_AngleZ=0;
00033         m_speed=0;
00034         m_ZoomDefault=40;
00035         m_Zoom=m_ZoomDefault;
00036         m_ZoomMin=1;
00037         m_ZoomMax=100;
00038         m_ClipFar=100000000;
00039         m_ClipNear=1;
00040         SetName("ExCCamera");
00041         SetType(typeid(this).name());
00042 UnGuard
00043 }

~ExCCamera void   
 

Definition at line 45 of file ExCCamera.cpp.

References ExCCamera(), and Guard.

00046 {
00047 Guard(ExCCamera::~ExCCamera(void))
00048 UnGuard
00049 }


Member Function Documentation

void Draw void    [virtual]
 

Reimplemented from ExCObject.

Reimplemented in ExCCameraChase, and ExCCameraTarget.

Definition at line 51 of file ExCCamera.cpp.

References DegreesToRadians(), Draw(), ExCVec3D::GetX(), ExCVec3D::GetY(), ExCVec3D::GetZ(), Guard, ExCObject3D::m_AngleX, ExCObject3D::m_AngleY, ExCObject3D::m_AngleZ, ExCObject3D::m_Position, ExCObject3D::m_speed, ExCObject3D::m_Target, ExCObject3D::m_Up, Process(), ExCVec3D::SetX(), ExCVec3D::SetY(), and ExCVec3D::SetZ().

Referenced by ExManagerCamera::Draw(), ExManagerCam::Draw(), Draw(), and ExManagerOutput::Reshape().

00052 {
00053 Guard(ExCCamera::Draw(void))
00054 //cout<<"Draw "<<m_ObjectName<<" ID:"<<m_ObjectId<<endl;
00055         Process();
00056 
00057         if(m_AngleX<0)m_AngleX=359;
00058         if(m_AngleX>359)m_AngleX=0;
00059         if(m_AngleY<0)m_AngleY=359;
00060         if(m_AngleY>359)m_AngleY=0;
00061         if(m_AngleZ<0)m_AngleZ=359;
00062         if(m_AngleZ>359)m_AngleZ=0;
00063 
00064         float cosY,cosP,cosR;
00065         float sinY,sinP,sinR;
00066 
00067         cosY=cosf(DegreesToRadians(m_AngleY));
00068         cosP=cosf(DegreesToRadians(m_AngleX));
00069         cosR=cosf(DegreesToRadians(m_AngleZ));
00070 
00071         sinY=sinf(DegreesToRadians(m_AngleY));
00072         sinP=sinf(DegreesToRadians(m_AngleX));
00073         sinR=sinf(DegreesToRadians(m_AngleZ));  
00074 
00075         ExCVec3D fwd,side;
00076 
00077         fwd.SetX(sinY*cosP);
00078         fwd.SetY(sinP);
00079         fwd.SetZ(cosP*-cosY);
00080 
00081         m_Target=fwd+m_Position;
00082         
00083 
00084         m_Up.SetX((-cosY*sinR)-(sinY*sinP*cosR));
00085         m_Up.SetY(cosP*cosR);
00086         m_Up.SetZ((-sinY*sinR)-(sinP*cosR*-cosY));
00087 
00088    /*   char buff[255];
00089         memset(buff,0,255);
00090         sprintf(buff,"Camera position X:%f Y:%f Z:%f",m_Position.GetX(),m_Position.GetY(),m_Position.GetZ());
00091         ExNihilo::WriteToScreen(30,540,buff);
00092         memset(buff,0,255);
00093         sprintf(buff,"Camera fwd X:%f Y:%f Z:%f",fwd.GetX(),fwd.GetY(),fwd.GetZ());
00094         ExNihilo::WriteToScreen(30,560,buff);
00095         memset(buff,0,255);
00096         sprintf(buff,"Camera target X:%f Y:%f Z:%f",m_Target.GetX(),m_Target.GetY(),m_Target.GetZ());
00097         ExNihilo::WriteToScreen(30,580,buff);
00098         memset(buff,0,255);
00099         sprintf(buff,"Camera angle X:%f Y:%f Z:%f",m_AngleX,m_AngleY,m_AngleZ);
00100         ExNihilo::WriteToScreen(30,600,buff);
00101  */
00102         gluLookAt(m_Position.GetX(),m_Position.GetY(),m_Position.GetZ()
00103                         ,m_Target.GetX(),m_Target.GetY(),m_Target.GetZ()
00104                         ,m_Up.GetX(),m_Up.GetY(),m_Up.GetZ());
00105         
00106         m_Position=m_Position+((m_Target-m_Position)*m_speed);
00107 
00108 UnGuard
00109 }

float GetClipFar void    [inline]
 

Definition at line 77 of file ExCCamera.h.

Referenced by ExManagerOutput::Reshape().

00078 {return m_ClipFar;}

float GetClipNear void    [inline]
 

Definition at line 78 of file ExCCamera.h.

References m_ClipFar.

Referenced by ExManagerOutput::Reshape().

00078 {return m_ClipFar;}

float GetZoom void    [inline]
 

Definition at line 72 of file ExCCamera.h.

References m_ZoomMin.

Referenced by ExManagerOutput::Reshape().

00072 {return m_ZoomMin;}

float GetZoomDefault void    [inline]
 

Definition at line 73 of file ExCCamera.h.

References m_Zoom.

00073 {return m_Zoom;}

float GetZoomMax void    [inline]
 

Definition at line 70 of file ExCCamera.h.

00071 {return m_ZoomMax;}

float GetZoomMin void    [inline]
 

Definition at line 71 of file ExCCamera.h.

References m_ZoomMax.

00071 {return m_ZoomMax;}

void Process void   
 

Definition at line 192 of file ExCCamera.cpp.

References Guard, ExCObject3D::m_AngleX, ExCObject3D::m_AngleY, ExCObject3D::m_AngleZ, m_VecAction, Process(), ROTATE_X_DOWN, ROTATE_X_UP, ROTATE_Y_DOWN, ROTATE_Y_UP, ROTATE_Z_DOWN, ROTATE_Z_UP, SPEED_DOWN, SPEED_UP, ZOOM_DOWN, ZOOM_UP, ZoomIn(), and ZoomOut().

Referenced by Draw(), and Process().

00193 {
00194 Guard(void ExCCamera::Process(void))
00195         for(unsigned i=0;i<m_VecAction.size();i++)
00196         {
00197                 switch(m_VecAction.at(i)) 
00198                 {
00199                 case ROTATE_Z_UP:m_AngleZ++;break;
00200                 case ROTATE_Y_UP:m_AngleY++;break;
00201                 case ROTATE_X_UP:m_AngleX++;break;
00202                 case ROTATE_Z_DOWN:m_AngleZ--;break;
00203                 case ROTATE_Y_DOWN:m_AngleY--;break;
00204                 case ROTATE_X_DOWN:m_AngleX--;break;
00205                 case ZOOM_UP:ZoomOut();break;
00206                 case ZOOM_DOWN:ZoomIn();break;
00207                 case SPEED_UP:break;
00208                 case SPEED_DOWN:break;
00209                 }
00210         }
00211 UnGuard
00212 }

void ResetZoom void   
 

Definition at line 111 of file ExCCamera.cpp.

References Guard, m_Zoom, m_ZoomDefault, and ResetZoom().

Referenced by ResetZoom().

00112 {
00113 Guard(void ExCCamera::ResetZoom(void))
00114         m_Zoom=m_ZoomDefault;
00115 UnGuard
00116 }

void SetClipFar float    clip
 

Definition at line 176 of file ExCCamera.cpp.

References Guard, m_ClipFar, m_ClipNear, and SetClipFar().

Referenced by SetClipFar().

00177 {
00178         Guard(void ExCCamera::SetClipFar(float clip))
00179         m_ClipFar=clip;
00180         if(m_ClipFar<m_ClipNear)m_ClipFar=m_ClipNear+1;
00181 UnGuard
00182 }

void SetClipNear float    clip
 

Definition at line 184 of file ExCCamera.cpp.

References Guard, m_ClipFar, m_ClipNear, and SetClipNear().

Referenced by SetClipNear().

00185 {
00186         Guard(void ExCCamera::SetClipNear(float clip))
00187         m_ClipNear=clip;
00188         if(m_ClipNear>m_ClipFar)m_ClipNear=m_ClipFar-1;
00189 UnGuard
00190 }

void SetZoom float    zoom
 

Definition at line 158 of file ExCCamera.cpp.

References Guard, and SetZoom().

Referenced by SetZoom().

00159 {
00160 Guard(void ExCCamera::SetZoom(float zoom))
00161 UnGuard
00162 }

void SetZoomDefault float    zoom
 

Definition at line 118 of file ExCCamera.cpp.

References Guard, m_ZoomDefault, and m_ZoomMin.

00119 {
00120 Guard(void ExCCamera:: SetZoomDefault(float zoom))
00121         if(zoom<m_ZoomMax&&zoom>m_ZoomMin)
00122                 m_ZoomDefault=zoom;
00123 UnGuard
00124 }

void SetZoomMax float    zoom
 

Definition at line 164 of file ExCCamera.cpp.

References Guard, and SetZoomMax().

Referenced by SetZoomMax().

00165 {
00166 Guard(void ExCCamera::SetZoomMax(float zoom))
00167 UnGuard
00168 }

void SetZoomMin float    zoom
 

Definition at line 170 of file ExCCamera.cpp.

References Guard, and SetZoomMin().

Referenced by SetZoomMin().

00171 {
00172 Guard(void ExCCamera::SetZoomMin(float zoom))
00173 UnGuard
00174 }

void StartAction int    Action
 

Definition at line 214 of file ExCCamera.cpp.

References Guard, m_VecAction, and StartAction().

Referenced by ExManagerCamera::InputAction(), and StartAction().

00215 {
00216 Guard(void ExCCamera::StartAction(int Action))
00217         m_VecAction.push_back(Action);
00218 UnGuard
00219 }

void StopAction int    Action
 

Definition at line 221 of file ExCCamera.cpp.

References Guard, m_ItVecAction, m_VecAction, and StopAction().

Referenced by ExManagerCamera::InputAction(), and StopAction().

00222 {
00223 Guard(void ExCCamera::StopAction(int Action))
00224         for(m_ItVecAction=m_VecAction.begin();m_ItVecAction!=m_VecAction.end();m_ItVecAction++)
00225         {
00226                 if(*m_ItVecAction==Action){m_VecAction.erase(m_ItVecAction);return;}
00227         }
00228 UnGuard
00229 }

void ZoomIn float    zoom
 

Definition at line 142 of file ExCCamera.cpp.

References Guard, m_Zoom, m_ZoomMin, and ZoomIn().

00143 {
00144 Guard(void ExCCamera::ZoomIn(float zoom))
00145         m_Zoom=m_Zoom-zoom;
00146         if(m_Zoom<=m_ZoomMin)m_Zoom=m_ZoomMin+1;
00147 UnGuard
00148 }

void ZoomIn void   
 

Definition at line 126 of file ExCCamera.cpp.

References Guard, m_Zoom, m_ZoomMin, and ZoomIn().

Referenced by ExManagerCamera::InputAction(), Process(), and ZoomIn().

00127 {
00128 Guard(void ExCCamera::ZoomIn(void))
00129         m_Zoom--;
00130         if(m_Zoom<=m_ZoomMin)m_Zoom=m_ZoomMin+1;
00131 UnGuard
00132 }

void ZoomOut float    zoom
 

Definition at line 150 of file ExCCamera.cpp.

References Guard, m_Zoom, m_ZoomMax, and ZoomOut().

00151 {
00152 Guard(void ExCCamera::ZoomOut(float zoom))
00153         m_Zoom=m_Zoom+m_ZoomMax;
00154         if(m_Zoom>=m_ZoomMax)m_Zoom=m_ZoomMax-1;
00155 UnGuard
00156 }

void ZoomOut void   
 

Definition at line 134 of file ExCCamera.cpp.

References Guard, m_Zoom, m_ZoomMax, and ZoomOut().

Referenced by ExManagerCamera::InputAction(), Process(), and ZoomOut().

00135 {
00136 Guard(void ExCCamera::ZoomOut(void))
00137         m_Zoom++;
00138         if(m_Zoom>=m_ZoomMax)m_Zoom=m_ZoomMax-1;
00139 UnGuard
00140 }


Field Documentation

bool m_Actif [protected]
 

Definition at line 41 of file ExCCamera.h.

float m_ClipFar [protected]
 

Definition at line 43 of file ExCCamera.h.

Referenced by ExCCamera(), GetClipNear(), SetClipFar(), and SetClipNear().

float m_ClipNear [protected]
 

Definition at line 44 of file ExCCamera.h.

Referenced by ExCCamera(), SetClipFar(), and SetClipNear().

int m_CurrentAction
 

Definition at line 80 of file ExCCamera.h.

std::vector<int>::iterator m_ItVecAction
 

Definition at line 82 of file ExCCamera.h.

Referenced by StopAction().

std::vector<int> m_VecAction
 

Definition at line 81 of file ExCCamera.h.

Referenced by Process(), StartAction(), and StopAction().

float m_Zoom [protected]
 

Definition at line 42 of file ExCCamera.h.

Referenced by ExCCamera(), GetZoomDefault(), ResetZoom(), ZoomIn(), and ZoomOut().

float m_ZoomDefault [protected]
 

Definition at line 45 of file ExCCamera.h.

Referenced by ExCCamera(), ResetZoom(), and SetZoomDefault().

float m_ZoomMax [protected]
 

Definition at line 46 of file ExCCamera.h.

Referenced by ExCCamera(), GetZoomMin(), and ZoomOut().

float m_ZoomMin [protected]
 

Definition at line 47 of file ExCCamera.h.

Referenced by ExCCamera(), GetZoom(), SetZoomDefault(), and ZoomIn().


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