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

# ExCEntite Class Reference

`#include <ExCEntite.h>`

Inheritance diagram for ExCEntite:

## Public Methods
| ExCEntite (void)
| ~ExCEntite (void)
void | SetManagerTexture (ExManagerTexture *Texture)
void | SetNumberVertex (long NumberVertex)
void | SetNumberMesh (long NumberMesh)
long | GetNumberVertex (void)
long | GetNumberMesh (void)
int | GetRenderMode (void)
GLuint | GetGlListId (void)
virtual void | Draw (void)
void | DrawWithoutList (void)
virtual bool | LoadAsc (char *FileName)
virtual void | MakeList (void)
virtual void | SetRenderMode (int RenderMode)
void | AddVertex (ExCVertex Vertex)
void | AddMesh (ExCMesh Mesh)
ExCVertex | GetVertex (int pos)
void | BuildPvsBox (void)
## Data Fields
ExCGizmoRectangle | m_BoxPvs
## Protected Attributes
ExManagerTexture * | ManagerTexture
std::vector< ExCVertex > | m_VecVertex
std::vector< ExCVertex >::iterator | m_ItVecVertex
std::vector< ExCMesh > | m_VecMesh
std::vector< ExCMesh >::iterator | m_ItVecMesh
long | m_NumberVertex
long | m_NumberMesh
int | m_RenderMode
GLuint | m_GlListId

## Constructor & Destructor Documentation

ExCEntite | ( | void |  | ) |

| Definition at line 26 of file ExCEntite.cpp. References ExCEntite(), ExCObject::ExCObject(), Guard, m_RenderMode, and MakeList(). Referenced by ExCEntite(), and ~ExCEntite().
    00027 {
    00028 Guard(ExCEntite::ExCEntite(void))
    00029         ExCObject::ExCObject();
    00030         m_RenderMode=RENDER_LINES;
    00031         MakeList();
    00032 UnGuard
    00033 }

~ExCEntite | ( | void |  | ) |

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

## Member Function Documentation

void AddMesh | ( | ExCMesh | Mesh | ) |

| Definition at line 275 of file ExCEntite.cpp. References AddMesh(), Guard, and m_VecMesh. Referenced by AddMesh(), and ExCComposed::LoadAsc().
    00276 {
    00277 Guard(void ExCEntite::AddMesh(ExCMesh Mesh))
    00278         m_VecMesh.push_back(Mesh);
    00279 UnGuard
    00280 }

void AddVertex | ( | ExCVertex | Vertex | ) |

| Definition at line 268 of file ExCEntite.cpp. References AddVertex(), Guard, and m_VecVertex. Referenced by AddVertex(), and ExCComposed::LoadAsc().
    00269 {
    00270 Guard(void ExCEntite::AddVertex(ExCVertex Vertex))
    00271         m_VecVertex.push_back(Vertex);
    00272 UnGuard
    00273 }

void BuildPvsBox | ( | void |  | ) |

