#include <ExCModelASC.h>
Graphe d'héritage de la classe ExCModelASC
Membres publics | |
ExCModelASC (void) | |
ExCModelASC (std::string FileName) | |
~ExCModelASC (void) | |
void | Draw (void) |
void | ProcessLine (std::string Line) |
bool | LoadFile (std::string FileName) |
Membres protégés | |
void | BuildList (int Rendu) |
Attributs Protégés | |
GLuint | m_ListId |
ExCVec3D | m_AmbiantLight |
int | m_NumberObject |
std::vector< ObjAsc > | m_VecObject |
std::vector< MeshAsc > | m_VecMesh |
|
Définition à la ligne 26 du fichier ExCModelASC.cpp. Références ExCModelASC(), Guard, m_ListId, et m_NumberObject. Référencé par ExCModelASC(), et ~ExCModelASC().
00027 { 00028 Guard(ExCModelASC::ExCModelASC(void)) 00029 m_NumberObject=-1; 00030 m_ListId=-1; 00031 UnGuard 00032 } |
|
Définition à la ligne 34 du fichier ExCModelASC.cpp. Références ExCModelASC(), Guard, LoadFile(), m_ListId, et m_NumberObject.
00035 { 00036 Guard(ExCModelASC::ExCModelASC(std::string FileName)) 00037 m_NumberObject=-1; 00038 m_ListId=-1; 00039 LoadFile(FileName); 00040 UnGuard 00041 } |
|
Définition à la ligne 43 du fichier ExCModelASC.cpp. Références ExCModelASC(), et Guard.
00044 { 00045 Guard(ExCModelASC::~ExCModelASC(void)) 00046 UnGuard 00047 } |
|
Définition à la ligne 146 du fichier ExCModelASC.cpp. Références BuildList(), Guard, m_ListId, m_VecMesh, m_VecObject, ExCModel::ManagerTexture, et ExManagerTexture::SetCurrentObject(). Référencé par BuildList(), et Draw().
00147 { 00148 Guard(void ExCModelASC::BuildList(int Rendu)) 00149 glDeleteLists(m_ListId,1); //delete old list 00150 m_ListId=glGenLists(1); //Ask for a new free list 00151 glNewList(m_ListId,GL_COMPILE); 00152 glPushAttrib(GL_ALL_ATTRIB_BITS); 00153 glEnable(GL_TEXTURE_2D); 00154 for(unsigned int i=0;i<m_VecMesh.size();i++) 00155 { 00156 ManagerTexture->SetCurrentObject(m_VecMesh.at(i).m_Material); 00157 glBegin(GL_TRIANGLES); 00158 glTexCoord2fv(m_VecMesh.at(i).VecTAB.m_Vector);glVertex3fv(m_VecMesh.at(i).VecAB.m_Vector); 00159 glTexCoord2fv(m_VecMesh.at(i).VecTBC.m_Vector);glVertex3fv(m_VecMesh.at(i).VecBC.m_Vector); 00160 glTexCoord2fv(m_VecMesh.at(i).VecTCA.m_Vector);glVertex3fv(m_VecMesh.at(i).VecCA.m_Vector); 00161 glEnd(); 00162 } 00163 glPopAttrib(); 00164 glEndList(); 00165 //delete object data because data are now in list 00166 m_VecMesh.clear(); 00167 m_VecObject.clear(); 00168 UnGuard 00169 } |
|
Redéfinie à partir de ExCModel. Définition à la ligne 49 du fichier ExCModelASC.cpp. Références BuildList(), ExCModel::Draw(), Draw(), Guard, et m_ListId. Référencé par Draw().
00050 { 00051 Guard(void ExCModelASC::Draw(void)) 00052 glPushMatrix(); 00053 glDisable(GL_LIGHTING); 00054 ExCModel::Draw(); 00055 if(m_ListId==-1){ 00056 BuildList(RENDER_TEXTURES); 00057 std::cout<<"build asc list"<<std::endl; 00058 } 00059 glCallList(m_ListId); 00060 glEnable(GL_LIGHTING); 00061 glPopMatrix(); 00062 UnGuard 00063 } |
|
Redéfinie à partir de ExCObject. Définition à la ligne 65 du fichier ExCModelASC.cpp. Références Guard, LoadFile(), MeshAsc::m_Material, m_VecMesh, m_VecObject, ProcessLine(), ExCObject::SetName(), ExCVec2D::SetX(), ExCVec3D::SetX(), ExCVec2D::SetY(), ExCVec3D::SetY(), ExCVec3D::SetZ(), MeshAsc::VecAB, MeshAsc::VecBC, MeshAsc::VecCA, MeshAsc::VecTAB, MeshAsc::VecTBC, et MeshAsc::VecTCA. Référencé par ExCModelASC(), ExManagerModel::LoadASC(), et LoadFile().
00066 { 00067 Guard(bool ExCModelASC::LoadFile(std::string FileName)) 00068 std::ifstream fin; 00069 std::string buffer; 00070 char b[256]; 00071 SetName(ExNihilo::ExtracValueFromSring(FileName,"../Data/Modeles/",".asc")); 00072 fin.open(FileName.data(),std::ios::in); 00073 if(fin.is_open()) 00074 { 00075 try 00076 { 00077 do 00078 { 00079 memset(b,0,255); 00080 fin.getline(b,256,'\n'); 00081 ProcessLine(b); 00082 }while(!fin.eof()); 00083 //build mesh tab 00084 MeshAsc Mesh; 00085 for(unsigned int i =0;i<m_VecObject.size();++i)//draw all object 00086 { 00087 for(unsigned int j =0;j<m_VecObject.at(i).m_VecFace.size();j++)//draw all face 00088 { 00089 Mesh.VecAB.SetX(m_VecObject.at(i).m_VecVertex.at(m_VecObject.at(i).m_VecFace.at(j).GetX()).GetX()); 00090 Mesh.VecAB.SetY(m_VecObject.at(i).m_VecVertex.at(m_VecObject.at(i).m_VecFace.at(j).GetX()).GetY()); 00091 Mesh.VecAB.SetZ(m_VecObject.at(i).m_VecVertex.at(m_VecObject.at(i).m_VecFace.at(j).GetX()).GetZ()); 00092 00093 Mesh.VecBC.SetX(m_VecObject.at(i).m_VecVertex.at(m_VecObject.at(i).m_VecFace.at(j).GetY()).GetX()); 00094 Mesh.VecBC.SetY(m_VecObject.at(i).m_VecVertex.at(m_VecObject.at(i).m_VecFace.at(j).GetY()).GetY()); 00095 Mesh.VecBC.SetZ(m_VecObject.at(i).m_VecVertex.at(m_VecObject.at(i).m_VecFace.at(j).GetY()).GetZ()); 00096 00097 Mesh.VecCA.SetX(m_VecObject.at(i).m_VecVertex.at(m_VecObject.at(i).m_VecFace.at(j).GetZ()).GetX()); 00098 Mesh.VecCA.SetY(m_VecObject.at(i).m_VecVertex.at(m_VecObject.at(i).m_VecFace.at(j).GetZ()).GetY()); 00099 Mesh.VecCA.SetZ(m_VecObject.at(i).m_VecVertex.at(m_VecObject.at(i).m_VecFace.at(j).GetZ()).GetZ()); 00100 00101 Mesh.VecTAB.SetX(m_VecObject.at(i).m_VecTexture.at(m_VecObject.at(i).m_VecFace.at(j).GetX()).GetX()); 00102 Mesh.VecTAB.SetY(m_VecObject.at(i).m_VecTexture.at(m_VecObject.at(i).m_VecFace.at(j).GetX()).GetY()); 00103 00104 Mesh.VecTBC.SetX(m_VecObject.at(i).m_VecTexture.at(m_VecObject.at(i).m_VecFace.at(j).GetY()).GetX()); 00105 Mesh.VecTBC.SetY(m_VecObject.at(i).m_VecTexture.at(m_VecObject.at(i).m_VecFace.at(j).GetY()).GetY()); 00106 00107 Mesh.VecTCA.SetX(m_VecObject.at(i).m_VecTexture.at(m_VecObject.at(i).m_VecFace.at(j).GetZ()).GetX()); 00108 Mesh.VecTCA.SetY(m_VecObject.at(i).m_VecTexture.at(m_VecObject.at(i).m_VecFace.at(j).GetZ()).GetY()); 00109 Mesh.m_Material= m_VecObject.at(i).m_Texture; 00110 m_VecMesh.push_back(Mesh); 00111 } 00112 } 00113 m_VecObject.clear();//now no need object info 00114 return true; 00115 }catch(...){throw ExCExpFileReadError();} 00116 } 00117 throw ExCExpFileNotFound(); 00118 return false; 00119 UnGuard 00120 } |
|
Définition à la ligne 122 du fichier ExCModelASC.cpp. Références data, ExNihilo::ExtracValueFromSring(), Guard, m_AmbiantLight, m_NumberObject, ObjAsc::m_ObjectName, m_VecObject, ProcessLine(), et ExCVec3D::SetValue(). Référencé par LoadFile(), et ProcessLine().
00123 { 00124 Guard(void ExCModelASC::ProcessLine(std::string Line)) 00125 if(Line.find("Ambient light color:")!=std::string::npos){//first line of file 00126 m_AmbiantLight.SetValue(atof(ExNihilo::ExtracValueFromSring(Line,"Red="," ").data()),atof(ExNihilo::ExtracValueFromSring(Line,"Green="," ").data()),atof(ExNihilo::ExtracValueFromSring(Line,"Blue="," ").data())); 00127 }else if(Line.find("Named object: ")!=std::string::npos){//new object 00128 m_NumberObject++; 00129 ObjAsc obj; 00130 obj.m_ObjectName=ExNihilo::ExtracValueFromSring(Line,"Named object: \"","\""); 00131 m_VecObject.push_back(obj); 00132 }else if(Line.find("Face ")!=std::string::npos){//read face info 00133 m_VecObject.at(m_NumberObject).m_VecFace.push_back(ExCVec3D(atof(ExNihilo::ExtracValueFromSring(Line,"A:"," ").data()),atof(ExNihilo::ExtracValueFromSring(Line,"B:"," ").data()),atof(ExNihilo::ExtracValueFromSring(Line,"C:"," ").data()))); 00134 }else if(Line.find("Material: ")!=std::string::npos){//read material 00135 m_VecObject.at(m_NumberObject).m_Texture=ExNihilo::ExtracValueFromSring(Line,"Material: \"","\""); 00136 }else if(Line.find("Smoothing: ")!=std::string::npos){//read smothing 00137 m_VecObject.at(m_NumberObject).m_Smoothing=atof(ExNihilo::ExtracValueFromSring(Line,"Smoothing: ","\n").data()); 00138 }else if(Line.find("Vertex ")!=std::string::npos){//Vertex data 00139 if(Line.find("Vertex list:")!=std::string::npos){return;}//do nothing 00140 m_VecObject.at(m_NumberObject).m_VecVertex.push_back(ExCVec3D(atof(ExNihilo::ExtracValueFromSring(Line,"X:"," ").data()),atof(ExNihilo::ExtracValueFromSring(Line,"Y:"," ").data()),atof(ExNihilo::ExtracValueFromSring(Line,"Z:"," ").data()))); 00141 if(Line.find("U:")!=std::string::npos){m_VecObject.at(m_NumberObject).m_VecTexture.push_back(ExCVec2D(atof(ExNihilo::ExtracValueFromSring(Line,"U:"," ").data()),atof(ExNihilo::ExtracValueFromSring(Line,"V:"," ").data())));} 00142 } 00143 UnGuard 00144 } |
|
Définition à la ligne 59 du fichier ExCModelASC.h. Référencé par ProcessLine(). |
|
Définition à la ligne 58 du fichier ExCModelASC.h. Référencé par BuildList(), Draw(), et ExCModelASC(). |
|
Définition à la ligne 60 du fichier ExCModelASC.h. Référencé par ExCModelASC(), et ProcessLine(). |
|
Définition à la ligne 62 du fichier ExCModelASC.h. Référencé par BuildList(), et LoadFile(). |
|
Définition à la ligne 61 du fichier ExCModelASC.h. Référencé par BuildList(), LoadFile(), et ProcessLine(). |