- Timestamp:
- Aug 20, 2005, 5:39:13 PM (19 years ago)
- Location:
- trunk/src
- Files:
-
- 6 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: -
trunk/src/story_entities/world.cc
r5085 r5087 416 416 TestEntity* testEntity2 = new TestEntity(); 417 417 testEntity2->setAnim(STAND); 418 testEntity2->setRelCoor(Vector( 5.0, 0.0, 5.0));418 testEntity2->setRelCoor(Vector(2400.0, 10.0, -30.0)); 419 419 testEntity2->setRelDir(Quaternion(M_PI, Vector(0, 1, 0))); 420 testEntity2->setParent(this->localPlayer);420 //testEntity2->setParent(this->localPlayer); 421 421 this->spawn(testEntity2); 422 422 423 423 TestEntity* testEntity3 = new TestEntity(); 424 testEntity3->setAnim( RUN);425 testEntity3->setRelCoor(Vector(24 00, 25, 280));424 testEntity3->setAnim(BOOM); 425 testEntity3->setRelCoor(Vector(2450.0, 10.0, -40.0)); 426 426 testEntity3->setRelDir(Quaternion(M_PI, Vector(0, 1, 0))); 427 427 this->spawn(testEntity3); 428 428 429 429 TestEntity* testEntity4 = new TestEntity(); 430 testEntity4->setAnim( RUN);431 testEntity4->setRelCoor(Vector(2 430, 25, 250));430 testEntity4->setAnim(FLIP); 431 testEntity4->setRelCoor(Vector(2500.0, 10.0, -22.0)); 432 432 testEntity4->setRelDir(Quaternion(M_PI, Vector(0, 1, 0))); 433 433 this->spawn(testEntity4); 434 435 TestEntity* testEntity5 = new TestEntity(); 436 testEntity5->setAnim(WAVE); 437 testEntity5->setRelCoor(Vector(2420.0, 10.0, -50.0)); 438 testEntity5->setRelDir(Quaternion(M_PI, Vector(0, 1, 0))); 439 this->spawn(testEntity5); 440 441 TestEntity* testEntity6 = new TestEntity(); 442 testEntity6->setAnim(WAVE); 443 testEntity6->setRelCoor(Vector(2420.0, 10.0, -20.0)); 444 testEntity6->setRelDir(Quaternion(M_PI, Vector(0, 1, 0))); 445 this->spawn(testEntity6); 446 447 TestEntity* testEntity7 = new TestEntity(); 448 testEntity7->setAnim(WAVE); 449 testEntity7->setRelCoor(Vector(2500.0, 10.0, -50.0)); 450 testEntity7->setRelDir(Quaternion(M_PI, Vector(0, 1, 0))); 451 this->spawn(testEntity7); 452 434 453 435 454 -
trunk/src/world_entities/npc.cc
r5065 r5087 30 30 this->setClassID(CL_NPC, "NPC"); 31 31 32 this->loadModelWithScale("models/ships/bolido.obj", 5);32 this->loadModelWithScale("models/ships/bolido.obj", 5); 33 33 34 34 this->randomRotAxis = VECTOR_RAND(1); -
trunk/src/world_entities/test_entity.cc
r5085 r5087 22 22 #include "md2Model.h" 23 23 #include "obb_tree.h" 24 #include "state.h" 25 #include "list.h" 24 26 25 27 using namespace std; … … 31 33 this->setClassID(CL_TEST_ENTITY, "TestEntity"); 32 34 35 this->md2Model = new MD2Model("models/droidika.md2", "models/droideka.pcx"); 33 36 // this->md2Model = new MD2Model("models/tris.md2", "models/tris.pcx"); 34 this->md2Model = new MD2Model("models/goblin.md2", "maps/goblin.bmp");35 this->obbTree = new OBBTree( 15, (sVec3D*)this->md2Model->data->pVertices, this->md2Model->data->numVertices);37 // this->md2Model = new MD2Model("models/goblin.md2", "maps/goblin.bmp"); 38 this->obbTree = new OBBTree(4, (sVec3D*)this->md2Model->data->pVertices, this->md2Model->data->numVertices); 36 39 37 this->md2Model->setAnim( STAND);40 this->md2Model->setAnim(RUN); 38 41 this->md2Model->debug(); 39 42 } … … 57 60 } 58 61 62 63 void TestEntity::collidesWith(WorldEntity* entity, const Vector& location) 64 { 65 if (entity->isA(CL_PROJECTILE)) 66 { 67 PRINTF(3)("collision %s vs %s @ (%f,%f,%f)\n", this->getName(), entity->getName(), location.x, location.y, location.z); 68 this->setVisibiliy(false); 69 State::getWorldEntityList()->remove(this); 70 } 71 } 59 72 60 73 void TestEntity::hit (WorldEntity* weapon, Vector* loc) {} -
trunk/src/world_entities/test_entity.h
r4488 r5087 25 25 virtual void destroy (); 26 26 virtual void collide (WorldEntity* other, Uint32 ownhitflags, Uint32 otherhitflags); 27 virtual void collidesWith(WorldEntity* entity, const Vector& location); 27 28 virtual void draw (); 28 29
Note: See TracChangeset
for help on using the changeset viewer.