| Reimplemented in ExCComposed. Definition at line 76 of file ExCEntite.cpp. References BuildPvsBox(), Guard, m_BoxPvs, m_ItVecVertex, m_VecVertex, ExCGizmoRectangle::m_Vertex, ExCVertex::SetX(), ExCVertex::SetY(), and ExCVertex::SetZ(). Referenced by BuildPvsBox(), and LoadAsc().
    00077 {
    00078 Guard(void ExCEntite::BuildPvsBox(void))
    00079         //Serach for max and min value
    00080         double MaxX,MaxY,MaxZ,MinX,MinY,MinZ;
    00081         m_ItVecVertex=m_VecVertex.begin();
    00082         MaxX=m_ItVecVertex->GetX();
    00083         MinX=m_ItVecVertex->GetX();
    00084         MaxY=m_ItVecVertex->GetY();
    00085         MinY=m_ItVecVertex->GetY();
    00086         MaxZ=m_ItVecVertex->GetZ();
    00087         MinZ=m_ItVecVertex->GetZ();
    00088         m_ItVecVertex++;
    00089         for(;m_ItVecVertex!=m_VecVertex.end();++m_ItVecVertex)
    00090         {
    00091                 if(m_ItVecVertex->GetX()<MinX)
    00092                 {
    00093                         MinX=m_ItVecVertex->GetX();
    00094                 }else
    00095                 if(m_ItVecVertex->GetX()>MaxX)
    00096                 {
    00097                         MaxX=m_ItVecVertex->GetX();
    00098                 }
    00099
    00100                 if(m_ItVecVertex->GetY()<MinY)
    00101                 {
    00102                         MinY=m_ItVecVertex->GetY();
    00103                 }else
    00104                 if(m_ItVecVertex->GetY()>MaxY)
    00105                 {
    00106                         MaxY=m_ItVecVertex->GetY();
    00107                 }
    00108
    00109                 if(m_ItVecVertex->GetZ()<MinZ)
    00110                 {
    00111                         MinZ=m_ItVecVertex->GetZ();
    00112                 }else
    00113                 if(m_ItVecVertex->GetZ()>MaxZ)
    00114                 {
    00115                         MaxZ=m_ItVecVertex->GetZ();
    00116                 }
    00117
    00118         }
    00119         m_BoxPvs.m_Vertex[0].SetX(MaxX);
    00120         m_BoxPvs.m_Vertex[0].SetY(MaxY);
    00121         m_BoxPvs.m_Vertex[0].SetZ(MinZ);
    00122         m_BoxPvs.m_Vertex[1].SetX(MaxX);
    00123         m_BoxPvs.m_Vertex[1].SetY(MaxY);
    00124         m_BoxPvs.m_Vertex[1].SetZ(MaxZ);
    00125         m_BoxPvs.m_Vertex[2].SetX(MinX);
    00126         m_BoxPvs.m_Vertex[2].SetY(MaxY);
    00127         m_BoxPvs.m_Vertex[2].SetZ(MaxZ);
    00128         m_BoxPvs.m_Vertex[3].SetX(MinX);
    00129         m_BoxPvs.m_Vertex[3].SetY(MaxY);
    00130         m_BoxPvs.m_Vertex[3].SetZ(MinZ);
    00131         m_BoxPvs.m_Vertex[4].SetX(MaxX);
    00132         m_BoxPvs.m_Vertex[4].SetY(MinY);
    00133         m_BoxPvs.m_Vertex[4].SetZ(MinZ);
    00134         m_BoxPvs.m_Vertex[5].SetX(MaxX);
    00135         m_BoxPvs.m_Vertex[5].SetY(MinY);
    00136         m_BoxPvs.m_Vertex[5].SetZ(MaxZ);
    00137         m_BoxPvs.m_Vertex[6].SetX(MinX);
    00138         m_BoxPvs.m_Vertex[6].SetY(MinY);
    00139         m_BoxPvs.m_Vertex[6].SetZ(MaxZ);
    00140         m_BoxPvs.m_Vertex[7].SetX(MinX);
    00141         m_BoxPvs.m_Vertex[7].SetY(MinY);
    00142         m_BoxPvs.m_Vertex[7].SetZ(MinZ);
    00143
    00144 UnGuard
    00145 }

void Draw | ( | void |  | ) | `[virtual]`

| Reimplemented from ExCObject. Reimplemented in ExCComposed. Definition at line 41 of file ExCEntite.cpp. References Draw(), ExCVec3D::GetX(), ExCVec3D::GetY(), ExCVec3D::GetZ(), Guard, ExCObject3D::m_Acceleration, m_GlListId, ExCObject3D::m_Gravity, ExCObject3D::m_Life, ExCObject3D::m_Position, ExCObject3D::m_RefreshTime, ExCObject3D::m_StartingLife, ExCVec3D::m_Vector, and ExCObject3D::m_Velocity. Referenced by Draw().
    00042 {
    00043 Guard(void ExCEntite::Draw(void))
    00044 //std::cout<<"Draw "<<m_ObjectName<<" ID:"<<m_ObjectId<<"Opengl List ID:"<<m_GlListId<<std::endl;
    00045
    00046         double tmplife;
    00047         tmplife=(double)((double)glutGet(GLUT_ELAPSED_TIME)/1000)-m_StartingLife;
    00048         if(tmplife-m_Life>=m_RefreshTime)
    00049         {
    00050                 m_Position=m_Position+m_Velocity-m_Gravity;
    00051                 if(m_Acceleration!=0.0f)
    00052                 {
    00053                         if(m_Velocity.m_Vector[0]!=0.0f)
    00054                         {
    00055                                 m_Velocity.m_Vector[0]=m_Velocity.m_Vector[0]+((double)m_Acceleration*((double)(tmplife-m_Life)/1000));
    00056                         }
    00057                         if(m_Velocity.m_Vector[1]!=0.0f)
    00058                         {
    00059                                 m_Velocity.m_Vector[1]=m_Velocity.m_Vector[1]+((double)m_Acceleration*((double)(tmplife-m_Life)/1000));
    00060                         }
    00061                         if(m_Velocity.m_Vector[2]!=0.0f)
    00062                         {
    00063                                 m_Velocity.m_Vector[2]=m_Velocity.m_Vector[2]+((double)m_Acceleration*((double)(tmplife-m_Life)/1000));
    00064                         }
    00065                 }
    00066                 m_Life=(double)((double)glutGet(GLUT_ELAPSED_TIME)/1000)-m_StartingLife;
    00067         }
    00068         glPushMatrix();
    00069         glTranslatef(m_Position.GetX(),m_Position.GetY(),m_Position.GetZ());
    00070         glCallList(m_GlListId);
    00071         //m_BoxPvs.Draw();
    00072         glPopMatrix();
    00073 UnGuard
    00074 }

void DrawWithoutList | ( | void |  | ) |

