Changeset 4079 in orxonox.OLD for orxonox/branches/md2_loader/src/lib/graphics/importer/md2Model.cc
- Timestamp:
- May 6, 2005, 12:23:14 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/md2_loader/src/lib/graphics/importer/md2Model.cc
r4078 r4079 13 13 */ 14 14 15 //#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_ 15 #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_IMPORTER 16 16 17 17 #include "md2Model.h" 18 19 //#include <stdio.h> 20 //#include <stdlib.h> 21 //#include <string> 22 #include <fstream> 18 23 19 24 … … 77 82 \param texture name to load 78 83 */ 79 bool MD2Loader::importMD2(t3DModel *pModel, char *strFileName, char *strTexture) 80 {} 84 bool MD2Loader::importMD2(t3DModel *pModel, char *fileName, char *textureName) 85 { 86 char strMessage[255] = {0}; 87 88 this->pFile = fopen(fileName, "rb"); 89 if( unlikely(!pFile)) 90 { 91 PRINTF(1)("Couldn't open the MD2 File for loading. Exiting.\n"); 92 return false; 93 } 94 fread(&this->header, 1, sizeof(tMd2Header), pFile); 95 /* check for the header version: make sure its a md2 file :) */ 96 if( likely(this->header.version != 8)) 97 { 98 PRINTF(1)("Couldn't load file %s: invalid file format: stop loading\n", fileName); 99 return false; 100 } 101 102 this->readMD2Data(); 103 this->convertDataStructures(pModel); 104 105 if( likely((int)textureName)) 106 { 107 tMaterialInfo textureInfo; 108 strcpy(textureInfo.strFile, textureName); 109 /* since there is only one texture for a .Md2 file, the ID is always 0 */ 110 textureInfo.texureId = 0; 111 textureInfo.uTile = 1; 112 /* we only have 1 material for a model */ 113 pModel->numOfMaterials = 1; 114 //pModel->materialList.add(texture); 115 } 116 117 this->cleanUp(); 118 return true; 119 } 81 120 82 121 /**
Note: See TracChangeset
for help on using the changeset viewer.