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

ExCModel.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 
00021  *
00022  */
00023 
00024 #include "ExCModel.h"
00025 
00026 ExCModel::ExCModel()
00027 {
00028 Guard(ExCModel::ExCModel())
00029         ExCObject3D::ExCObject3D();
00030 UnGuard
00031 }
00032 
00033 ExCModel::~ExCModel()
00034 {
00035 Guard(ExCModel::~ExCModel())
00036 UnGuard
00037 }
00038 
00039 void ExCModel::Forward(void)
00040 {
00041 Guard(void ExCModel::Forward(void))
00042         m_Position=m_Position+m_Target; 
00043 UnGuard
00044 }
00045 
00046 void ExCModel::Draw(void)
00047 {
00048 Guard(void ExCModel::Draw(void))
00049         //Calcul new position force vector
00050         
00051         ExQuaternion qRotationY,qRotationX,qRotationZ,qresult;
00052         float matrix[16];
00053 
00054         qRotationX.CreateFromAxisAngle(1, 0, 0, m_Angle.GetX());
00055         qRotationY.CreateFromAxisAngle(0, 1, 0, m_Angle.GetY());
00056         qRotationZ.CreateFromAxisAngle(0, 0, 1, m_Angle.GetZ());
00057         //check if we can move
00058 /*    ExCVec3D CollisionResult;
00059         CollisionResult=ManagerCollision->ObjectCollision(this);
00060 
00061         if(CollisionResult.GetX()!=0)
00062         {
00063                 glColor3f(1,0,0);
00064                 m_Position=m_OldPosition;
00065         }*/
00066         //m_Target=m_Position+ExCVec3D(Cos[(int)m_AngleY],0.0f,Sin[(int)m_AngleY]);
00067         if(m_Angle.GetZ()>90&&m_Angle.GetZ()<270)
00068         {
00069                 m_Target=ExCVec3D(Cos[(int)m_Angle.GetY()],Sin[(int)m_Angle.GetZ()],Sin[(int)m_Angle.GetY()]);
00070         }else
00071         {
00072                 m_Target=ExCVec3D(Cos[(int)m_Angle.GetY()],-Sin[(int)m_Angle.GetZ()],Sin[(int)m_Angle.GetY()]);
00073         }
00074         m_Velocity=m_Velocity+(m_Acceleration*m_Target)-m_Gravity;
00075         m_Position=m_Position+m_Velocity;
00076 
00077         /*m_Position=m_Position+(m_Target*m_Velocity);
00078         ExCVec3D plok;
00079         plok=m_Target*m_Velocity;
00080         std::cout<<"ploki"<<std::endl;
00081         std::cout<<m_Target<<std::endl;
00082         std::cout<<m_Velocity<<std::endl;
00083         std::cout<<plok<<std::endl;*/
00084         //std::cout<<"3ds pos"<<m_Position<<std::endl;
00085         glTranslatef(m_Position.GetX(),m_Position.GetY(),m_Position.GetZ());
00086                 
00087         qRotationY.CreateMatrix(matrix);
00088         glMultMatrixf(matrix);
00089         qRotationZ.CreateMatrix(matrix);
00090         glMultMatrixf(matrix);
00091         qRotationX.CreateMatrix(matrix);
00092         glMultMatrixf(matrix);
00093         
00094 UnGuard
00095 }
00096 ExCAction ExCModel::InputAction(ExCAction Action)
00097 {
00098         return NOTHING;
00099 }
00100 void ExCModel::NextFrame(void)
00101 {
00102 Guard(void ExCModel::NextFrame(void))
00103         m_CurrentFrames++;
00104         if(m_CurrentFrames>m_numFrames)m_CurrentFrames=1;
00105 UnGuard
00106 }
00107 
00108 void ExCModel::PreviousFrame(void)
00109 {
00110 Guard(void ExCModel::PreviousFrame(void))
00111         m_CurrentFrames--;
00112         if(m_CurrentFrames<1)m_CurrentFrames=m_numFrames;
00113 UnGuard
00114 }
00115 
00116 void ExCModel::SetCurrentFrame(int frame)
00117 {
00118 Guard(void ExCModel::SetCurrentFrame(int frame))
00119   if(frame>0&&frame<m_numFrames)
00120         m_CurrentFrames=frame;
00121 UnGuard
00122 }
00123 
00124 void ExCModel::StartRun(void)
00125 {
00126 Guard(void ExCModel::StartRun(void))
00127         //m_CurrentFrames=40;
00128         //m_Transition=true;
00129 UnGuard
00130 }
00131 
00132 void ExCModel::StopRun(void)
00133 {
00134 Guard(void ExCModel::StopRun(void))
00135         //m_CurrentFrames=1;
00136         //m_Transition=false; 
00137 UnGuard
00138 }
00139 
00140 void ExCModel::StartAction(std::string   Action)
00141 {
00142 Guard(void ExCModel::SStartAction(std::string    Action))
00143 UnGuard
00144 }
00145 
00146 void ExCModel::StopAction(void)
00147 {
00148 Guard(void ExCModel::StopAction(void))
00149 UnGuard
00150 }

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