| Definition at line 169 of file ExCEntite.cpp. References Guard, m_ItVecMesh, m_ItVecVertex, m_VecMesh, m_VecVertex, ManagerTexture, and ExManagerTexture::SetCurrentObject(). Referenced by MakeList().
    00170 {
    00171 Guard(void ExCEntite:: DrawWithoutList(void))
    00172
    00173         switch(m_RenderMode)
    00174         {
    00175         case RENDER_TEXTURES_LIGHT:
    00176                 break;
    00177     case RENDER_TEXTURES:
    00178                 glColor3f(1.0f, 1.0f, 1.0f);
    00179         glEnable(GL_TEXTURE_2D);
    00180                 glDisable(GL_LIGHTING);
    00181
    00182
    00183             for(m_ItVecMesh=m_VecMesh.begin();m_ItVecMesh!=m_VecMesh.end();++m_ItVecMesh)
    00184                 {
    00185                         #ifdef DEBUG
    00186                                 if(!ManagerTexture->SetCurrentObject(m_ItVecMesh->GetMaterial()))
    00187                                 {
    00188                                         std::cout<<"can not find texture for mesh :"<<std::endl;
    00189                                         m_ItVecMesh->Affich();
    00190                                 }
    00191                         #endif
    00192                         glBegin(GL_TRIANGLES);
    00193                         glTexCoord2f(m_ItVecMesh->A.GetU(), m_ItVecMesh->A.GetV());
    00194                         glVertex3f(m_ItVecMesh->A.GetX(),m_ItVecMesh->A.GetY(),m_ItVecMesh->A.GetZ());
    00195                         glTexCoord2f(m_ItVecMesh->B.GetU(), m_ItVecMesh->B.GetV());
    00196                         glVertex3f(m_ItVecMesh->B.GetX(),m_ItVecMesh->B.GetY(),m_ItVecMesh->B.GetZ());
    00197                         glTexCoord2f(m_ItVecMesh->C.GetU(), m_ItVecMesh->C.GetV());
    00198                         glVertex3f(m_ItVecMesh->C.GetX(),m_ItVecMesh->C.GetY(),m_ItVecMesh->C.GetZ());
    00199                         glEnd();
    00200                 }
    00201
    00202                 glDisable(GL_TEXTURE_2D);
    00203                 break;
    00204         case RENDER_TRIANGLES_LIGHT:
    00205                         glPushMatrix();
    00206                         glColor3f(1.0f, 1.0f, 1.0f);
    00207                         glBegin(GL_TRIANGLES);
    00208                         for(m_ItVecMesh=m_VecMesh.begin();m_ItVecMesh!=m_VecMesh.end();++m_ItVecMesh)
    00209                         {
    00210                                 glNormal3f(m_ItVecMesh->A.GetX(),m_ItVecMesh->A.GetY(),m_ItVecMesh->A.GetZ());
    00211                                 glVertex3f(m_ItVecMesh->A.GetX(),m_ItVecMesh->A.GetY(),m_ItVecMesh->A.GetZ());
    00212                                 glNormal3f(m_ItVecMesh->B.GetX(),m_ItVecMesh->B.GetY(),m_ItVecMesh->B.GetZ());
    00213                                 glVertex3f(m_ItVecMesh->B.GetX(),m_ItVecMesh->B.GetY(),m_ItVecMesh->B.GetZ());
    00214                                 glNormal3f(m_ItVecMesh->C.GetX(),m_ItVecMesh->C.GetY(),m_ItVecMesh->C.GetZ());
    00215                                 glVertex3f(m_ItVecMesh->C.GetX(),m_ItVecMesh->C.GetY(),m_ItVecMesh->C.GetZ());
    00216                         }
    00217                         glEnd();
    00218                         glPopMatrix();
    00219                 break;
    00220         case RENDER_TRIANGLES:
    00221                         glDisable(GL_LIGHTING);
    00222                         glPushMatrix();
    00223                         glColor3f(1.0f, 1.0f, 1.0f);
    00224                         glBegin(GL_TRIANGLES);
    00225                                 for(m_ItVecMesh=m_VecMesh.begin();m_ItVecMesh!=m_VecMesh.end();++m_ItVecMesh)
    00226                                 {
    00227                                         glVertex3f(m_ItVecMesh->A.GetX(),m_ItVecMesh->A.GetY(),m_ItVecMesh->A.GetZ());
    00228                                         glVertex3f(m_ItVecMesh->B.GetX(),m_ItVecMesh->B.GetY(),m_ItVecMesh->B.GetZ());
    00229                                         glVertex3f(m_ItVecMesh->C.GetX(),m_ItVecMesh->C.GetY(),m_ItVecMesh->C.GetZ());
    00230                                 }
    00231                         glEnd();
    00232                         glPopMatrix();
    00233                         glEnable(GL_LIGHTING);
    00234                         break;
    00235         case RENDER_POINTS:
    00236                 glDisable(GL_LIGHTING);
    00237                 glBegin(GL_POINTS);
    00238                         glColor3f(1.0f, 1.0f, 1.0f);
    00239                         for(m_ItVecVertex=m_VecVertex.begin();m_ItVecVertex!=m_VecVertex.end();++m_ItVecVertex)
    00240                         {
    00241                                 glVertex3f(m_ItVecVertex->GetX(),m_ItVecVertex->GetY(),m_ItVecVertex->GetZ());
    00242                         }
    00243                 glEnd();
    00244                 glEnable(GL_LIGHTING);
    00245                 break;
    00246         case RENDER_LINES:
    00247                         glDisable(GL_LIGHTING);
    00248                         glPushMatrix();
    00249                                 glColor3f(1.0f, 1.0f, 1.0f);
    00250                                 for(m_ItVecMesh=m_VecMesh.begin();m_ItVecMesh!=m_VecMesh.end();++m_ItVecMesh)
    00251                                 {
    00252                                         glBegin(GL_LINE_LOOP);
    00253                                         glVertex3f(m_ItVecMesh->A.GetX(),m_ItVecMesh->A.GetY(),m_ItVecMesh->A.GetZ());
    00254                                         glVertex3f(m_ItVecMesh->B.GetX(),m_ItVecMesh->B.GetY(),m_ItVecMesh->B.GetZ());
    00255                                         glVertex3f(m_ItVecMesh->C.GetX(),m_ItVecMesh->C.GetY(),m_ItVecMesh->C.GetZ());
    00256                                         glEnd();
    00257                                 }
    00258                         glPopMatrix();
    00259                         glEnable(GL_LIGHTING);
    00260                 break;
    00261         case RENDER_NO:
    00262                 break;
    00263         }
    00264 UnGuard
    00265 }

