Page principale | Liste des namespaces | Hiérarchie des classes | Liste par ordre alphabétique | Liste des composants | Liste des fichiers | Membres des namespaces | Composants | Déclarations

ExCCameraFirst.cpp

Aller à la documentation de ce fichier.
00001 /*
00002  * ExNihilo 3D Engine
00003  * 
00004  *  This program is free software; you can redistribute it and/or modify
00005  *  it under the terms of the GNU General Public License as published by
00006  *  the Free Software Foundation; either version 2 of the License, or
00007  *  (at your option) any later version.
00008  *
00009  *  This program is distributed in the hope that it will be useful,
00010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  *  GNU Library General Public License for more details.
00013  *
00014  *  You should have received a copy of the GNU General Public License
00015  *  along with this program; if not, write to the Free Software
00016  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00017  *
00018  * Please read AUTHORS file !!!
00019  * 
00020  * $Id: ExCCameraFirst.cpp,v 1.4 2002/08/14 15:20:53 data Exp $
00021  *
00022  */
00023 
00024 #include "ExCCameraFirst.h"
00025 
00026 
00027 ExCCameraFirst::ExCCameraFirst()
00028 {
00029 Guard(ExCCameraFirst::ExCCameraFirst())
00030         SetName("ExCCameraFirst");
00031         SetType(typeid(this).name());
00032         WalkFalg=true;
00033 UnGuard
00034 }
00035 
00036 ExCCameraFirst::~ExCCameraFirst()
00037 {
00038 Guard(ExCCameraFirst::~ExCCameraFirst())
00039 UnGuard
00040 }
00041 
00042 void ExCCameraFirst::Draw(void)
00043 {
00044 Guard(void ExCCameraFirst::Draw(void))
00045         //Test if there is one object
00046         if(ManagerModel->GetCurrentObject()>0)
00047         {
00048                 m_Position=ManagerModel->GetCurrentObject()->GetPosition();
00049                 m_Target=ManagerModel->GetCurrentObject()->GetTarget();
00050         }else //Transform the cam into free cam
00051         {
00052                 ExCCamera::Draw();
00053                 return;
00054         }
00055         Process();
00056         
00057         if(m_Angle.GetX()<0)m_Angle.SetX(359);
00058         if(m_Angle.GetX()>359)m_Angle.SetX(0);
00059         if(m_Angle.GetY()<0)m_Angle.SetY(359);
00060         if(m_Angle.GetY()>359)m_Angle.SetY(0);
00061         if(m_Angle.GetZ()<0)m_Angle.SetZ(359);
00062         if(m_Angle.GetZ()>359)m_Angle.SetZ(0);
00063 
00064         float cosY,cosP,cosR;
00065         float sinY,sinP,sinR;
00066 
00067         cosY=cosf(DegreesToRadians(GetAngleY()));
00068         cosP=cosf(DegreesToRadians(GetAngleX()));
00069         cosR=cosf(DegreesToRadians(GetAngleZ()));
00070 
00071         sinY=sinf(DegreesToRadians(GetAngleY()));
00072         sinP=sinf(DegreesToRadians(GetAngleX()));
00073         sinR=sinf(DegreesToRadians(GetAngleZ()));       
00074 
00075         m_Position.SetY(m_Position.GetY()+12.0f);
00076         m_Target.SetY(m_Target.GetY()+12.0f);   
00077 
00078         gluLookAt(m_Position.GetX(),m_Position.GetY(),m_Position.GetZ()
00079                         ,m_Target.GetX(),m_Target.GetY(),m_Target.GetZ()
00080                         ,(-cosY*sinR)-(sinY*sinP*cosR),(cosP*cosR),(-sinY*sinR)-(sinP*cosR*-cosY));
00081 UnGuard
00082 }
00083 
00084 void ExCCameraFirst::Process(void)
00085 {
00086 Guard(void ExCCameraFirst::Process(void))
00087         for(unsigned i=0;i<m_VecAction.size();i++)
00088         {
00089                 /*switch(m_VecAction.at(i)) 
00090                 {
00091                 default:ExCCamera::Process();
00092                 }*/
00093                 ExCCamera::Process();
00094         }
00095 UnGuard
00096 }

Généré le Tue Oct 28 12:43:30 2003 pour ExNihilo par doxygen 1.3.4