Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5087 in orxonox.OLD for trunk


Ignore:
Timestamp:
Aug 20, 2005, 5:39:13 PM (19 years ago)
Author:
patrick
Message:

orxonox/trunk: added some droids in the middle of the track to the left side. They die on shooting. Bensch: have some fun :D

Location:
trunk/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/graphics/importer/md2Model.cc

    r5086 r5087  
    8787
    8888  this->scaleFactor = this->data->scaleFactor;
    89   this->setAnim(BOOM);
     89  this->setAnim(STAND);
    9090}
    9191
     
    134134{
    135135  if( (type < 0) || (type > MAX_ANIMATIONS) )
    136     type = 0;
     136    type = STAND;
    137137
    138138  this->animationState.startFrame = animationList[type].firstFrame;
     
    142142  this->animationState.type = type;
    143143
    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;
    147147  this->animationState.currentFrame = animationList[type].firstFrame;
    148148}
     
    169169  glPushMatrix();
    170170
    171   this->renderFrameGLList();
    172 //  this->renderFrameTriangles();
     171  this->renderFrame();
    173172
    174173  glPopMatrix();
     
    179178  \brief this is an internal function to render this special frame selected by animate()
    180179*/
    181 void MD2Model::renderFrameGLList()
     180void MD2Model::renderFrame()
    182181{
    183182  static sVec3D verticesList[MD2_MAX_VERTICES]; /* performance: created only once in a lifetime */
     
    194193  this->data->material->select();
    195194
    196   printf("=============================FRAME\n");
    197195  /* draw the triangles */
    198196  while( int i = *(pCommands++)) /* strange looking while loop for maximum performance */
     
    218216
    219217    }
    220   glDisable(GL_CULL_FACE);
    221   glPopAttrib();
    222 }
    223 
    224 
    225 /**
    226  *  renders the frame using triangles
    227  */
    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 
    270218  glDisable(GL_CULL_FACE);
    271219  glPopAttrib();
     
    431379  fseek(pFile, this->header->offsetTexCoords, SEEK_SET);
    432380  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
    437382
    438383  for(int i = 0; i < this->numFrames; ++i)
  • trunk/src/lib/graphics/importer/md2Model.h

    r5085 r5087  
    160160  void processLighting();
    161161  void interpolate(sVec3D* verticesList);
    162   void renderFrameGLList();
    163   void renderFrameTriangles();
     162  void renderFrame();
     163
    164164
    165165 public:
  • trunk/src/story_entities/world.cc

    r5085 r5087  
    416416  TestEntity* testEntity2 = new TestEntity();
    417417  testEntity2->setAnim(STAND);
    418   testEntity2->setRelCoor(Vector(5.0, 0.0, 5.0));
     418  testEntity2->setRelCoor(Vector(2400.0, 10.0, -30.0));
    419419  testEntity2->setRelDir(Quaternion(M_PI, Vector(0, 1, 0)));
    420   testEntity2->setParent(this->localPlayer);
     420  //testEntity2->setParent(this->localPlayer);
    421421  this->spawn(testEntity2);
    422422
    423423  TestEntity* testEntity3 = new TestEntity();
    424   testEntity3->setAnim(RUN);
    425   testEntity3->setRelCoor(Vector(2400, 25, 280));
     424  testEntity3->setAnim(BOOM);
     425  testEntity3->setRelCoor(Vector(2450.0, 10.0, -40.0));
    426426  testEntity3->setRelDir(Quaternion(M_PI, Vector(0, 1, 0)));
    427427  this->spawn(testEntity3);
    428428
    429429  TestEntity* testEntity4 = new TestEntity();
    430   testEntity4->setAnim(RUN);
    431   testEntity4->setRelCoor(Vector(2430, 25, 250));
     430  testEntity4->setAnim(FLIP);
     431  testEntity4->setRelCoor(Vector(2500.0, 10.0, -22.0));
    432432  testEntity4->setRelDir(Quaternion(M_PI, Vector(0, 1, 0)));
    433433  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
    434453
    435454
  • trunk/src/world_entities/npc.cc

    r5065 r5087  
    3030  this->setClassID(CL_NPC, "NPC");
    3131
    32   this->loadModelWithScale("models/ships/bolido.obj",5);
     32  this->loadModelWithScale("models/ships/bolido.obj", 5);
    3333
    3434  this->randomRotAxis = VECTOR_RAND(1);
  • trunk/src/world_entities/test_entity.cc

    r5085 r5087  
    2222#include "md2Model.h"
    2323#include "obb_tree.h"
     24#include "state.h"
     25#include "list.h"
    2426
    2527using namespace std;
     
    3133  this->setClassID(CL_TEST_ENTITY, "TestEntity");
    3234
     35  this->md2Model = new MD2Model("models/droidika.md2", "models/droideka.pcx");
    3336//   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);
    3639
    37   this->md2Model->setAnim(STAND);
     40  this->md2Model->setAnim(RUN);
    3841  this->md2Model->debug();
    3942}
     
    5760}
    5861
     62
     63void 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}
    5972
    6073void TestEntity::hit (WorldEntity* weapon, Vector* loc) {}
  • trunk/src/world_entities/test_entity.h

    r4488 r5087  
    2525  virtual void destroy ();
    2626  virtual void collide (WorldEntity* other,  Uint32 ownhitflags, Uint32 otherhitflags);
     27  virtual void collidesWith(WorldEntity* entity, const Vector& location);
    2728  virtual void draw ();
    2829
Note: See TracChangeset for help on using the changeset viewer.