GLuint GetGlListId | ( | void |  | ) | `[inline]`

| Definition at line 73 of file ExCEntite.h. References m_RenderMode.
    00073 {return m_RenderMode;}

long GetNumberMesh | ( | void |  | ) | `[inline]`

| Definition at line 71 of file ExCEntite.h. References m_NumberVertex. Referenced by ExCComposed::LoadAsc().
    00071 {return m_NumberVertex;}

long GetNumberVertex | ( | void |  | ) | `[inline]`

| Definition at line 70 of file ExCEntite.h. Referenced by ExCComposed::LoadAsc().
    00071 {return m_NumberVertex;}

int GetRenderMode | ( | void |  | ) | `[inline]`

| Definition at line 72 of file ExCEntite.h. References m_NumberMesh.
    00072 {return m_NumberMesh;}

ExCVertex GetVertex | ( | int | pos | ) |

| Definition at line 282 of file ExCEntite.cpp. References GetVertex(), Guard, and m_VecVertex. Referenced by GetVertex(), and ExCComposed::LoadAsc().
    00283 {
    00284 Guard(ExCVertex ExCEntite::GetVertex(int pos))
    00285         return m_VecVertex.at(pos);
    00286 UnGuard
    00287 }

bool LoadAsc | ( | char * | FileName | ) | `[virtual]`

