Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6175 in orxonox.OLD for branches/christmas_branche/src


Ignore:
Timestamp:
Dec 20, 2005, 2:47:35 AM (19 years ago)
Author:
patrick
Message:

christmas: the md2model has now const draw functions

Location:
branches/christmas_branche/src
Files:
4 edited

Legend:

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

    r6172 r6175  
    149149
    150150
     151static sVec3D verticesList[MD2_MAX_VERTICES]; /* performance: created only once in a lifetime */
     152
    151153/**
    152154  \brief sets the time in seconds passed since the last tick
     
    160162    this->animate();
    161163
    162    this->renderFrame();
     164  this->processLighting();
     165  this->interpolate(verticesList);
    163166}
    164167
     
    169172 * FIXME
    170173 */
    171 void MD2Model::draw()
    172 {
    173 
    174 
    175 
    176   //   glPushMatrix();
    177 
    178   //this->renderFrame();
    179 
    180 //   glPopMatrix();
     174void MD2Model::draw() const
     175{
     176  glPushMatrix();
     177  this->renderFrame();
     178  glPopMatrix();
    181179}
    182180
     
    185183  \brief this is an internal function to render this special frame selected by animate()
    186184*/
    187 void MD2Model::renderFrame()
    188 {
    189   static sVec3D verticesList[MD2_MAX_VERTICES]; /* performance: created only once in a lifetime */
     185void MD2Model::renderFrame() const
     186{
    190187  int* pCommands = this->data->pGLCommands;
    191188
     
    196193  glCullFace(GL_BACK);
    197194
    198   this->processLighting();
    199   this->interpolate(verticesList);
    200195
    201196  this->data->material->select();
  • branches/christmas_branche/src/lib/graphics/importer/md2Model.h

    r6172 r6175  
    143143  virtual ~MD2Model();
    144144
    145   virtual void draw();
     145  virtual void draw() const;
    146146
    147147  void setAnim(int type);
     
    160160  void processLighting();
    161161  void interpolate(sVec3D* verticesList);
    162   void renderFrame();
     162  void renderFrame() const ;
    163163
    164164
  • branches/christmas_branche/src/world_entities/creatures/md2_creature.cc

    r6174 r6175  
    241241    ((MD2Model*)this->models[0])->draw();
    242242
    243   this->getWeaponManager()->draw();
    244 
    245 
    246   //this->debug(0);
     243  //this->getWeaponManager()->draw();
    247244}
    248245
     
    260257
    261258
    262   // MD2Creature controlled movement
    263   this->calculateVelocity(time);
    264 
    265   Vector move = (velocity)*time;
    266 
    267   //orient the velocity in the direction of the MD2Creature.
    268   travelSpeed = velocity.len();
    269   velocity += ((this->getAbsDirX())*travelSpeed-velocity)*airViscosity;
    270   velocity = (velocity.getNormalized())*travelSpeed;
    271 
    272   //orient the MD2Creature in direction of the mouse
    273    rotQuat = Quaternion::quatSlerp( this->getAbsDir(),mouseDir,fabsf(time)*3);
    274    if (this->getAbsDir().distance(rotQuat) > 0.001)
    275     this->setAbsDir( rotQuat);
    276    //this->setAbsDirSoft(mouseDir,5);
    277 
    278   // this is the air friction (necessary for a smooth control)
    279   if(velocity.len() != 0) velocity -= velocity*0.01;
    280 
    281   //hoover effect
    282   cycle += time;
    283   this->shiftCoor(Vector(0,1,0)*cos(this->cycle*2.0)*0.02);
    284 
    285   //readjust
    286  // if (this->getAbsDirZ().y > 0.1) this->shiftDir(Quaternion(time*0.3, Vector(1,0,0)));
    287   //else if (this->getAbsDirZ().y < -0.1) this->shiftDir(Quaternion(-time*0.3, Vector(1,0,0)));
    288 
    289   //SDL_WarpMouse(GraphicsEngine::getInstance()->getResolutionX()/2, GraphicsEngine::getInstance()->getResolutionY()/2);
    290 
    291   this->shiftCoor (move);
    292 
    293   this->getWeaponManager()->tick(time);
    294   // weapon system manipulation
    295   this->weaponAction();
     259//   // MD2Creature controlled movement
     260//   this->calculateVelocity(time);
     261//
     262//   Vector move = (velocity)*time;
     263//
     264//   //orient the velocity in the direction of the MD2Creature.
     265//   travelSpeed = velocity.len();
     266//   velocity += ((this->getAbsDirX())*travelSpeed-velocity)*airViscosity;
     267//   velocity = (velocity.getNormalized())*travelSpeed;
     268//
     269//   //orient the MD2Creature in direction of the mouse
     270//    rotQuat = Quaternion::quatSlerp( this->getAbsDir(),mouseDir,fabsf(time)*3);
     271//    if (this->getAbsDir().distance(rotQuat) > 0.001)
     272//     this->setAbsDir( rotQuat);
     273//    //this->setAbsDirSoft(mouseDir,5);
     274//
     275//   // this is the air friction (necessary for a smooth control)
     276//   if(velocity.len() != 0) velocity -= velocity*0.01;
     277//
     278//   //hoover effect
     279//   cycle += time;
     280//   this->shiftCoor(Vector(0,1,0)*cos(this->cycle*2.0)*0.02);
     281//
     282//   //readjust
     283// // if (this->getAbsDirZ().y > 0.1) this->shiftDir(Quaternion(time*0.3, Vector(1,0,0)));
     284//   //else if (this->getAbsDirZ().y < -0.1) this->shiftDir(Quaternion(-time*0.3, Vector(1,0,0)));
     285//
     286//   //SDL_WarpMouse(GraphicsEngine::getInstance()->getResolutionX()/2, GraphicsEngine::getInstance()->getResolutionY()/2);
     287//
     288//   this->shiftCoor (move);
     289//
     290//   this->getWeaponManager()->tick(time);
     291//   // weapon system manipulation
     292//   this->weaponAction();
    296293}
    297294
  • branches/christmas_branche/src/world_entities/world_entity.cc

    r6172 r6175  
    136136    else if(strstr(fileName, ".md2"))
    137137    {
    138       PRINTF(0)("fetching MD2 file: %s\n", fileName);
     138      PRINTF(4)("fetching MD2 file: %s\n", fileName);
    139139//         MD2Model* m = (MD2Model*)ResourceManager::getInstance()->load(fileName, MD2, RP_CAMPAIGN);
    140       MD2Model* m = new MD2Model(fileName, "/home/boenzlip/orxonox/data/maps/santa_claus.pcx");
     140      MD2Model* m = new MD2Model(fileName, "/home/boenzlip/orxonox/data/maps/santa_claus.png");
    141141      m->debug();
    142142      this->supportsLOD = false;
Note: See TracChangeset for help on using the changeset viewer.