Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8724 in orxonox.OLD for trunk/src/world_entities/world_entity.cc


Ignore:
Timestamp:
Jun 22, 2006, 3:14:58 PM (18 years ago)
Author:
bensch
Message:

merged the bsp-model-stuff back here

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/world_entities/world_entity.cc

    r8490 r8724  
    2424#include "md3/md3_model.h"
    2525
     26#include "aabb_tree_node.h"
     27
    2628#include "util/loading/resource_manager.h"
    2729#include "util/loading/load_param.h"
     
    6062
    6163  this->obbTree = NULL;
     64  this->aabbNode = NULL;
    6265  this->healthWidget = NULL;
    6366  this->healthMax = 1.0f;
     
    201204        this->buildObbTree(obbTreeDepth);
    202205    }
    203     else if(fileName.find(".md3") != std::string::npos)
     206    else /*if(fileName.find(".md3") != std::string::npos)*/
    204207    {
    205208      PRINTF(4)("fetching MD3 file: %s\n", fileName.c_str());
     
    240243
    241244  this->models[modelNumber] = model;
    242 
    243 
    244   //   if (this->model != NULL)
    245   //     this->buildObbTree(4);
    246245}
    247246
     
    257256
    258257  if (this->models[0] != NULL)
    259   {
    260258    this->obbTree = new OBBTree(depth, models[0]->getModelInfo(), this);
    261     return true;
    262   }
    263259  else
    264260  {
     
    267263    return false;
    268264  }
     265
     266
     267  // create the axis aligned bounding box
     268  if( this->aabbNode != NULL)
     269  {
     270    delete this->aabbNode;
     271    this->aabbNode = NULL;
     272  }
     273
     274  if( this->models[0] != NULL) {
     275    this->aabbNode = new AABBTreeNode();
     276    this->aabbNode->spawnBVTree(this->models[0]);
     277  }
     278  return true;
    269279}
    270280
     
    604614      this->models[0]->draw();
    605615    }
     616
     617    if( this->aabbNode != NULL)
     618      this->aabbNode->drawBV(0, DRAW_BV_POLYGON, Vector(1, 0.6, 0.2), true);
     619
    606620    glPopMatrix();
    607621  }
     
    712726    this->healthWidget->hide();
    713727}
     728
     729
     730/**
     731 * hit the world entity with
     732 *  @param damage damage to be dealt
     733 */
     734void WorldEntity::hit(float damage)
     735{
     736  this->decreaseHealth(damage);
     737
     738  if( this->getHealth() > 0)
     739  {
     740    // any small explosion animaitions
     741  }
     742  else
     743  {
     744    this->destroy();
     745
     746//     if( State::getGameRules() != NULL)
     747//       State::getGameRules()->registerKill(Kill(NULL, this));
     748  }
     749}
     750
    714751
    715752/**
Note: See TracChangeset for help on using the changeset viewer.