| Reimplemented in ExCComposed. Definition at line 289 of file ExCEntite.cpp. References ExCMesh::A, ExCMesh::B, BuildPvsBox(), ExCMesh::C, Guard, ExCMesh::m_AB, ExCMesh::m_BC, ExCMesh::m_CA, ExCMesh::m_MeshNumber, m_NumberMesh, m_NumberVertex, ExCMesh::m_Smoothing, m_VecMesh, m_VecVertex, ExCMesh::SetMaterial(), ExCObject::SetName(), SetNumberMesh(), SetNumberVertex(), ExCVertex::SetU(), ExCVertex::SetV(), ExCVertex::SetX(), ExCVertex::SetY(), and ExCVertex::SetZ().
    00290 {
    00291 Guard(void LoadAscEntite(char *FileName))
    00292         bool                    Textured;
    00293         int                             FileSize;
    00294         int                             RetVal;
    00295         int                             TmpFilePosition;
    00296         int                             i,j,k;
    00297         const char              *Name;
    00298         char                    ch;
    00299         std::string             SName;
    00300         std::string             SNumber;
    00301         FILE                    *MyFile;
    00302         ExCVertex               VertexBuff;
    00303
    00304
    00305         char *buffer;
    00306         buffer= new char[15+strlen(FileName)];
    00307         sprintf(buffer,"Load File :%s",FileName);
    00308     //WriteToConsol(buffer);
    00309
    00310         Textured=false;
    00311         MyFile=fopen (FileName,"r");
    00312         if(!MyFile)
    00313         {
    00314 //              WriteToConsol("File not found");
    00315
    00316                 return false;
    00317         }
    00318         fseek(MyFile,0,SEEK_END);
    00319         FileSize=ftell(MyFile);
    00320         buffer= new char[15];
    00321         sprintf(buffer,"Size:%d",FileSize);
    00322     //WriteToConsol(buffer);
    00323         //Start of file
    00324         fseek(MyFile,0,SEEK_SET);
    00325         //------------------
    00326         //Read object name
    00327         //------------------
    00328         do
    00329         {
    00330                 RetVal=fread(&ch,sizeof(char),1,MyFile);
    00331         }while(ch!=34);
    00332         TmpFilePosition=ftell(MyFile);//remember where name start
    00333         i=0;
    00334         do
    00335         {
    00336                 RetVal=fread(&ch,sizeof(char),1,MyFile);i++;
    00337         }while(ch!=34);
    00338         fseek(MyFile,TmpFilePosition,SEEK_SET);
    00339         for(j=0;j<i-1;j++)
    00340         {
    00341                 RetVal=fread(&ch,sizeof(char),1,MyFile);
    00342                 SName=SName+ch;
    00343         }
    00344         Name = SName.data();
    00345         SetName(Name);
    00346         //-----------------------------
    00347         //Read number of vertex en face
    00348         //-----------------------------
    00349         do
    00350         {
    00351                 RetVal=fread(&ch,sizeof(char),1,MyFile);
    00352         }while(ch!=':');
    00353         RetVal=fread(&ch,sizeof(char),1,MyFile);//one more to skip the space
    00354     do
    00355         {
    00356                 RetVal=fread(&ch,sizeof(char),1,MyFile);
    00357                 SNumber=SNumber+ch;
    00358         }while(ch!=' ');
    00359         SetNumberVertex(atol(SNumber.data()));
    00360
    00361         SNumber.erase(SNumber.begin(),SNumber.end());
    00362         do
    00363         {
    00364                 RetVal=fread(&ch,sizeof(char),1,MyFile);
    00365         }while(ch!=':');
    00366         RetVal=fread(&ch,sizeof(char),1,MyFile);//one more to skip the space
    00367     do
    00368         {
    00369                 RetVal=fread(&ch,sizeof(char),1,MyFile);
    00370                 SNumber=SNumber+ch;
    00371         }while(ch=='0'||ch=='1'||ch=='2'||ch=='3'||ch=='4'||ch=='5'||
    00372                                 ch=='6'||ch=='7'||ch=='8'||ch=='9'||ch=='.'||ch=='-');
    00373         SetNumberMesh(atol(SNumber.data()));
    00374         //std::cout<<"Number of Vertex :"<<m_NumberVertex<<" Number of Mesh :"<<m_NumberMesh<<std::endl;
    00375         //-----------------------------
    00376         //Read vertex
    00377         //-----------------------------
    00378         for(j=0;j<m_NumberVertex;j++)
    00379         {
    00380                 SNumber.erase(SNumber.begin(),SNumber.end());
    00381                 do
    00382                 {
    00383                         RetVal=fread(&ch,sizeof(char),1,MyFile);
    00384                 }while(ch!='X');
    00385                 RetVal=fread(&ch,sizeof(char),1,MyFile);//one more to skip :
    00386                 do
    00387                 {
    00388                         RetVal=fread(&ch,sizeof(char),1,MyFile);
    00389                         SNumber=SNumber+ch;
    00390                 }while(ch=='0'||ch=='1'||ch=='2'||ch=='3'||ch=='4'||ch=='5'||
    00391                                 ch=='6'||ch=='7'||ch=='8'||ch=='9'||ch=='.'||ch=='-');
    00392         try
    00393                 {
    00394                         VertexBuff.SetX(atof(SNumber.data()));
    00395                 }catch(...)
    00396                 {
    00397                         VertexBuff.SetV(0.0f);
    00398                         std::cout<<"Error on vertex V:"<<j<<std::endl;
    00399                 }
    00400                 //-------------------------------------------------------------
    00401                 SNumber.erase(SNumber.begin(),SNumber.end());
    00402                 do
    00403                 {
    00404                         RetVal=fread(&ch,sizeof(char),1,MyFile);
    00405                 }while(ch!='Y');
    00406                 RetVal=fread(&ch,sizeof(char),1,MyFile);//one more to skip :
    00407                 do
    00408                 {
    00409                         RetVal=fread(&ch,sizeof(char),1,MyFile);
    00410                         SNumber=SNumber+ch;
    00411                 }while(ch=='0'||ch=='1'||ch=='2'||ch=='3'||ch=='4'||ch=='5'||
    00412                                 ch=='6'||ch=='7'||ch=='8'||ch=='9'||ch=='.'||ch=='-');
    00413                 try
    00414                 {
    00415                         VertexBuff.SetY(atof(SNumber.data()));
    00416                 }catch(...)
    00417                 {
    00418                         VertexBuff.SetV(0.0f);
    00419                         std::cout<<"Error on vertex V:"<<j<<std::endl;
    00420                 }
    00421                 //-------------------------------------------------------------
    00422                 SNumber.erase(SNumber.begin(),SNumber.end());
    00423                 do
    00424                 {
    00425                         RetVal=fread(&ch,sizeof(char),1,MyFile);
    00426                 }while(ch!='Z');
    00427                 RetVal=fread(&ch,sizeof(char),1,MyFile);//one more to skip :
    00428                 do
    00429                 {
    00430                         RetVal=fread(&ch,sizeof(char),1,MyFile);
    00431                         SNumber=SNumber+ch;
    00432                 }while(ch=='0'||ch=='1'||ch=='2'||ch=='3'||ch=='4'||ch=='5'||
    00433                                 ch=='6'||ch=='7'||ch=='8'||ch=='9'||ch=='.'||ch=='-');
    00434         try
    00435                 {
    00436                         VertexBuff.SetZ(atof(SNumber.data()));
    00437                 }catch(...)
    00438                 {
    00439                         VertexBuff.SetV(0.0f);
    00440                         std::cout<<"Error on vertex V:"<<j<<std::endl;
    00441                 }
    00442                 //--------------------------------------------------------------
    00443                 //VertexBuff.Affich();std::cout<<std::endl;
    00444                 RetVal=fread(&ch,sizeof(char),1,MyFile);
    00445                 if(ch==' ')//if object has U and V value
    00446                 {
    00447                         Textured=true;
    00448                         //-------------------------------------------------------------
    00449                         SNumber.erase(SNumber.begin(),SNumber.end());
    00450                         do
    00451                         {
    00452                                 RetVal=fread(&ch,sizeof(char),1,MyFile);
    00453                         }while(ch!='U');
    00454                         RetVal=fread(&ch,sizeof(char),1,MyFile);//one more to skip :
    00455                         do
    00456                         {
    00457                                 RetVal=fread(&ch,sizeof(char),1,MyFile);
    00458                                 SNumber=SNumber+ch;
    00459                         }while(ch=='0'||ch=='1'||ch=='2'||ch=='3'||ch=='4'||ch=='5'||
    00460                                         ch=='6'||ch=='7'||ch=='8'||ch=='9'||ch=='.'||ch=='-');
    00461                         VertexBuff.SetU(atof(SNumber.data()));
    00462                         //-------------------------------------------------------------
    00463                         SNumber.erase(SNumber.begin(),SNumber.end());
    00464                         do
    00465                         {
    00466                                 RetVal=fread(&ch,sizeof(char),1,MyFile);
    00467                         }while(ch!='V');
    00468                         RetVal=fread(&ch,sizeof(char),1,MyFile);//one more to skip :
    00469                         do
    00470                         {
    00471                                 RetVal=fread(&ch,sizeof(char),1,MyFile);
    00472                                 SNumber=SNumber+ch;
    00473                         }while(ch=='0'||ch=='1'||ch=='2'||ch=='3'||ch=='4'||ch=='5'||
    00474                                         ch=='6'||ch=='7'||ch=='8'||ch=='9'||ch=='.'||ch=='-');
    00475                         VertexBuff.SetV(atof(SNumber.data()));
    00476                         //-------------------------------------------------------------
    00477                 }
    00478                 m_VecVertex.push_back(VertexBuff);
    00479         }
    00480         //-----------------------------
    00481         //Read face
    00482         //-----------------------------
    00483         for(j=0;j<m_NumberMesh;j++)
    00484         {
    00485                 ExCMesh                 MeshBuff;
    00486                 MeshBuff.m_MeshNumber=j;
    00487                 SNumber.erase(SNumber.begin(),SNumber.end());
    00488                 do
    00489                 {
    00490                         RetVal=fread(&ch,sizeof(char),1,MyFile);
    00491                 }while(ch!='A');
    00492                 RetVal=fread(&ch,sizeof(char),1,MyFile);//one more to skip :
    00493                 do
    00494                 {
    00495                         RetVal=fread(&ch,sizeof(char),1,MyFile);
    00496                         SNumber=SNumber+ch;
    00497                 }while(ch=='0'||ch=='1'||ch=='2'||ch=='3'||ch=='4'||ch=='5'||
    00498                                 ch=='6'||ch=='7'||ch=='8'||ch=='9'||ch=='.'||ch=='-');
    00499                 MeshBuff.A=m_VecVertex.at(atoi(SNumber.data()));
    00500
    00501                 //-------------------------------------------------------------
    00502                 SNumber.erase(SNumber.begin(),SNumber.end());
    00503                 do
    00504                 {
    00505                         RetVal=fread(&ch,sizeof(char),1,MyFile);
    00506                 }while(ch!='B');
    00507                 RetVal=fread(&ch,sizeof(char),1,MyFile);//one more to skip :
    00508                 do
    00509                 {
    00510                         RetVal=fread(&ch,sizeof(char),1,MyFile);
    00511                         SNumber=SNumber+ch;
    00512                 }while(ch=='0'||ch=='1'||ch=='2'||ch=='3'||ch=='4'||ch=='5'||
    00513                                 ch=='6'||ch=='7'||ch=='8'||ch=='9'||ch=='.'||ch=='-');
    00514                 MeshBuff.B=m_VecVertex.at(atoi(SNumber.data()));
    00515                 //-------------------------------------------------------------
    00516                 SNumber.erase(SNumber.begin(),SNumber.end());
    00517                 do
    00518                 {
    00519                         RetVal=fread(&ch,sizeof(char),1,MyFile);
    00520                 }while(ch!='C');
    00521                 RetVal=fread(&ch,sizeof(char),1,MyFile);//one more to skip :
    00522                 do
    00523                 {
    00524                         RetVal=fread(&ch,sizeof(char),1,MyFile);
    00525                         SNumber=SNumber+ch;
    00526                 }while(ch=='0'||ch=='1'||ch=='2'||ch=='3'||ch=='4'||ch=='5'||
    00527                                 ch=='6'||ch=='7'||ch=='8'||ch=='9'||ch=='.'||ch=='-');
    00528                 MeshBuff.C=m_VecVertex.at(atoi(SNumber.data()));
    00529                 //------------------------------------------------------------
    00530                 do
    00531                 {
    00532                         RetVal=fread(&ch,sizeof(char),1,MyFile);
    00533                 }while(ch!='B');
    00534                 RetVal=fread(&ch,sizeof(char),1,MyFile);//one more to skip :
    00535                 SNumber.erase(SNumber.begin(),SNumber.end());
    00536                 do
    00537                 {
    00538                         RetVal=fread(&ch,sizeof(char),1,MyFile);
    00539                         SNumber=SNumber+ch;
    00540                 }while(ch=='0'||ch=='1'||ch=='2'||ch=='3'||ch=='4'||ch=='5'||
    00541                                 ch=='6'||ch=='7'||ch=='8'||ch=='9'||ch=='.'||ch=='-');
    00542                 MeshBuff.m_AB=atoi(SNumber.data());
    00543                 do
    00544                 {
    00545                         RetVal=fread(&ch,sizeof(char),1,MyFile);
    00546                 }while(ch!='C');
    00547                 RetVal=fread(&ch,sizeof(char),1,MyFile);//one more to skip :
    00548                 SNumber.erase(SNumber.begin(),SNumber.end());
    00549                 do
    00550                 {
    00551                         RetVal=fread(&ch,sizeof(char),1,MyFile);
    00552                         SNumber=SNumber+ch;
    00553                 }while(ch=='0'||ch=='1'||ch=='2'||ch=='3'||ch=='4'||ch=='5'||
    00554                                 ch=='6'||ch=='7'||ch=='8'||ch=='9'||ch=='.'||ch=='-');
    00555                 MeshBuff.m_BC=atoi(SNumber.data());
    00556                 do
    00557                 {
    00558                         RetVal=fread(&ch,sizeof(char),1,MyFile);
    00559                 }while(ch!='A');
    00560                 RetVal=fread(&ch,sizeof(char),1,MyFile);//one more to skip :
    00561                 SNumber.erase(SNumber.begin(),SNumber.end());
    00562                 do
    00563                 {
    00564                         RetVal=fread(&ch,sizeof(char),1,MyFile);
    00565                         SNumber=SNumber+ch;
    00566                 }while(ch=='0'||ch=='1'||ch=='2'||ch=='3'||ch=='4'||ch=='5'||
    00567                                 ch=='6'||ch=='7'||ch=='8'||ch=='9'||ch=='.'||ch=='-');
    00568                 MeshBuff.m_CA=atoi(SNumber.data());
    00569                 if(Textured)
    00570                 {
    00571                         //-----------------------------
    00572                         //Read material
    00573                         //-----------------------------
    00574                         std::string Material;
    00575                 do
    00576                         {
    00577                                 RetVal=fread(&ch,sizeof(char),1,MyFile);
    00578                         }while(ch!=34);
    00579                         TmpFilePosition=ftell(MyFile);//remember where name start
    00580                         i=0;
    00581                         do
    00582                         {
    00583                                 RetVal=fread(&ch,sizeof(char),1,MyFile);i++;
    00584                         }while(ch!=34);
    00585                         fseek(MyFile,TmpFilePosition,SEEK_SET);
    00586                         for(k=0;k<i-1;k++)
    00587                         {
    00588                                 RetVal=fread(&ch,sizeof(char),1,MyFile);
    00589                                 Material=Material+ch;
    00590                         }
    00591                         MeshBuff.SetMaterial(Material.data());
    00592                 }
    00593                 //-----------------------------
    00594                 //Read Smoothing
    00595                 //-----------------------------
    00596                 do
    00597                 {
    00598                         RetVal=fread(&ch,sizeof(char),1,MyFile);
    00599                 }while(ch!=':');
    00600                 RetVal=fread(&ch,sizeof(char),1,MyFile);//one more to skip espace
    00601                 SNumber.erase(SNumber.begin(),SNumber.end());
    00602                 do
    00603                 {
    00604                         RetVal=fread(&ch,sizeof(char),1,MyFile);
    00605                         SNumber=SNumber+ch;
    00606                 }while(ch=='0'||ch=='1'||ch=='2'||ch=='3'||ch=='4'||ch=='5'||
    00607                                 ch=='6'||ch=='7'||ch=='8'||ch=='9'||ch=='.'||ch=='-');
    00608            MeshBuff.m_Smoothing=atoi(SNumber.data());
    00609            m_VecMesh.push_back(MeshBuff);
    00610         }
    00611         fclose(MyFile);
    00612         BuildPvsBox();
    00613         return true;
    00614 UnGuard
    00615 }

