Changeset 5087 in orxonox.OLD for trunk/src/lib/graphics
- Timestamp:
- Aug 20, 2005, 5:39:13 PM (19 years ago)
- Location:
- trunk/src/lib/graphics/importer
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/graphics/importer/md2Model.cc
r5086 r5087 87 87 88 88 this->scaleFactor = this->data->scaleFactor; 89 this->setAnim( BOOM);89 this->setAnim(STAND); 90 90 } 91 91 … … 134 134 { 135 135 if( (type < 0) || (type > MAX_ANIMATIONS) ) 136 type = 0;136 type = STAND; 137 137 138 138 this->animationState.startFrame = animationList[type].firstFrame; … … 142 142 this->animationState.type = type; 143 143 144 this->animationState.interpolationState = 0.0 ;145 this->animationState.localTime = 0.0 ;146 this->animationState.lastTime = 0.0 ;144 this->animationState.interpolationState = 0.0f; 145 this->animationState.localTime = 0.0f; 146 this->animationState.lastTime = 0.0f; 147 147 this->animationState.currentFrame = animationList[type].firstFrame; 148 148 } … … 169 169 glPushMatrix(); 170 170 171 this->renderFrameGLList(); 172 // this->renderFrameTriangles(); 171 this->renderFrame(); 173 172 174 173 glPopMatrix(); … … 179 178 \brief this is an internal function to render this special frame selected by animate() 180 179 */ 181 void MD2Model::renderFrame GLList()180 void MD2Model::renderFrame() 182 181 { 183 182 static sVec3D verticesList[MD2_MAX_VERTICES]; /* performance: created only once in a lifetime */ … … 194 193 this->data->material->select(); 195 194 196 printf("=============================FRAME\n");197 195 /* draw the triangles */ 198 196 while( int i = *(pCommands++)) /* strange looking while loop for maximum performance */ … … 218 216 219 217 } 220 glDisable(GL_CULL_FACE);221 glPopAttrib();222 }223 224 225 /**226 * renders the frame using triangles227 */228 void MD2Model::renderFrameTriangles()229 {230 static sVec3D verticesList[MD2_MAX_VERTICES]; /* performance: created only once in a lifetime */231 int* pCommands = this->data->pGLCommands;232 233 /* some face culling stuff */234 glPushAttrib(GL_POLYGON_BIT);235 glFrontFace(GL_CW);236 glEnable(GL_CULL_FACE);237 glCullFace(GL_BACK);238 239 this->processLighting();240 this->interpolate(verticesList);241 this->data->material->select();242 243 /* draw the triangles */244 glBegin(GL_TRIANGLES);245 246 for( int i = 0, k = 0; i < this->data->numTriangles; ++i, k += 3)247 {248 printf("%i: (%f, %f)\n", i, (float)this->data->pTexCoor[this->data->pTriangles[i].indexToTexCoor[2]].s, (float)this->data->pTexCoor[this->data->pTriangles[i].indexToTexCoor[2]].t);249 250 glTexCoord2f((float)this->data->pTexCoor[this->data->pTriangles[i].indexToTexCoor[0]].s,251 (float)this->data->pTexCoor[this->data->pTriangles[i].indexToTexCoor[0]].t);252 //glNormal3f(Md2Model.normal[i].x, Md2Model.normal[i].y, Md2Model.normal[i].z);253 glVertex3fv(verticesList[this->data->pTriangles[i].indexToVertices[0]]);254 255 glTexCoord2f((float)this->data->pTexCoor[this->data->pTriangles[i].indexToTexCoor[1]].s,256 (float)this->data->pTexCoor[this->data->pTriangles[i].indexToTexCoor[1]].t);257 258 // glNormal3f(Md2Model.normal[i].x, Md2Model.normal[i].y, Md2Model.normal[i].z);259 glVertex3fv(verticesList[this->data->pTriangles[i].indexToVertices[1]]);260 261 glTexCoord2f((float)this->data->pTexCoor[this->data->pTriangles[i].indexToTexCoor[2]].s,262 (float)this->data->pTexCoor[this->data->pTriangles[i].indexToTexCoor[2]].t);263 // glNormal3f(Md2Model.normal[i].x, Md2Model.normal[i].y, Md2Model.normal[i].z);264 glVertex3fv(verticesList[this->data->pTriangles[i].indexToVertices[2]]);265 }266 267 glEnd();268 269 270 218 glDisable(GL_CULL_FACE); 271 219 glPopAttrib(); … … 431 379 fseek(pFile, this->header->offsetTexCoords, SEEK_SET); 432 380 fread(this->pTexCoor, sizeof(sTexCoor), this->numTexCoor, pFile); 433 for( int i = 0; i < this->numTexCoor; ++i) 434 { 435 printf("%i: (%i, %i)\n", i, this->pTexCoor[i].s, this->pTexCoor[i].t); 436 } 381 437 382 438 383 for(int i = 0; i < this->numFrames; ++i) -
trunk/src/lib/graphics/importer/md2Model.h
r5085 r5087 160 160 void processLighting(); 161 161 void interpolate(sVec3D* verticesList); 162 void renderFrame GLList();163 void renderFrameTriangles(); 162 void renderFrame(); 163 164 164 165 165 public:
Note: See TracChangeset
for help on using the changeset viewer.