Changeset 8418 in orxonox.OLD for branches/bsp_model/src/lib/graphics/importer
- Timestamp:
- Jun 14, 2006, 6:35:58 PM (18 years ago)
- Location:
- branches/bsp_model/src/lib/graphics/importer/md3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/bsp_model/src/lib/graphics/importer/md3/md3_data.cc
r8416 r8418 20 20 #include "md3_tag.h" 21 21 #include "md3_mesh.h" 22 23 #include "material.h" 22 24 23 25 … … 282 284 283 285 286 /** 287 * reading in the mesh triangles 288 */ 284 289 int MD3Data::readMeshTriangles(FILE* pFile, int fileOffset, int mesh) 285 290 { 286 291 // create the memomry to save the triangles 287 MD3Triangle* tri= new MD3Triangle[this->meshes[mesh]->header->triangleNum];288 fread(t ri, 1, sizeof(MD3Triangle), pFile);292 this->meshes[mesh]->triangles = new MD3Triangle[this->meshes[mesh]->header->triangleNum]; 293 fread(this->meshes[mesh]->triangles, 1, sizeof(MD3Triangle), pFile); 289 294 290 295 return this->meshes[mesh]->header->triangleNum * sizeof(MD3Triangle); 291 296 } 292 297 298 299 /** 300 * reading in the mesh textures 301 */ 293 302 int MD3Data::readMeshTextures(FILE* pFile, int fileOffset, int mesh) 294 303 { 304 // create the textures 305 this->meshes[mesh]->material = new Material[this->meshes[mesh]->header->textureNum]; 306 307 MD3Texture* tex = new MD3Texture[this->meshes[mesh]->header->textureNum]; 308 fread(this->meshes[mesh]->material, 1, sizeof(MD3Texture), pFile); 309 310 for( int i = 0; i < this->meshes[mesh]->header->textureNum; i++) { 311 PRINTF(0)(" texture file: %s\n", tex[i].fileName); 312 this->meshes[mesh]->material[i].setDiffuseMap(tex[i].fileName); 313 this->meshes[mesh]->material[i].setAmbient(1, 1, 1); 314 } 315 316 return this->meshes[mesh]->header->textureNum * sizeof(MD3Texture); 317 } 318 319 320 /** 321 * reading in the mesh tex vecs 322 */ 323 int MD3Data::readMeshTexVecs(FILE* pFile, int fileOffset, int mesh) 324 { 295 325 return 0; 296 326 } 297 327 298 int MD3Data::readMeshTexVecs(FILE* pFile, int fileOffset, int mesh) 328 329 /** 330 * reading in the mesh vertices 331 */ 332 int MD3Data::readMeshVertices(FILE* pFile, int fileOffset, int mesh) 299 333 { 300 334 return 0; 301 335 } 302 336 303 int MD3Data::readMeshVertices(FILE* pFile, int fileOffset, int mesh) 304 { 305 return 0; 306 } 307 308 } 309 310 311 312 313 314 315 337 } 338 339 340 341 342 343 344 -
branches/bsp_model/src/lib/graphics/importer/md3/md3_mesh.h
r8416 r8418 16 16 #include "vector.h" 17 17 18 class Material; 19 18 20 19 21 namespace md3 20 22 { 21 22 23 23 24 typedef struct MD3MeshHeader { … … 41 42 42 43 typedef struct MD3Triangle { 43 int vertexOffset[3]; 44 int vertexOffset[3]; //!< the vertex offsets of the triangles in the vertex array 45 }; 46 47 typedef struct MD3Texture { 48 char fileName[68]; //!< the filename of the texture. path relativly to the model file 44 49 }; 45 50 … … 55 60 MD3MeshHeader* header; //!< the header of the mesh 56 61 57 //MD3Texture* textures; //!< array of textures of size textureNum62 Material* material; //!< the material/textures of the models 58 63 MD3Triangle* triangles; //!< indices into mesh frames and texture coord arrays 64 59 65 float* textureCoords; //!< U/V textures coordinates of vertices 60 66 Vector meshFrames; //!< mesh frames
Note: See TracChangeset
for help on using the changeset viewer.