void MakeList | ( | void |  | ) | `[virtual]`

| Reimplemented in ExCComposed. Definition at line 156 of file ExCEntite.cpp. References DrawWithoutList(), Guard, m_GlListId, and MakeList(). Referenced by ExCEntite(), MakeList(), and SetRenderMode().
    00157 {
    00158 Guard(void ExCEntite::MakeList(void))
    00159
    00160         glDeleteLists(m_GlListId,1);    //delete old list
    00161         m_GlListId=glGenLists(1);       //Ask for a new free list
    00162         //std::cout<<"New list Id:"<<m_GlListId<<std::endl;
    00163         glNewList(m_GlListId,GL_COMPILE);
    00164         DrawWithoutList();
    00165         glEndList();
    00166 UnGuard
    00167 }

void SetManagerTexture | ( | ExManagerTexture * | Texture | ) | `[inline]`

| Reimplemented in ExCComposed. Definition at line 66 of file ExCEntite.h. Referenced by ExManagerEntite::Add(), and ExManagerEntite::NewObject().
    00067 {ManagerTexture=Texture;}

void SetNumberMesh | ( | long | NumberMesh | ) | `[inline]`

| Definition at line 68 of file ExCEntite.h. References m_NumberVertex. Referenced by LoadAsc(), and ExCComposed::LoadAsc().
    00068 {m_NumberVertex=NumberVertex;}

