- Timestamp:
- May 24, 2005, 6:21:17 PM (19 years ago)
- Location:
- orxonox/trunk/src/lib/graphics/importer
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/graphics/importer/md2Model.cc
r4280 r4281 195 195 sVec3D* nextVec; 196 196 197 currVec = &this-> pVertices[this->numVertices * this->animationState.currentFrame];198 nextVec = &this-> pVertices[this->numVertices * this->animationState.nextFrame];199 200 for(int i = 0; i < this-> numFrames; ++i)201 { 202 verticesList[i][0] = (currVec[i][0] + this->animationState.interpolationState * (nextVec[i][0] - currVec[i][0])) * this-> scaleFactor;203 verticesList[i][1] = (currVec[i][1] + this->animationState.interpolationState * (nextVec[i][1] - currVec[i][1])) * this-> scaleFactor;204 verticesList[i][2] = (currVec[i][2] + this->animationState.interpolationState * (nextVec[i][2] - currVec[i][2])) * this-> scaleFactor;197 currVec = &this->data->pVertices[this->data->numVertices * this->animationState.currentFrame]; 198 nextVec = &this->data->pVertices[this->data->numVertices * this->animationState.nextFrame]; 199 200 for(int i = 0; i < this->data->numFrames; ++i) 201 { 202 verticesList[i][0] = (currVec[i][0] + this->animationState.interpolationState * (nextVec[i][0] - currVec[i][0])) * this->data->scaleFactor; 203 verticesList[i][1] = (currVec[i][1] + this->animationState.interpolationState * (nextVec[i][1] - currVec[i][1])) * this->data->scaleFactor; 204 verticesList[i][2] = (currVec[i][2] + this->animationState.interpolationState * (nextVec[i][2] - currVec[i][2])) * this->data->scaleFactor; 205 205 } 206 206 } … … 247 247 { 248 248 static sVec3D verticesList[MD2_MAX_VERTICES]; /* performance: created only once in a lifetime */ 249 int* pCommands = this-> pGLCommands;249 int* pCommands = this->data->pGLCommands; 250 250 251 251 /* some face culling stuff */ … … 257 257 this->processLighting(); 258 258 this->interpolate(verticesList); 259 this-> material->select();259 this->data->material->select(); 260 260 261 261 /* draw the triangles */ … … 274 274 for(; i > 0; i--, pCommands += 3) /* down counting for loop, next 3 gl commands */ 275 275 { 276 glNormal3fv(anorms[this-> pLightNormals[pCommands[2]]]);276 glNormal3fv(anorms[this->data->pLightNormals[pCommands[2]]]); 277 277 glTexCoord2f( ((float *)pCommands)[0], 1.0-((float *)pCommands)[1] ); 278 278 glVertex3fv(verticesList[pCommands[2]]); … … 297 297 } 298 298 299 if( this->animationState.currentFrame > (this-> numFrames - 1) )299 if( this->animationState.currentFrame > (this->data->numFrames - 1) ) 300 300 this->animationState.currentFrame = 0; 301 if( this->animationState.nextFrame > (this-> numFrames - 1) )301 if( this->animationState.nextFrame > (this->data->numFrames - 1) ) 302 302 this->animationState.nextFrame = 0; 303 303 … … 317 317 { 318 318 PRINT(0)("==========================| MD2Model::debug() |===\n"); 319 PRINT(0)("= Model FileName:\t%s\n", this-> fileName);320 PRINT(0)("= Skin FileName:\t%s\n", this-> skinFileName);321 PRINT(0)("= Size in Memory:\t%i Bytes\n", this-> header->frameSize * this->header->numFrames + 64); // 64bytes is the header size322 PRINT(0)("= Number of Vertices:\t%i\n", this-> header->numVertices);323 PRINT(0)("= Number of Frames: \t%i\n", this-> header->numFrames);324 PRINT(0)("= Height, Width\t\t%i, %i\n", this-> header->skinHeight, this->header->skinWidth);319 PRINT(0)("= Model FileName:\t%s\n", this->data->fileName); 320 PRINT(0)("= Skin FileName:\t%s\n", this->data->skinFileName); 321 PRINT(0)("= Size in Memory:\t%i Bytes\n", this->data->header->frameSize * this->data->header->numFrames + 64); // 64bytes is the header size 322 PRINT(0)("= Number of Vertices:\t%i\n", this->data->header->numVertices); 323 PRINT(0)("= Number of Frames: \t%i\n", this->data->header->numFrames); 324 PRINT(0)("= Height, Width\t\t%i, %i\n", this->data->header->skinHeight, this->data->header->skinWidth); 325 325 PRINT(0)("===================================================\n\n"); 326 326 } … … 422 422 this->skinFileName = new char[strlen(fileName)+1]; 423 423 strcpy(this->skinFileName, fileName); 424 424 425 this->material = new Material("md2ModelTest"); 425 426 this->material->setDiffuseMap(fileName); -
orxonox/trunk/src/lib/graphics/importer/md2Model.h
r4279 r4281 164 164 private: 165 165 MD2Data* data; 166 166 167 167 int numFrames; 168 168 int numVertices; … … 177 177 int* pLightNormals; 178 178 glCommandVertex* pGLCommands2; 179 179 180 180 181 Material* material;
Note: See TracChangeset
for help on using the changeset viewer.