#include <ExCModel3DS.h>
Inheritance diagram for ExCModel3DS:

Public Methods | |
| ExCModel3DS (void) | |
| ~ExCModel3DS (void) | |
| void | Draw (void) |
| bool | Load (std::string FileName) |
Protected Methods | |
| void | ReadObjectInfo (tChunk *chunk) |
| void | ReadObject (tChunk *chunk) |
| void | ReadObjectMaterial (tChunk *chunk) |
| void | ReadChunk (tChunk *chunk) |
| void | Skip (tChunk *chunk) |
| void | ReadVertices (t3DObject *pObject, tChunk *chunk) |
| void | ReadFace (t3DObject *pObject, tChunk *chunk) |
| void | ReadUVCoordinates (t3DObject *pObject, tChunk *chunk) |
| void | ReadObjectMaterial (t3DObject *pObject, tChunk *chunk) |
| void | BuildList (int Rendu) |
| void | BuildArray (int Rendu) |
Protected Attributes | |
| FILE * | m_filePtr |
| int | numOfObjects |
| int | numOfMaterials |
| std::vector< tMaterialInfo > | m_VecMaterials |
| std::vector< t3DObject > | m_VecObject |
| tChunk * | m_CurrentChunk |
| tChunk * | m_TempChunk |
| GLuint | m_ListId |
| float * | m_VertexArray |
| unsigned int * | m_FaceArray |
| float * | m_TextureArray |
|
|
Definition at line 26 of file ExCModel3DS.cpp. References ExCModel3DS(), Guard, and m_ListId. Referenced by ExCModel3DS(), and ~ExCModel3DS().
00027 {
00028 Guard(ExCModel3DS::ExCModel3DS(void))
00029 m_ListId=-1;
00030 UnGuard
00031 }
|
|
|
Definition at line 33 of file ExCModel3DS.cpp. References ExCModel3DS(), and Guard.
00034 {
00035 Guard(ExCModel3DS::~ExCModel3DS(void))
00036 UnGuard
00037 }
|
|
|
Definition at line 38 of file ExCModel3DS.cpp. References BuildArray(), Guard, m_FaceArray, m_TextureArray, m_VecObject, and m_VertexArray. Referenced by BuildArray(), and Load().
00039 {
00040 Guard(void ExCModel3DS::BuildArray(int Rendu))
00041 //std::cout<<"Build array"<<std::endl;
00042 //1 how many vertex and face
00043 int HowManyVertex =0;
00044 int HowManyFace =0;
00045 int HowManyText =0;
00046 for(unsigned int i=0;i<m_VecObject.size();i++)//all objects
00047 {
00048 HowManyVertex+=m_VecObject.at(i).Verts.size();;
00049 HowManyFace+=m_VecObject.at(i).Faces.size();
00050 HowManyText+=m_VecObject.at(i).TexVerts.size();;
00051 }
00052 m_VertexArray=new float[HowManyVertex*3];
00053 m_FaceArray=new unsigned int[HowManyFace*3];
00054 m_TextureArray= new float[HowManyText*2];
00055 //std::cout<<"Vertex:"<<HowManyVertex<<" Faces:"<<HowManyFace<<" Texture UV:"<<HowManyText<<std::endl;
00056
00057 unsigned int CmptFaces=0;
00058 for(unsigned int i=0;i<m_VecObject.size();i++)//draw all objects
00059 {
00060 for(unsigned int j=0;j<m_VecObject.at(i).Faces.size();j++)//draw all face
00061 {
00062 m_FaceArray[j+i]=m_VecObject.at(i).Faces.at(j).vertIndex[0];
00063 m_FaceArray[j+i+1]=m_VecObject.at(i).Faces.at(j).vertIndex[1];
00064 m_FaceArray[j+i+2]=m_VecObject.at(i).Faces.at(j).vertIndex[2];
00065 //----------------
00066 //Texture coord
00067 //----------------
00068 /* m_TextureArray[j+i]=m_VecObject.at(i).TexVerts.at(VecFace.GetX()).GetX();
00069 m_TextureArray[j+i+1]=m_VecObject.at(i).TexVerts.at(VecFace.GetX()).GetY();
00070
00071 m_TextureArray[j+i+2]=m_VecObject.at(i).TexVerts.at(VecFace.GetY()).GetX();
00072 m_TextureArray[j+i+3]=m_VecObject.at(i).TexVerts.at(VecFace.GetY()).GetY();
00073
00074 m_TextureArray[j+i+4]=m_VecObject.at(i).TexVerts.at(VecFace.GetZ()).GetX();
00075 m_TextureArray[j+i+5]=m_VecObject.at(i).TexVerts.at(VecFace.GetZ()).GetY();
00076
00077 //----------------
00078 //Vertex coord
00079 //----------------
00080
00081 m_VertexArray[j+i]=m_VecObject.at(i).Verts.at(VecFace.GetX()).GetX();
00082 m_VertexArray[j+i]=m_VecObject.at(i).Verts.at(VecFace.GetX()).GetY();
00083 m_VertexArray[j+i]=m_VecObject.at(i).Verts.at(VecFace.GetX()).GetZ();
00084
00085 m_VertexArray[j+i]=m_VecObject.at(i).Verts.at(VecFace.GetY()).GetX();
00086 m_VertexArray[j+i]=m_VecObject.at(i).Verts.at(VecFace.GetY()).GetY();
00087 m_VertexArray[j+i]=m_VecObject.at(i).Verts.at(VecFace.GetY()).GetZ();
00088
00089 m_VertexArray[j+i]=m_VecObject.at(i).Verts.at(VecFace.GetZ()).GetX();
00090 m_VertexArray[j+i]=m_VecObject.at(i).Verts.at(VecFace.GetZ()).GetY();
00091 m_VertexArray[j+i]=m_VecObject.at(i).Verts.at(VecFace.GetZ()).GetZ();
00092
00093 ManagerTexture->SetCurrentObject(m_VecObject.at(i).Material);*/
00094 }
00095 }
00096 glEnableClientState(GL_VERTEX_ARRAY);
00097 glEnableClientState(GL_TEXTURE_COORD_ARRAY);
00098 glVertexPointer(3, GL_FLOAT,0,m_VertexArray);
00099 glTexCoordPointer(2,GL_FLOAT,0,m_TextureArray);
00100
00101
00102 UnGuard
00103 }
|
|
|
Definition at line 124 of file ExCModel3DS.cpp. References BuildList(), ExCVec2D::GetX(), ExCVec3D::GetX(), ExCVec2D::GetY(), ExCVec3D::GetY(), ExCVec3D::GetZ(), Guard, m_ListId, m_VecObject, ExCVec3D::m_Vector, ExCModel::ManagerTexture, ExManagerTexture::SetCurrentObject(), ExCVec2D::SetX(), ExCVec3D::SetX(), ExCVec2D::SetY(), ExCVec3D::SetY(), and ExCVec3D::SetZ(). Referenced by BuildList(), and Draw().
00125 {
00126 Guard(void ExCModel3DS::BuildList(int Rendu))
00127 glDeleteLists(m_ListId,1); //delete old list
00128 m_ListId=glGenLists(1); //Ask for a new free list
00129 glNewList(m_ListId,GL_COMPILE);
00130 glPushAttrib(GL_ALL_ATTRIB_BITS);
00131 //---------------------------------------------------
00132 ExCVec3D VecAB,VecBC,VecCA,VecFace;
00133 ExCVec3D VecX,VecY,VecZ;
00134 ExCVec2D VecTAB,VecTBC,VecTCA;
00135 glPushMatrix();
00136 //ExCModel::Draw();
00137 glDisable(GL_LIGHTING);
00138 for(unsigned int i=0;i<m_VecObject.size();i++)//draw all objects
00139 {
00140 for(unsigned int j=0;j<m_VecObject.at(i).Faces.size();j++)//draw all objects
00141 {
00142 VecFace.SetX(m_VecObject.at(i).Faces.at(j).vertIndex[0]);
00143 VecFace.SetY(m_VecObject.at(i).Faces.at(j).vertIndex[1]);
00144 VecFace.SetZ(m_VecObject.at(i).Faces.at(j).vertIndex[2]);
00145 //----------------
00146 //Texture coord
00147 //----------------
00148 VecTAB.SetX(m_VecObject.at(i).TexVerts.at(VecFace.GetX()).GetX());
00149 VecTAB.SetY(m_VecObject.at(i).TexVerts.at(VecFace.GetX()).GetY());
00150
00151 VecTBC.SetX(m_VecObject.at(i).TexVerts.at(VecFace.GetY()).GetX());
00152 VecTBC.SetY(m_VecObject.at(i).TexVerts.at(VecFace.GetY()).GetY());
00153
00154 VecTCA.SetX(m_VecObject.at(i).TexVerts.at(VecFace.GetZ()).GetX());
00155 VecTCA.SetY(m_VecObject.at(i).TexVerts.at(VecFace.GetZ()).GetY());
00156
00157 //----------------
00158 //Vertex coord
00159 //----------------
00160
00161 VecX.SetX(m_VecObject.at(i).Verts.at(VecFace.GetX()).GetX());
00162 VecX.SetY(m_VecObject.at(i).Verts.at(VecFace.GetX()).GetY());
00163 VecX.SetZ(m_VecObject.at(i).Verts.at(VecFace.GetX()).GetZ());
00164
00165 VecY.SetX(m_VecObject.at(i).Verts.at(VecFace.GetY()).GetX());
00166 VecY.SetY(m_VecObject.at(i).Verts.at(VecFace.GetY()).GetY());
00167 VecY.SetZ(m_VecObject.at(i).Verts.at(VecFace.GetY()).GetZ());
00168
00169 VecZ.SetX(m_VecObject.at(i).Verts.at(VecFace.GetZ()).GetX());
00170 VecZ.SetY(m_VecObject.at(i).Verts.at(VecFace.GetZ()).GetY());
00171 VecZ.SetZ(m_VecObject.at(i).Verts.at(VecFace.GetZ()).GetZ());
00172
00174
00175 ManagerTexture->SetCurrentObject(m_VecObject.at(i).Material);
00176
00178
00179 glColor3f(1.0f,1.0f,1.0f);
00180 glEnable(GL_TEXTURE_2D);
00181 glBegin(GL_TRIANGLES);
00182 glTexCoord2f(VecTAB.GetX(),VecTAB.GetY());
00183 glVertex3fv(VecX.m_Vector);
00184 glTexCoord2f(VecTBC.GetX(),VecTBC.GetY());
00185 glVertex3fv(VecY.m_Vector);
00186 glTexCoord2f(VecTCA.GetX(),VecTCA.GetY());
00187 glVertex3fv(VecZ.m_Vector);
00188 glEnd();
00189 glDisable(GL_TEXTURE_2D);
00190 }
00191 }
00192 glPopMatrix();
00193 //---------------------------------------------------
00194 glPopAttrib();
00195 glEndList();
00196 UnGuard
00197 }
|
|
|
Reimplemented from ExCModel. Definition at line 105 of file ExCModel3DS.cpp. References BuildList(), ExCModel::Draw(), Draw(), Guard, and m_ListId. Referenced by Draw().
00106 {
00107 Guard(void ExCModel3DS::Draw(void))
00108 glPushMatrix();
00109 glDisable(GL_LIGHTING);
00110 ExCModel::Draw();
00111 if(m_ListId==-1){
00112 BuildList(RENDER_TEXTURES);
00113 //std::cout<<"build 3ds list"<<std::endl;
00114 }
00115 glCallList(m_ListId);
00116 //glDrawElements(GL_TRIANGLES,,GL_UNSIGNED_INT,m_FaceArray);
00117 glEnable(GL_LIGHTING);
00118 glPopMatrix();
00120
00121 UnGuard
00122 }
|
|
|
Definition at line 201 of file ExCModel3DS.cpp. References BuildArray(), tChunk::bytesRead, EDITKEYFRAME, FILEVERSION, Guard, tChunk::ID, tChunk::length, Load(), m_CurrentChunk, m_filePtr, OBJECTINFO, PRIMARY, ReadChunk(), ReadObjectInfo(), Skip(), and version. Referenced by Load(), and ExManagerModel::Load3DS().
00202 {
00203 Guard(bool ExCModel3DS::Load(std::string FileName))
00204 unsigned int version=0;
00205 int buffer[50000] = {0};
00206 char bufferc[255];memset(bufferc,0,255);
00207 //std::cout<<FileName<<std::endl;
00208
00209 m_filePtr = fopen(FileName.data(), "rb");
00210 if (m_filePtr == NULL)
00211 {
00212 throw ExCExpFileNotFound();
00213 return false;
00214 }
00215 tChunk *chunk;
00216 chunk = new tChunk;
00217 ReadChunk(chunk);
00218 //------------------------------------------------------------------------------
00219 if(chunk->ID==PRIMARY)
00220 {
00221 //std::cout<<"Primary chunk file lenght:"<<chunk->length<<std::endl;
00222 m_CurrentChunk = new tChunk;
00223 while (chunk->bytesRead < chunk->length)
00224 {
00225 ReadChunk(m_CurrentChunk);
00226 switch(m_CurrentChunk->ID)
00227 {
00228 case FILEVERSION:
00229 m_CurrentChunk->bytesRead += fread(&version, 1,m_CurrentChunk->length - m_CurrentChunk->bytesRead, m_filePtr);
00230 //std::cout<<"Read FILEVERSION :"<<version<<std::endl;
00231 break;
00232 case OBJECTINFO:
00233 //std::cout<<"Read OBJECTINFO"<<std::endl;
00234 ReadObjectInfo(m_CurrentChunk);
00235 break;
00236 case EDITKEYFRAME:
00237 //std::cout<<"Read EDITKEYFRAME"<<std::endl;
00238 Skip(m_CurrentChunk);
00239 break;
00240 default:
00241 //std::cout<<"Skip unused ,Chunk ID:"<<std::hex<<m_CurrentChunk->ID<<" Chunk Lenght:"<<std::dec<<m_CurrentChunk->length<<std::endl;
00242 Skip(m_CurrentChunk);
00243 break;
00244 }
00245 chunk->bytesRead += m_CurrentChunk->bytesRead;
00246 }
00247 delete m_CurrentChunk;
00248 m_CurrentChunk = chunk;
00249 }//end of if(chunk->ID==PRIMARY)
00250 //------------------------------------------------------------------------------
00251 fclose(m_filePtr);
00252 BuildArray(0);
00253 return true;
00254 UnGuard
00255 }
|
|
|
Definition at line 476 of file ExCModel3DS.cpp. References tChunk::bytesRead, Guard, tChunk::ID, tChunk::length, and m_filePtr. Referenced by Load(), ReadFace(), ReadObject(), ReadObjectInfo(), and ReadObjectMaterial().
|
|
||||||||||||
|
Definition at line 523 of file ExCModel3DS.cpp. References tChunk::bytesRead, t3DObject::Faces, Guard, tChunk::ID, tChunk::length, ExManagerTexture::Load(), m_CurrentChunk, m_filePtr, ExCModel::ManagerTexture, t3DObject::Material, t3DObject::numOfFaces, OBJECT_MATERIAL, OBJECT_SMOOTH_GROUP, ReadChunk(), ReadFace(), Skip(), and tFace::vertIndex. Referenced by ReadFace(), and ReadObject().
00524 {
00525 Guard(void ExCModel3DS::ReadFace(t3DObject *pObject,tChunk *chunk))
00526 int buffer[50000] = {0};
00527 // Read in the number of vertices (int)
00528 tFace stFace;
00529 unsigned short face,index;
00530 chunk->bytesRead += fread(&face, 1,sizeof(unsigned short), m_filePtr);
00531 pObject->numOfFaces=face;
00533
00534 // Go through all of the faces in this object
00535 for(int i = 0; i <face; i++)
00536 {
00537 // Next, we read in the A then B then C index for the face, but ignore the 4th value.
00538 // The fourth value is a visibility flag for 3D Studio Max, we don't care about this.
00539 for(int j = 0; j < 4; j++)
00540 {
00541 // Read the first vertice index for the current face
00542 chunk->bytesRead += fread(&index, 1, sizeof(unsigned short), m_filePtr);
00543
00544 if(j < 3)
00545 {
00546 // Store the index in our face structure.
00547 //pObject->pFaces[i].vertIndex[j] = index;
00548 stFace.vertIndex[j]=index;
00549 }
00550 }
00552 pObject->Faces.push_back(stFace);
00553 }
00554 char b=0;
00555 std::string Material;
00556 m_CurrentChunk = new tChunk;
00557 while (chunk->bytesRead < chunk->length)
00558 {
00559 ReadChunk(m_CurrentChunk);
00560 switch(m_CurrentChunk->ID)
00561 {
00562 case OBJECT_MATERIAL:
00563 //std::cout<<" Read object face OBJECT_MATERIAL"<<std::endl;
00564 do
00565 {
00566 m_CurrentChunk->bytesRead += fread(&b, 1, sizeof(char), m_filePtr);
00567 if(b!=0)Material=Material+b;
00568 }while(b!=0);
00570 pObject->Material=Material;
00571 //std::cout<<"#"<<Material<<"#"<<std::endl;
00572 ManagerTexture->Load(Material);
00573 Skip(m_CurrentChunk);
00574 break;
00575 case OBJECT_SMOOTH_GROUP:
00576 //std::cout<<" Read object face OBJECT_SMOOTH_GROUP"<<std::endl;
00577 Skip(m_CurrentChunk);
00578 break;
00579 default:
00580 //std::cout<<" Skip unused ,Chunk ID:"<<std::hex<<m_CurrentChunk->ID<<" Chunk Lenght:"<<std::dec<<m_CurrentChunk->length<<std::endl;
00581 Skip(m_CurrentChunk);
00582 break;
00583 }
00584 chunk->bytesRead += m_CurrentChunk->bytesRead;
00585 }
00586 delete m_CurrentChunk;
00587 m_CurrentChunk = chunk;
00588
00589
00590
00591 UnGuard
00592 }
|
|
|
Definition at line 306 of file ExCModel3DS.cpp. References tChunk::bytesRead, Guard, tChunk::ID, tChunk::length, m_CurrentChunk, m_VecObject, OBJECT_FACES, OBJECT_MATERIAL, OBJECT_MESH, OBJECT_MESH_MATRIX, OBJECT_UV, OBJECT_VERTICES, ReadChunk(), ReadFace(), ReadObject(), ReadObjectMaterial(), ReadUVCoordinates(), ReadVertices(), and Skip(). Referenced by ReadObject(), and ReadObjectInfo().
00307 {
00308 Guard(void ExCModel3DS::ReadObject(tChunk *chunk))
00309 int buffer[50000] = {0};
00310 t3DObject *pObject;
00311 pObject = new t3DObject;
00312 m_CurrentChunk = new tChunk;
00313 while (chunk->bytesRead < chunk->length)
00314 {
00315 ReadChunk(m_CurrentChunk);
00316 switch(m_CurrentChunk->ID)
00317 {
00318 case OBJECT_MESH:
00319 //std::cout<<" Read object OBJECT_MESH"<<std::endl;
00320 ReadObject(m_CurrentChunk);
00321 break;
00322 case OBJECT_VERTICES:
00323 //std::cout<<" Read object OBJECT_VERTICES"<<std::endl;
00324 //Skip(m_CurrentChunk);
00325 ReadVertices(pObject,m_CurrentChunk);
00326 break;
00327 case OBJECT_FACES:
00328 //std::cout<<" Read object OBJECT_FACES"<<std::endl;
00329 ReadFace(pObject,m_CurrentChunk);
00330 break;
00331 case OBJECT_MATERIAL:
00332 //std::cout<<" Read object OBJECT_MATERIAL"<<std::endl;
00333 ReadObjectMaterial(pObject,m_CurrentChunk);
00334 break;
00335 case OBJECT_UV:
00336 //std::cout<<" Read object OBJECT_UV"<<std::endl;
00337 ReadUVCoordinates(pObject,m_CurrentChunk);
00338 break;
00339 case OBJECT_MESH_MATRIX:
00340 //std::cout<<" Read object OBJECT_MESH_MATRIX"<<std::endl;
00341 Skip(m_CurrentChunk);
00342 break;
00343 default:
00344 //std::cout<<" Skip unused ,Chunk ID:"<<std::hex<<m_CurrentChunk->ID<<" Chunk Lenght:"<<std::dec<<m_CurrentChunk->length<<std::endl;
00345 Skip(m_CurrentChunk);
00346 break;
00347 }
00348 chunk->bytesRead += m_CurrentChunk->bytesRead;
00349 }
00350
00351 m_VecObject.push_back(*pObject);
00352 delete m_CurrentChunk;
00353 m_CurrentChunk = chunk;
00354 UnGuard
00355 }
|
|
|
Definition at line 257 of file ExCModel3DS.cpp. References tChunk::bytesRead, Guard, tChunk::ID, tChunk::length, m_CurrentChunk, m_filePtr, MASTER_SCALE, MATERIAL, MESH_VERSION, OBJECT, ReadChunk(), ReadObject(), ReadObjectInfo(), ReadObjectMaterial(), and Skip(). Referenced by Load(), and ReadObjectInfo().
00258 {
00259 Guard(void ExCModel3DS::ReadObjectInfo(tChunk *chunk))
00260 int buffer[50000] = {0};
00261 char bufferc[255],b;
00262 std::string BuffObject;
00263 m_CurrentChunk = new tChunk;
00264 while (chunk->bytesRead < chunk->length)
00265 {
00266 ReadChunk(m_CurrentChunk);
00267 switch(m_CurrentChunk->ID)
00268 {
00269 case MATERIAL:
00270 //std::cout<<" Read MATERIAL"<<std::endl;
00271 ReadObjectMaterial(m_CurrentChunk);
00272 break;
00273 case OBJECT:
00274 memset(bufferc,0,255);
00275 //m_CurrentChunk->bytesRead += 8;
00276 //m_CurrentChunk->bytesRead += fread(&bufferc, 1,8, m_filePtr);
00278 BuffObject.erase(BuffObject.begin(),BuffObject.end());
00279 do
00280 {
00281 m_CurrentChunk->bytesRead += fread(&b, 1, sizeof(char), m_filePtr);
00282 if(b!=0)BuffObject=BuffObject+b;
00283 }while(b!=0);
00284 //std::cout<<" Read OBJECT :"<<BuffObject<<std::endl;
00285 ReadObject(m_CurrentChunk);
00286 break;
00287 case MESH_VERSION:
00288 //std::cout<<" Read MESH_VERSION"<<std::endl;
00289 Skip(m_CurrentChunk);
00290 break;
00291 case MASTER_SCALE:
00292 //std::cout<<" Read MASTER_SCALE"<<std::endl;
00293 Skip(m_CurrentChunk);
00294 break;
00295 default:
00296 //std::cout<<" Skip unused ,Chunk ID:"<<std::hex<<m_CurrentChunk->ID<<" Chunk Lenght:"<<std::dec<<m_CurrentChunk->length<<std::endl;
00297 Skip(m_CurrentChunk);
00298 break;
00299 }
00300 chunk->bytesRead += m_CurrentChunk->bytesRead;
00301 }
00302 delete m_CurrentChunk;
00303 m_CurrentChunk = chunk;
00304 UnGuard
00305 }
|
|
||||||||||||
|
Definition at line 618 of file ExCModel3DS.cpp. References tChunk::bytesRead, Guard, m_filePtr, ReadObjectMaterial(), and Skip().
00619 {
00620 Guard(void ExCModel3DS::ReadObjectMaterial(tChunk *chunk))
00621 char b=0;
00622 std::string Material;
00623 do
00624 {
00625 chunk->bytesRead += fread(&b, 1, sizeof(char), m_filePtr);
00626 Material=Material+b;
00627 }while(b!=0);
00628 //std::cout<<Material<<std::endl;
00629 Skip(chunk);
00630 UnGuard
00631 } |
|
|
Definition at line 357 of file ExCModel3DS.cpp. References tChunk::bytesRead, Guard, tChunk::ID, tChunk::length, m_CurrentChunk, m_filePtr, MAT3DWIRETHICKNESS, MATAMBIENTCOLOR, MATDIFFUSE, MATFACEMAP, MATMAP, MATMAPFILE, MATMAPFILTERINGBLUR, MATMAPOPTION, MATNAME, MATREFLECTBLUR, MATSELFILUM, MATSHININESS, MATSHININESSSTR, MATSOFTEN, MATSPECULAR, MATTRANSFALLOFF, MATTRANSFALLOFFIN, MATTRANSPARENCY, MATTRANSPARENCYADD, MATTWOSIDED, MATTYPE, MATWIREON, MATWIRETHICKNESS, ReadChunk(), ReadObjectMaterial(), and Skip(). Referenced by ReadObject(), ReadObjectInfo(), and ReadObjectMaterial().
00358 {
00359 Guard(void ExCModel3DS::ReadObjectMaterial(tChunk *chunk))
00360 int buffer[50000] = {0};
00361 char bufferc[255];
00362 m_CurrentChunk = new tChunk;
00363 while (chunk->bytesRead < chunk->length)
00364 {
00365 ReadChunk(m_CurrentChunk);
00366 switch(m_CurrentChunk->ID)
00367 {
00368 case MATNAME:
00369 memset(bufferc,0,255);
00370 m_CurrentChunk->bytesRead += fread(bufferc, 1, m_CurrentChunk->length - m_CurrentChunk->bytesRead, m_filePtr);
00371 //std::cout<<" Read MATNAME:"<<bufferc<<std::endl;
00372 break;
00373 case MATAMBIENTCOLOR:
00374 //std::cout<<" Read MATAMBIENTCOLOR"<<std::endl;
00375 Skip(m_CurrentChunk);
00376 break;
00377 case MATDIFFUSE:
00378 //std::cout<<" Read MATDIFFUSE"<<std::endl;
00379 Skip(m_CurrentChunk);
00380 break;
00381 case MATSPECULAR:
00382 //std::cout<<" Read MATSPECULAR"<<std::endl;
00383 Skip(m_CurrentChunk);
00384 break;
00385 case MATSHININESS:
00386 //std::cout<<" Read MATSHININESS"<<std::endl;
00387 Skip(m_CurrentChunk);
00388 break;
00389 case MATSHININESSSTR:
00390 //std::cout<<" Read MATSHININESSSTR"<<std::endl;
00391 Skip(m_CurrentChunk);
00392 break;
00393 case MATTRANSPARENCY:
00394 //std::cout<<" Read MATTRANSPARENCY"<<std::endl;
00395 Skip(m_CurrentChunk);
00396 break;
00397 case MATTRANSFALLOFF:
00398 //std::cout<<" Read MATTRANSFALLOFF"<<std::endl;
00399 Skip(m_CurrentChunk);
00400 break;
00401 case MATREFLECTBLUR:
00402 //std::cout<<" Read MATREFLECTBLUR"<<std::endl;
00403 Skip(m_CurrentChunk);
00404 break;
00405 case MATTWOSIDED:
00406 //std::cout<<" Read MATTWOSIDED"<<std::endl;
00407 Skip(m_CurrentChunk);
00408 break;
00409 case MATTRANSPARENCYADD:
00410 //std::cout<<" Read MATTRANSPARENCYADD"<<std::endl;
00411 Skip(m_CurrentChunk);
00412 break;
00413 case MATSELFILUM:
00414 //std::cout<<" Read MATSELFILUM"<<std::endl;
00415 Skip(m_CurrentChunk);
00416 break;
00417 case MATWIREON:
00418 //std::cout<<" Read MATWIREON"<<std::endl;
00419 Skip(m_CurrentChunk);
00420 break;
00421 case MATWIRETHICKNESS:
00422 //std::cout<<" Read MATWIRETHICKNESS"<<std::endl;
00423 Skip(m_CurrentChunk);
00424 break;
00425 case MATFACEMAP:
00426 //std::cout<<" Read MATFACEMAP"<<std::endl;
00427 Skip(m_CurrentChunk);
00428 break;
00429 case MATTRANSFALLOFFIN:
00430 //std::cout<<" Read MATTRANSFALLOFFIN"<<std::endl;
00431 Skip(m_CurrentChunk);
00432 break;
00433 case MATSOFTEN:
00434 //std::cout<<" Read MATSOFTEN"<<std::endl;
00435 Skip(m_CurrentChunk);
00436 break;
00437 case MAT3DWIRETHICKNESS:
00438 //std::cout<<" Read MAT3DWIRETHICKNESS"<<std::endl;
00439 Skip(m_CurrentChunk);
00440 break;
00441 case MATTYPE: // This is the header for the texture info
00442 //std::cout<<" Read MATTYPE"<<std::endl;
00443 Skip(m_CurrentChunk);
00444 break;
00445 case MATMAP: // This is the header for the texture info
00446 //std::cout<<" Read MATMAP"<<std::endl;
00447 ReadObjectMaterial(m_CurrentChunk);
00448 break;
00449 case MATMAPFILE:
00450 //std::cout<<" Read MATMAPFILE"<<std::endl;
00451 Skip(m_CurrentChunk);
00452 break;
00453 case MATMAPOPTION:
00454 //std::cout<<" Read MATMAPOPTION"<<std::endl;
00455 Skip(m_CurrentChunk);
00456 break;
00457 case MATMAPFILTERINGBLUR:
00458 //std::cout<<" Read MATMAPFILTERINGBLUR"<<std::endl;
00459 //Skip(m_CurrentChunk);
00460 Skip(m_CurrentChunk);
00461 break;
00462 default:
00463 //std::cout<<" Skip unused ,Chunk ID:"<<std::hex<<m_CurrentChunk->ID<<" Chunk Lenght:"<<std::dec<<m_CurrentChunk->length<<std::endl;
00464 Skip(m_CurrentChunk);
00465 break;
00466 }
00467 chunk->bytesRead += m_CurrentChunk->bytesRead;
00468 }
00469 delete m_CurrentChunk;
00470 m_CurrentChunk = chunk;
00471 UnGuard
00472 }
|
|
||||||||||||
|
Definition at line 594 of file ExCModel3DS.cpp. References tChunk::bytesRead, Guard, m_filePtr, t3DObject::numTexVertex, ReadUVCoordinates(), ExCVec2D::SetX(), ExCVec2D::SetY(), Skip(), and t3DObject::TexVerts. Referenced by ReadObject(), and ReadUVCoordinates().
00595 {
00596 Guard(void ExCModel3DS::ReadUVCoordinates(t3DObject *pObject,tChunk *chunk))
00597 int buffer[50000] = {0};
00598 // Read in the number of vertices (int)
00599 unsigned short vert;
00600 chunk->bytesRead += fread(&vert, 1,sizeof(unsigned short), m_filePtr);
00601 pObject->numTexVertex=vert;
00603 float fl;
00604 ExCVec2D vec;
00605 for(int i=0;i<vert;i++)
00606 {
00607 chunk->bytesRead += fread(&fl, 1,sizeof(float), m_filePtr);
00608 vec.SetX(fl);
00609 chunk->bytesRead += fread(&fl, 1,sizeof(float), m_filePtr);
00610 vec.SetY(fl);
00612 pObject->TexVerts.push_back(vec);
00613 }
00614 Skip(chunk);
00615 UnGuard
00616 }
|
|
||||||||||||
|
Definition at line 497 of file ExCModel3DS.cpp. References tChunk::bytesRead, Guard, m_filePtr, t3DObject::numOfVerts, ReadVertices(), ExCVec3D::SetX(), ExCVec3D::SetY(), ExCVec3D::SetZ(), Skip(), and t3DObject::Verts. Referenced by ReadObject(), and ReadVertices().
00498 {
00499 Guard(void ExCModel3DS::ReadVertices(t3DObject *pObject,tChunk *chunk))
00500 int buffer[50000] = {0};
00501 // Read in the number of vertices (int)
00502 unsigned short vert;
00503 chunk->bytesRead += fread(&vert, 1,sizeof(unsigned short), m_filePtr);
00504 pObject->numOfVerts=vert;
00506 float fl;
00507 ExCVec3D vec;
00508 for(int i=0;i<vert;i++)
00509 {
00510 chunk->bytesRead += fread(&fl, 1,sizeof(float), m_filePtr);
00511 vec.SetX(fl);
00512 chunk->bytesRead += fread(&fl, 1,sizeof(float), m_filePtr);
00513 vec.SetY(fl);
00514 chunk->bytesRead += fread(&fl, 1,sizeof(float), m_filePtr);
00515 vec.SetZ(fl);
00517 pObject->Verts.push_back(vec);
00518 }
00519 Skip(chunk);
00520 UnGuard
00521 }
|
|
|
Definition at line 488 of file ExCModel3DS.cpp. References tChunk::bytesRead, Guard, tChunk::length, and m_filePtr. Referenced by Load(), ReadFace(), ReadObject(), ReadObjectInfo(), ReadObjectMaterial(), ReadUVCoordinates(), and ReadVertices().
|
|
|
Definition at line 151 of file ExCModel3DS.h. Referenced by Load(), ReadFace(), ReadObject(), ReadObjectInfo(), and ReadObjectMaterial(). |
|
|
Definition at line 156 of file ExCModel3DS.h. Referenced by BuildArray(). |
|
|
Definition at line 130 of file ExCModel3DS.h. Referenced by Load(), ReadChunk(), ReadFace(), ReadObjectInfo(), ReadObjectMaterial(), ReadUVCoordinates(), ReadVertices(), and Skip(). |
|
|
Definition at line 153 of file ExCModel3DS.h. Referenced by BuildList(), Draw(), and ExCModel3DS(). |
|
|
Definition at line 152 of file ExCModel3DS.h. |
|
|
Definition at line 157 of file ExCModel3DS.h. Referenced by BuildArray(). |
|
|
Definition at line 148 of file ExCModel3DS.h. |
|
|
Definition at line 149 of file ExCModel3DS.h. Referenced by BuildArray(), BuildList(), and ReadObject(). |
|
|
Definition at line 155 of file ExCModel3DS.h. Referenced by BuildArray(). |
|
|
Definition at line 147 of file ExCModel3DS.h. |
|
|
Definition at line 146 of file ExCModel3DS.h. |
1.3-rc1