void SetNumberVertex | ( | long | NumberVertex | ) | `[inline]`

| Definition at line 67 of file ExCEntite.h. References ManagerTexture. Referenced by LoadAsc(), and ExCComposed::LoadAsc().
    00067 {ManagerTexture=Texture;}

void SetRenderMode | ( | int | RenderMode | ) | `[virtual]`

| Reimplemented in ExCComposed. Definition at line 148 of file ExCEntite.cpp. References Guard, m_RenderMode, MakeList(), and SetRenderMode(). Referenced by SetRenderMode().
    00149 {
    00150 Guard(void ExCEntite::SetRenderMode(int RenderMode))
    00151         m_RenderMode=RenderMode;
    00152         MakeList();
    00153 UnGuard
    00154 }

## Field Documentation

ExCGizmoRectangle m_BoxPvs

| Definition at line 57 of file ExCEntite.h. Referenced by BuildPvsBox().

GLuint m_GlListId`[protected]`

| Definition at line 49 of file ExCEntite.h. Referenced by Draw(), ExCComposed::Draw(), MakeList(), and ExCComposed::MakeList().

std::vector<ExCMesh>::iterator m_ItVecMesh`[protected]`

| Definition at line 44 of file ExCEntite.h. Referenced by DrawWithoutList().

std::vector<ExCVertex>::iterator m_ItVecVertex`[protected]`

