Changeset 4147 in orxonox.OLD for orxonox/branches/md2_loader/src/lib
- Timestamp:
- May 10, 2005, 5:27:40 PM (19 years ago)
- Location:
- orxonox/branches/md2_loader/src/lib/graphics/importer
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/md2_loader/src/lib/graphics/importer/md2Model.cc
r4146 r4147 63 63 for(int whichVertex = 0; whichVertex < 3; whichVertex++) 64 64 { 65 printf("now drawing vertex %i of face nr: %i\n", whichVertex, j); 65 66 int index = pObject->pFaces[j].vertIndex[whichVertex]; 66 67 int index2 = pObject->pFaces[j].coordIndex[whichVertex]; 68 printf("using index: %i, %i\n", index, index2); 67 69 /* we invert the normals since the md2 file format uses different style */ 68 glNormal3f(-pObject->pNormals[ index ].x, -pObject->pNormals[ index ].y, -pObject->pNormals[ index ].z); 69 if(pObject->pTexVerts) 70 glNormal3f(-pObject->pNormals[index].x, -pObject->pNormals[index].y, -pObject->pNormals[index].z); 71 72 if( pObject->pTexVerts) 70 73 { 71 74 glTexCoord2f(pObject->pTexVerts[ index2 ].x, pObject->pTexVerts[ index2 ].y); … … 166 169 /* reading all frame data */ 167 170 fseek(this->pFile, this->header.offsetFrames, SEEK_SET); 168 for( int i = 0; i < this->header.numFrames; i++)171 for( int i = 0; i < this->header.numFrames; i++) 169 172 { 170 173 tMd2AliasFrame *pFrame = (tMd2AliasFrame *) buffer; … … 179 182 and negate z axis 180 183 */ 181 for( int j = 0; j < this->header.numVertices; j++)184 for( int j = 0; j < this->header.numVertices; j++) 182 185 { 183 186 pVertices[j].vertex[0] = pFrame->aliasVertices[j].vertex[0] * pFrame->scale[0] + pFrame->translate[0]; -
orxonox/branches/md2_loader/src/lib/graphics/importer/md2Model.h
r4138 r4147 12 12 512 frames. The maximal vetices count is set to 2048 verteces, not enough? 13 13 You just have to change the MD2_MAX_* values if it doesn't fit your purposes... 14 15 Surface Culling is fully implemented in md2 models: quake2 uses front face culling. 14 16 */ 15 17 … … 36 38 struct tMd2Header 37 39 { 38 int ident; //!< This is used to identify the file 39 int version; //!< The version number of the file (Must be 8) 40 int ident; //!< This is used to identify the file 41 int version; //!< The version number of the file (Must be 8) 42 43 int skinWidth; //!< The skin width in pixels 44 int skinHeight; //!< The skin height in pixels 45 int frameSize; //!< The size in bytes the frames are 40 46 41 int skinWidth; //!< The skin width in pixels 42 int skinHeight; //!< The skin height in pixels 43 int frameSize; //!< The size in bytes the frames are 44 45 int numSkins; //!< The number of skins associated with the model 46 int numVertices; //!< The number of vertices (constant for each frame) 47 int numSkins; //!< The number of skins associated with the model 48 int numVertices; //!< The number of vertices (constant for each frame) 47 49 int numTexCoords; //!< The number of texture coordinates 48 50 int numTriangles; //!< The number of faces (polygons) 49 51 int numGlCommands; //!< The number of gl commands 50 int numFrames; 52 int numFrames; //!< The number of animation frames 51 53 52 int offsetSkins; 54 int offsetSkins; //!< The offset in the file for the skin data 53 55 int offsetTexCoords; //!< The offset in the file for the texture data 54 56 int offsetTriangles; //!< The offset in the file for the face data 55 57 int offsetFrames; //!< The offset in the file for the frames data 56 58 int offsetGlCommands; //!< The offset in the file for the gl commands data 57 int offsetEnd; 59 int offsetEnd; //!< The end of the file offset 58 60 }; 59 61 … … 147 149 148 150 FILE *pFile; 149 tMd2Header header; 150 tMd2Skin *pSkins; 151 tMd2TexCoord *pTexCoords; 152 tMd2Face *pTriangles; 153 tMd2Frame *pFrames; 151 tMd2Header header; //!< The header data 152 tMd2Skin *pSkins; //!< The skin data 153 tMd2TexCoord *pTexCoords; //!< The texture coordinates 154 tMd2Face *pTriangles; //!< Face index information 155 tMd2Frame *pFrames; //!< The frames of animation (vertices) 154 156 }; 155 157
Note: See TracChangeset
for help on using the changeset viewer.