- Timestamp:
- Dec 20, 2005, 1:44:21 PM (19 years ago)
- Location:
- branches/christmas_branche/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/christmas_branche/src/lib/graphics/importer/md2Model.cc
r6181 r6184 92 92 this->scaleFactor = this->data->scaleFactor; 93 93 this->setAnim(STAND); 94 95 this->debug(); 94 96 } 95 97 … … 119 121 currVec = &this->data->pVertices[this->data->numVertices * this->animationState.currentFrame]; 120 122 nextVec = &this->data->pVertices[this->data->numVertices * this->animationState.nextFrame]; 123 PRINTF(0)("current frame nr %i, next frame nr %i\n", this->animationState.currentFrame, this->animationState.nextFrame); 124 121 125 122 126 for( int i = 0; i < this->data->numVertices; ++i) … … 177 181 { 178 182 glPushMatrix(); 179 //this->renderFrame();183 //this->renderFrame(); 180 184 renderFrameTriangles(); 181 185 glPopMatrix(); … … 231 235 void MD2Model::renderFrameTriangles() const 232 236 { 233 static sVec3D verticesList[MD2_MAX_VERTICES]; /* performance: created only once in a lifetime */237 //static sVec3D verticesList[MD2_MAX_VERTICES]; /* performance: created only once in a lifetime */ 234 238 int* pCommands = this->data->pGLCommands; 235 239 /* some face culling stuff */ … … 248 252 for( int i = 0, k = 0; i < this->data->numTriangles; ++i, k += 3) 249 253 { 250 //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); 251 252 glTexCoord2f((float)this->data->pTexCoor[this->data->pTriangles[i].indexToTexCoor[0]].s, 253 (float)this->data->pTexCoor[this->data->pTriangles[i].indexToTexCoor[0]].t); 254 //glNormal3f(Md2Model.normal[i].x, Md2Model.normal[i].y, Md2Model.normal[i].z); 254 float* v = this->data->pVertices[this->data->pTriangles[i].indexToVertices[0]]; 255 256 printf("triangle: %i\n", i); 257 printf(" v0: (%f, %f, %f)\n", v[0], v[1], v[2]); 258 v = this->data->pVertices[this->data->pTriangles[i].indexToVertices[1]]; 259 printf(" v1: (%f, %f, %f)\n", v[0], v[1], v[2]); 260 v = this->data->pVertices[this->data->pTriangles[i].indexToVertices[2]]; 261 printf(" v2: (%f, %f, %f)\n", v[0], v[1], v[2]); 262 263 264 glNormal3f(anorms[i][0], anorms[i][1], anorms[i][2]); 255 265 glVertex3fv(this->data->pVertices[this->data->pTriangles[i].indexToVertices[0]]); 256 266 257 glTexCoord2f((float)this->data->pTexCoor[this->data->pTriangles[i].indexToTexCoor[1]].s, 258 (float)this->data->pTexCoor[this->data->pTriangles[i].indexToTexCoor[1]].t); 259 260 // glNormal3f(Md2Model.normal[i].x, Md2Model.normal[i].y, Md2Model.normal[i].z); 267 glNormal3f(anorms[i][0], anorms[i][1], anorms[i][2]); 261 268 glVertex3fv(this->data->pVertices[this->data->pTriangles[i].indexToVertices[1]]); 262 269 263 glTexCoord2f((float)this->data->pTexCoor[this->data->pTriangles[i].indexToTexCoor[2]].s, 264 (float)this->data->pTexCoor[this->data->pTriangles[i].indexToTexCoor[2]].t); 265 // glNormal3f(Md2Model.normal[i].x, Md2Model.normal[i].y, Md2Model.normal[i].z); 270 glNormal3f(anorms[i][0], anorms[i][1], anorms[i][2]); 266 271 glVertex3fv(this->data->pVertices[this->data->pTriangles[i].indexToVertices[2]]); 267 272 } … … 269 274 glEnd(); 270 275 } 271 272 273 274 275 276 277 278 279 280 276 281 277 … … 451 447 for(int i = 0; i < this->numFrames; ++i) 452 448 { 449 printf("==============vertex loading for frame %i/%i========\n", i, this->numFrames); 453 450 frame = (sFrame*)(buffer + this->header->frameSize * i); 454 451 pVertex = this->pVertices + this->numVertices * i; … … 462 459 pVertex[j][2] = (-1.0 * (frame->pVertices[j].v[1] * frame->scale[1] + frame->translate[1])) * this->scaleFactor; 463 460 461 printf("vertex %i/%i: (%f, %f, %f)\n", j, this->numVertices, pVertex[j][0], pVertex[j][1], pVertex[j][2]); 462 464 463 pNormals[j] = frame->pVertices[j].lightNormalIndex; 465 464 } -
branches/christmas_branche/src/subprojects/importer/Makefile.am
r5865 r6184 24 24 $(MAINSRCDIR)/lib/math/vector.cc \ 25 25 $(MAINSRCDIR)/util/loading/resource_manager.cc \ 26 $(MAINSRCDIR)/lib/ util/ini_parser.cc \26 $(MAINSRCDIR)/lib/parser/ini_parser/ini_parser.cc \ 27 27 $(MAINSRCDIR)/lib/coord/p_node.cc \ 28 $(MAINSRCDIR)/lib/coord/null_parent.cc \29 28 $(MAINSRCDIR)/util/loading/load_param.cc \ 30 29 $(MAINSRCDIR)/util/loading/load_param_description.cc \ … … 52 51 $(MAINSRCDIR)/lib/math/vector.cc \ 53 52 $(MAINSRCDIR)/util/loading/resource_manager.cc \ 54 $(MAINSRCDIR)/lib/ util/ini_parser.cc \53 $(MAINSRCDIR)/lib/parser/ini_parser/ini_parser.cc \ 55 54 $(MAINSRCDIR)/lib/coord/p_node.cc \ 56 $(MAINSRCDIR)/lib/coord/null_parent.cc \57 55 $(MAINSRCDIR)/util/loading/load_param.cc \ 58 56 $(MAINSRCDIR)/util/loading/load_param_description.cc \ -
branches/christmas_branche/src/subprojects/importer/importer.cc
r4741 r6184 21 21 22 22 #include "objModel.h" 23 #include "md2Model.h" 23 24 #include "primitive_model.h" 24 25 #include <stdlib.h> … … 40 41 41 42 if (argc>=3) 42 obj = new OBJModel (argv[1], atof(argv[2])); 43 { 44 if( strstr(argv[1], ".obj") != NULL) 45 obj = new OBJModel (argv[1], atof(argv[2])); 46 else if( strstr(argv[1], ".md2") != NULL) 47 obj = new MD2Model(argv[1], argv[2]); 48 } 43 49 else if (argc>=2) 44 obj = new OBJModel(argv[1]); 50 { 51 if( strstr(argv[1], ".obj") != NULL) 52 obj = new OBJModel(argv[1]); 53 else if( strstr(argv[1], ".md2") != NULL) 54 obj = new MD2Model(argv[1], "fake_texture.bad"); 55 } 45 56 else 46 57 obj = new PrimitiveModel(PRIM_CYLINDER);
Note: See TracChangeset
for help on using the changeset viewer.