| Definition at line 42 of file ExCEntite.h. Referenced by BuildPvsBox(), and DrawWithoutList().

long m_NumberMesh`[protected]`

| Definition at line 47 of file ExCEntite.h. Referenced by GetRenderMode(), and LoadAsc().

long m_NumberVertex`[protected]`

| Definition at line 46 of file ExCEntite.h. Referenced by GetNumberMesh(), LoadAsc(), and SetNumberMesh().

int m_RenderMode`[protected]`

| Definition at line 48 of file ExCEntite.h. Referenced by ExCComposed::ExCComposed(), ExCEntite(), GetGlListId(), and SetRenderMode().

std::vector<ExCMesh> m_VecMesh`[protected]`

| Definition at line 43 of file ExCEntite.h. Referenced by AddMesh(), DrawWithoutList(), and LoadAsc().

std::vector<ExCVertex> m_VecVertex`[protected]`

| Definition at line 41 of file ExCEntite.h. Referenced by AddVertex(), BuildPvsBox(), DrawWithoutList(), GetVertex(), and LoadAsc().

ExManagerTexture* ManagerTexture`[protected]`

| Definition at line 40 of file ExCEntite.h. Referenced by DrawWithoutList(), ExCComposed::LoadAsc(), and ExCComposed::SetManagerTexture().

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

- ExCEntite.h
- ExCEntite.cpp