#include <ExCComposed.h>
Graphe d'héritage de la classe ExCComposed
Membres publics | |
ExCComposed (void) | |
~ExCComposed (void) | |
void | MakeList (void) |
bool | LoadAsc (char *FileName) |
void | SetRenderMode (int RenderMode) |
void | SetManagerTexture (ExManagerTexture *Texture) |
void | Draw (void) |
void | BuildPvsBox (void) |
Attributs Protégés | |
std::vector< ExCEntite > | m_VecEntite |
std::vector< ExCEntite >::iterator | m_ItVecEntite |
|
Définition à la ligne 26 du fichier ExCComposed.cpp. Références ExCEntite::m_RenderMode.
00027 { 00028 m_RenderMode=RENDER_LINES; 00029 } |
|
Définition à la ligne 31 du fichier ExCComposed.cpp.
00032 { 00033 } |
|
Redéfinie à partir de ExCEntite. Définition à la ligne 62 du fichier ExCComposed.cpp. Références m_ItVecEntite, et m_VecEntite. Référencé par LoadAsc().
00063 { 00064 for(m_ItVecEntite=m_VecEntite.begin();m_ItVecEntite!=m_VecEntite.end();m_ItVecEntite++) 00065 { 00066 m_ItVecEntite->BuildPvsBox(); 00067 } 00068 } |
|
Redéfinie à partir de ExCEntite. Définition à la ligne 79 du fichier ExCComposed.cpp. Références GetMatrixFromEuler(), GetQuaternionFromEuler(), ExCVec3D::GetX(), ExCVec3D::GetY(), ExCVec3D::GetZ(), ExCObject3D::m_Acceleration, ExCObject3D::m_AngleX, ExCObject3D::m_AngleY, ExCObject3D::m_AngleZ, ExCObject3D::m_CurrentObject, ExCEntite::m_GlListId, ExCObject3D::m_Gravity, ExCObject3D::m_Life, ExCMatrix4x4::m_Matrix, ExCObject3D::m_Position, ExCObject3D::m_RefreshTime, ExCObject3D::m_ShowInfo, ExCObject3D::m_StartingLife, ExCVec3D::m_Vector, ExCObject3D::m_Velocity, et ExCObject3D::ShowInfo().
00080 { 00081 double tmplife; 00082 ExCVec3D ForceResult; 00083 ExCMatrix4x4 Matr; 00084 ExQuaternion quat; 00085 00086 00087 00088 00089 00090 00091 tmplife=(double)((double)glutGet(GLUT_ELAPSED_TIME)/1000)-m_StartingLife; 00092 if(tmplife-m_Life>=m_RefreshTime) 00093 { 00094 00095 if(m_Acceleration!=0.0f) 00096 { 00097 if(m_Velocity.m_Vector[0]!=0.0f) 00098 { 00099 m_Velocity.m_Vector[0]=m_Velocity.m_Vector[0]+((double)m_Acceleration*((double)(tmplife-m_Life)/1000)); 00100 } 00101 if(m_Velocity.m_Vector[1]!=0.0f) 00102 { 00103 m_Velocity.m_Vector[1]=m_Velocity.m_Vector[1]+((double)m_Acceleration*((double)(tmplife-m_Life)/1000)); 00104 } 00105 if(m_Velocity.m_Vector[2]!=0.0f) 00106 { 00107 m_Velocity.m_Vector[2]=m_Velocity.m_Vector[2]+((double)m_Acceleration*((double)(tmplife-m_Life)/1000)); 00108 } 00109 } 00110 //m_Position=m_Position+m_Velocity-m_Gravity; 00111 quat=GetQuaternionFromEuler(m_AngleX,m_AngleY,m_AngleZ); 00112 //Matr=GetMatrixFromQuaternion(quat); 00113 Matr=GetMatrixFromEuler(m_AngleX,m_AngleY,m_AngleZ); 00114 00115 ForceResult.m_Vector[0]= (Matr.m_Matrix[0]*m_Velocity.m_Vector[0])+ 00116 (Matr.m_Matrix[4]*m_Velocity.m_Vector[1])+ 00117 (Matr.m_Matrix[8]*m_Velocity.m_Vector[2])+ 00118 (Matr.m_Matrix[12]*0.0f); 00119 00120 00121 ForceResult.m_Vector[1]= (Matr.m_Matrix[1]*m_Velocity.m_Vector[0])+ 00122 (Matr.m_Matrix[5]*m_Velocity.m_Vector[1])+ 00123 (Matr.m_Matrix[9]*m_Velocity.m_Vector[2])+ 00124 (Matr.m_Matrix[13]*0.0f); 00125 00126 ForceResult.m_Vector[2]= (Matr.m_Matrix[2]*m_Velocity.m_Vector[0])+ 00127 (Matr.m_Matrix[6]*m_Velocity.m_Vector[1])+ 00128 (Matr.m_Matrix[10]*m_Velocity.m_Vector[2])+ 00129 (Matr.m_Matrix[14]*0.0f); 00130 00131 00132 //std::cout<<quat<<std::endl; 00133 //std::cout<<Matr<<std::endl; 00134 //std::cout<<m_Velocity<<std::endl; 00135 m_Position=m_Position+m_Velocity-m_Gravity+ForceResult; 00136 //m_Position=m_Position-m_Gravity+ForceResult; 00137 00138 m_Life=(double)((double)glutGet(GLUT_ELAPSED_TIME)/1000)-m_StartingLife; 00139 } 00140 00141 00142 glPushMatrix(); 00143 glTranslatef(m_Position.GetX(),m_Position.GetY(),m_Position.GetZ()); 00144 glRotatef(m_AngleX,1.0f,0.0f,0.0f); 00145 glRotatef(m_AngleY,0.0f,1.0f,0.0f); 00146 glRotatef(-90,0.0f,0.0f,1.0f); 00147 glRotatef(m_AngleZ,0.0f,0.0f,1.0f); 00148 00149 glCallList(m_GlListId); 00150 if(m_ShowInfo && m_CurrentObject)ShowInfo(); 00151 glPopMatrix(); 00152 00153 } |
|
Redéfinie à partir de ExCEntite. Définition à la ligne 155 du fichier ExCComposed.cpp. Références ExCMesh::A, ExManagerTexture::Add(), ExCEntite::AddMesh(), ExCEntite::AddVertex(), ExCMesh::B, BuildPvsBox(), ExCMesh::C, ExCObject::GetName(), ExCEntite::GetNumberMesh(), ExCEntite::GetNumberVertex(), ExCEntite::GetVertex(), Guard, ExCMesh::m_AB, ExCMesh::m_BC, ExCMesh::m_CA, ExCMesh::m_MeshNumber, ExCMesh::m_Smoothing, m_VecEntite, ExCEntite::ManagerTexture, ExCMesh::SetMaterial(), ExCObject::SetName(), ExCEntite::SetNumberMesh(), ExCEntite::SetNumberVertex(), ExCVertex::SetU(), ExCVertex::SetV(), ExCVertex::SetX(), ExCVertex::SetY(), et ExCVertex::SetZ(). Référencé par ExManagerEntite::LoadAsc().
00156 { 00157 Guard(void LoadAsc(char *FileName)) 00158 bool endfile=false; 00159 int FileSize; 00160 int RetVal; 00161 int TmpFilePosition; 00162 int i,j,k; 00163 FILE *MyFile; 00164 std::cout<<"Load File :"<<FileName; 00165 MyFile=fopen (FileName,"r"); 00166 if(!MyFile) 00167 { 00168 return false; 00169 } 00170 fseek(MyFile,0,SEEK_END); 00171 FileSize=ftell(MyFile); 00172 std::cout<<" Size:"<<FileSize<<std::endl; 00173 //Start of file 00174 fseek(MyFile,0,SEEK_SET); 00175 do 00176 { 00177 bool Textured=false; 00178 ExCEntite EntiteBuff; 00179 const char *Name; 00180 char ch; 00181 std::string SName; 00182 std::string SNumber; 00183 ExCVertex VertexBuff; 00184 //------------------ 00185 //Read object name 00186 //------------------ 00187 do 00188 { 00189 RetVal=fread(&ch,sizeof(char),1,MyFile); 00190 }while(ch!=34); 00191 TmpFilePosition=ftell(MyFile);//remember where name start 00192 i=0; 00193 do 00194 { 00195 RetVal=fread(&ch,sizeof(char),1,MyFile);i++; 00196 }while(ch!=34); 00197 fseek(MyFile,TmpFilePosition,SEEK_SET); 00198 for(j=0;j<i-1;j++) 00199 { 00200 RetVal=fread(&ch,sizeof(char),1,MyFile); 00201 SName=SName+ch; 00202 } 00203 Name = SName.data(); 00204 EntiteBuff.SetName(Name); 00205 std::cout<<"Name :"<<EntiteBuff.GetName()<<std::endl; 00206 //----------------------------- 00207 //Read number of vertex en face 00208 //----------------------------- 00209 do 00210 { 00211 RetVal=fread(&ch,sizeof(char),1,MyFile); 00212 }while(ch!=':'); 00213 RetVal=fread(&ch,sizeof(char),1,MyFile);//one more to skip the space 00214 do 00215 { 00216 RetVal=fread(&ch,sizeof(char),1,MyFile); 00217 SNumber=SNumber+ch; 00218 }while(ch!=' '); 00219 EntiteBuff.SetNumberVertex(atol(SNumber.data())); 00220 00221 SNumber.erase(SNumber.begin(),SNumber.end()); 00222 do 00223 { 00224 RetVal=fread(&ch,sizeof(char),1,MyFile); 00225 }while(ch!=':'); 00226 RetVal=fread(&ch,sizeof(char),1,MyFile);//one more to skip the space 00227 do 00228 { 00229 RetVal=fread(&ch,sizeof(char),1,MyFile); 00230 SNumber=SNumber+ch; 00231 }while(ch=='0'||ch=='1'||ch=='2'||ch=='3'||ch=='4'||ch=='5'|| 00232 ch=='6'||ch=='7'||ch=='8'||ch=='9'||ch=='.'||ch=='-'); 00233 EntiteBuff.SetNumberMesh(atol(SNumber.data())); 00234 std::cout<<"Number of Vertex :"<<EntiteBuff.GetNumberVertex()<<" Number of Mesh :"<<EntiteBuff.GetNumberMesh()<<std::endl; 00235 //----------------------------- 00236 //Read vertex 00237 //----------------------------- 00238 for(j=0;j<EntiteBuff.GetNumberVertex();j++) 00239 { 00240 SNumber.erase(SNumber.begin(),SNumber.end()); 00241 do 00242 { 00243 RetVal=fread(&ch,sizeof(char),1,MyFile); 00244 }while(ch!='X'); 00245 RetVal=fread(&ch,sizeof(char),1,MyFile);//one more to skip : 00246 do 00247 { 00248 RetVal=fread(&ch,sizeof(char),1,MyFile); 00249 SNumber=SNumber+ch; 00250 }while(ch=='0'||ch=='1'||ch=='2'||ch=='3'||ch=='4'||ch=='5'|| 00251 ch=='6'||ch=='7'||ch=='8'||ch=='9'||ch=='.'||ch=='-'); 00252 try 00253 { 00254 VertexBuff.SetX(atof(SNumber.data())); 00255 }catch(...) 00256 { 00257 VertexBuff.SetV(0.0f); 00258 std::cout<<"Error on vertex V:"<<j<<std::endl; 00259 } 00260 //------------------------------------------------------------- 00261 SNumber.erase(SNumber.begin(),SNumber.end()); 00262 do 00263 { 00264 RetVal=fread(&ch,sizeof(char),1,MyFile); 00265 }while(ch!='Y'); 00266 RetVal=fread(&ch,sizeof(char),1,MyFile);//one more to skip : 00267 do 00268 { 00269 RetVal=fread(&ch,sizeof(char),1,MyFile); 00270 SNumber=SNumber+ch; 00271 }while(ch=='0'||ch=='1'||ch=='2'||ch=='3'||ch=='4'||ch=='5'|| 00272 ch=='6'||ch=='7'||ch=='8'||ch=='9'||ch=='.'||ch=='-'); 00273 try 00274 { 00275 VertexBuff.SetY(atof(SNumber.data())); 00276 }catch(...) 00277 { 00278 VertexBuff.SetV(0.0f); 00279 std::cout<<"Error on vertex V:"<<j<<std::endl; 00280 } 00281 //------------------------------------------------------------- 00282 SNumber.erase(SNumber.begin(),SNumber.end()); 00283 do 00284 { 00285 RetVal=fread(&ch,sizeof(char),1,MyFile); 00286 }while(ch!='Z'); 00287 RetVal=fread(&ch,sizeof(char),1,MyFile);//one more to skip : 00288 do 00289 { 00290 RetVal=fread(&ch,sizeof(char),1,MyFile); 00291 SNumber=SNumber+ch; 00292 }while(ch=='0'||ch=='1'||ch=='2'||ch=='3'||ch=='4'||ch=='5'|| 00293 ch=='6'||ch=='7'||ch=='8'||ch=='9'||ch=='.'||ch=='-'); 00294 try 00295 { 00296 VertexBuff.SetZ(atof(SNumber.data())); 00297 }catch(...) 00298 { 00299 VertexBuff.SetV(0.0f); 00300 std::cout<<"Error on vertex V:"<<j<<std::endl; 00301 } 00302 //-------------------------------------------------------------- 00303 //VertexBuff.Affich();std::cout<<std::endl; 00304 RetVal=fread(&ch,sizeof(char),1,MyFile); 00305 if(ch==' ')//if object has U and V value 00306 { 00307 Textured=true; 00308 //------------------------------------------------------------- 00309 SNumber.erase(SNumber.begin(),SNumber.end()); 00310 do 00311 { 00312 RetVal=fread(&ch,sizeof(char),1,MyFile); 00313 }while(ch!='U'); 00314 RetVal=fread(&ch,sizeof(char),1,MyFile);//one more to skip : 00315 do 00316 { 00317 RetVal=fread(&ch,sizeof(char),1,MyFile); 00318 SNumber=SNumber+ch; 00319 }while(ch=='0'||ch=='1'||ch=='2'||ch=='3'||ch=='4'||ch=='5'|| 00320 ch=='6'||ch=='7'||ch=='8'||ch=='9'||ch=='.'||ch=='-'); 00321 VertexBuff.SetU(atof(SNumber.data())); 00322 //------------------------------------------------------------- 00323 SNumber.erase(SNumber.begin(),SNumber.end()); 00324 do 00325 { 00326 RetVal=fread(&ch,sizeof(char),1,MyFile); 00327 }while(ch!='V'); 00328 RetVal=fread(&ch,sizeof(char),1,MyFile);//one more to skip : 00329 do 00330 { 00331 RetVal=fread(&ch,sizeof(char),1,MyFile); 00332 SNumber=SNumber+ch; 00333 }while(ch=='0'||ch=='1'||ch=='2'||ch=='3'||ch=='4'||ch=='5'|| 00334 ch=='6'||ch=='7'||ch=='8'||ch=='9'||ch=='.'||ch=='-'); 00335 VertexBuff.SetV(atof(SNumber.data())); 00336 //------------------------------------------------------------- 00337 } 00338 00339 EntiteBuff.AddVertex(VertexBuff); 00340 00341 } 00342 //----------------------------- 00343 //Read face 00344 //----------------------------- 00345 for(j=0;j<EntiteBuff.GetNumberMesh();j++) 00346 { 00347 ExCMesh MeshBuff; 00348 MeshBuff.m_MeshNumber=j; 00349 SNumber.erase(SNumber.begin(),SNumber.end()); 00350 do 00351 { 00352 RetVal=fread(&ch,sizeof(char),1,MyFile); 00353 }while(ch!='A'); 00354 RetVal=fread(&ch,sizeof(char),1,MyFile);//one more to skip : 00355 00356 do 00357 { 00358 RetVal=fread(&ch,sizeof(char),1,MyFile); 00359 SNumber=SNumber+ch; 00360 }while(ch=='0'||ch=='1'||ch=='2'||ch=='3'||ch=='4'||ch=='5'|| 00361 ch=='6'||ch=='7'||ch=='8'||ch=='9'||ch=='.'||ch=='-'); 00362 MeshBuff.A=EntiteBuff.GetVertex(atoi(SNumber.data())); 00363 00364 //------------------------------------------------------------- 00365 SNumber.erase(SNumber.begin(),SNumber.end()); 00366 do 00367 { 00368 RetVal=fread(&ch,sizeof(char),1,MyFile); 00369 }while(ch!='B'); 00370 RetVal=fread(&ch,sizeof(char),1,MyFile);//one more to skip : 00371 do 00372 { 00373 RetVal=fread(&ch,sizeof(char),1,MyFile); 00374 SNumber=SNumber+ch; 00375 }while(ch=='0'||ch=='1'||ch=='2'||ch=='3'||ch=='4'||ch=='5'|| 00376 ch=='6'||ch=='7'||ch=='8'||ch=='9'||ch=='.'||ch=='-'); 00377 MeshBuff.B=EntiteBuff.GetVertex(atoi(SNumber.data())); 00378 //------------------------------------------------------------- 00379 SNumber.erase(SNumber.begin(),SNumber.end()); 00380 do 00381 { 00382 RetVal=fread(&ch,sizeof(char),1,MyFile); 00383 }while(ch!='C'); 00384 RetVal=fread(&ch,sizeof(char),1,MyFile);//one more to skip : 00385 do 00386 { 00387 RetVal=fread(&ch,sizeof(char),1,MyFile); 00388 SNumber=SNumber+ch; 00389 }while(ch=='0'||ch=='1'||ch=='2'||ch=='3'||ch=='4'||ch=='5'|| 00390 ch=='6'||ch=='7'||ch=='8'||ch=='9'||ch=='.'||ch=='-'); 00391 MeshBuff.C=EntiteBuff.GetVertex(atoi(SNumber.data())); 00392 //------------------------------------------------------------ 00393 do 00394 { 00395 RetVal=fread(&ch,sizeof(char),1,MyFile); 00396 }while(ch!='B'); 00397 RetVal=fread(&ch,sizeof(char),1,MyFile);//one more to skip : 00398 SNumber.erase(SNumber.begin(),SNumber.end()); 00399 do 00400 { 00401 RetVal=fread(&ch,sizeof(char),1,MyFile); 00402 SNumber=SNumber+ch; 00403 }while(ch=='0'||ch=='1'||ch=='2'||ch=='3'||ch=='4'||ch=='5'|| 00404 ch=='6'||ch=='7'||ch=='8'||ch=='9'||ch=='.'||ch=='-'); 00405 MeshBuff.m_AB=atoi(SNumber.data()); 00406 do 00407 { 00408 RetVal=fread(&ch,sizeof(char),1,MyFile); 00409 }while(ch!='C'); 00410 RetVal=fread(&ch,sizeof(char),1,MyFile);//one more to skip : 00411 SNumber.erase(SNumber.begin(),SNumber.end()); 00412 do 00413 { 00414 RetVal=fread(&ch,sizeof(char),1,MyFile); 00415 SNumber=SNumber+ch; 00416 }while(ch=='0'||ch=='1'||ch=='2'||ch=='3'||ch=='4'||ch=='5'|| 00417 ch=='6'||ch=='7'||ch=='8'||ch=='9'||ch=='.'||ch=='-'); 00418 MeshBuff.m_BC=atoi(SNumber.data()); 00419 do 00420 { 00421 RetVal=fread(&ch,sizeof(char),1,MyFile); 00422 }while(ch!='A'); 00423 RetVal=fread(&ch,sizeof(char),1,MyFile);//one more to skip : 00424 SNumber.erase(SNumber.begin(),SNumber.end()); 00425 do 00426 { 00427 RetVal=fread(&ch,sizeof(char),1,MyFile); 00428 SNumber=SNumber+ch; 00429 }while(ch=='0'||ch=='1'||ch=='2'||ch=='3'||ch=='4'||ch=='5'|| 00430 ch=='6'||ch=='7'||ch=='8'||ch=='9'||ch=='.'||ch=='-'); 00431 MeshBuff.m_CA=atoi(SNumber.data()); 00432 if(Textured) 00433 { 00434 //----------------------------- 00435 //Read material 00436 //----------------------------- 00437 std::string Material; 00438 do 00439 { 00440 RetVal=fread(&ch,sizeof(char),1,MyFile); 00441 }while(ch!=34); 00442 TmpFilePosition=ftell(MyFile);//remember where name start 00443 i=0; 00444 do 00445 { 00446 RetVal=fread(&ch,sizeof(char),1,MyFile);i++; 00447 }while(ch!=34); 00448 fseek(MyFile,TmpFilePosition,SEEK_SET); 00449 for(k=0;k<i-1;k++) 00450 { 00451 RetVal=fread(&ch,sizeof(char),1,MyFile); 00452 Material=Material+ch; 00453 } 00454 MeshBuff.SetMaterial(Material.data()); 00455 ManagerTexture->Add(Material); 00456 } 00457 //----------------------------- 00458 //Read Smoothing 00459 //----------------------------- 00460 do 00461 { 00462 RetVal=fread(&ch,sizeof(char),1,MyFile); 00463 }while(ch!=':'); 00464 RetVal=fread(&ch,sizeof(char),1,MyFile);//one more to skip espace 00465 SNumber.erase(SNumber.begin(),SNumber.end()); 00466 do 00467 { 00468 RetVal=fread(&ch,sizeof(char),1,MyFile); 00469 SNumber=SNumber+ch; 00470 }while(ch=='0'||ch=='1'||ch=='2'||ch=='3'||ch=='4'||ch=='5'|| 00471 ch=='6'||ch=='7'||ch=='8'||ch=='9'||ch=='.'||ch=='-'); 00472 MeshBuff.m_Smoothing=atoi(SNumber.data()); 00473 00474 EntiteBuff.AddMesh(MeshBuff); 00475 } 00476 //--------------------------- 00477 m_VecEntite.push_back(EntiteBuff); 00478 //----------------- 00479 TmpFilePosition=ftell(MyFile);//where i am? 00480 std::cout<<TmpFilePosition<<std::endl; 00481 if(TmpFilePosition+100>FileSize) 00482 { 00483 endfile=true; 00484 }else 00485 { 00486 endfile=false; 00487 } 00488 }while(!endfile); 00489 00490 00491 fclose(MyFile); 00492 BuildPvsBox(); 00493 return true; 00494 UnGuard 00495 } |
|
Redéfinie à partir de ExCEntite. Définition à la ligne 35 du fichier ExCComposed.cpp. Références Guard, ExCEntite::m_GlListId, m_ItVecEntite, m_VecEntite, et MakeList(). Référencé par MakeList(), et SetRenderMode().
00036 { 00037 Guard(void ExCComposed::MakeList(void)) 00038 //glDeleteLists(m_GlListId,1); //delete old list 00039 m_GlListId=glGenLists(1); //Ask for a new free list 00040 glNewList(m_GlListId,GL_COMPILE); 00041 for(m_ItVecEntite=m_VecEntite.begin();m_ItVecEntite!=m_VecEntite.end();m_ItVecEntite++) 00042 { 00043 m_ItVecEntite->DrawWithoutList(); 00044 //m_ItVecEntite->m_BoxPvs.Draw(); 00045 } 00046 glEndList(); 00047 UnGuard 00048 } |
|
Redéfinie à partir de ExCEntite. Définition à la ligne 70 du fichier ExCComposed.cpp. Références m_ItVecEntite, m_VecEntite, et ExCEntite::ManagerTexture. Référencé par ExManagerEntite::Add(), et ExManagerEntite::LoadAsc().
00071 { 00072 ManagerTexture=Texture; 00073 for(m_ItVecEntite=m_VecEntite.begin();m_ItVecEntite!=m_VecEntite.end();m_ItVecEntite++) 00074 { 00075 m_ItVecEntite->SetManagerTexture(Texture); 00076 } 00077 } |
|
Redéfinie à partir de ExCEntite. Définition à la ligne 50 du fichier ExCComposed.cpp. Références Guard, m_ItVecEntite, m_VecEntite, MakeList(), et SetRenderMode(). Référencé par SetRenderMode().
00051 { 00052 Guard(void ExCComposed::SetRenderMode(int RenderMode)) 00053 for(m_ItVecEntite=m_VecEntite.begin();m_ItVecEntite!=m_VecEntite.end();m_ItVecEntite++) 00054 { 00055 m_ItVecEntite->SetRenderMode(RenderMode); 00056 glDeleteLists(m_ItVecEntite->GetGlListId(),1); 00057 } 00058 MakeList(); 00059 UnGuard 00060 } |
|
Définition à la ligne 39 du fichier ExCComposed.h. Référencé par BuildPvsBox(), MakeList(), SetManagerTexture(), et SetRenderMode(). |
|
Définition à la ligne 38 du fichier ExCComposed.h. Référencé par BuildPvsBox(), LoadAsc(), MakeList(), SetManagerTexture(), et SetRenderMode(). |