Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jul 4, 2006, 9:45:39 PM (18 years ago)
Author:
patrick
Message:

less debug more boxes creation obb

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/presentation/src/world_entities/weapons/aiming_system.cc

    r9168 r9172  
    1 /*
     1  /*
    22   orxonox - the future of 3D-vertical-scrollers
    33
     
    3636AimingSystem::AimingSystem (WorldEntity* entity)
    3737{
     38  this->owner = entity;
     39
    3840  this->init();
    3941}
     
    5557  this->setName("AimingSystem");
    5658
    57   this->loadModel("models/guns/targeting_system_body.obj");
     59  //this->loadModel("models/guns/targeting_system_body2.obj");
     60//   this->loadModel("models/ships/fighter.obj");
    5861
    5962  // registering default reactions:
    6063  this->subscribeReaction(CREngine::CR_OBJECT_DAMAGE, CL_WORLD_ENTITY);
     64
     65  this->range = 1000.0f;
     66  this->sideLength = 10.0f;
     67
     68  // new obb tree
     69  this->obbTree = new OBBTree();
     70  this->obbTree->createBox(Vector(0.0f, 0.0f, 0.0f), Vector(this->range, this->sideLength, this->sideLength));
    6171}
    6272
     
    6979WorldEntity* AimingSystem::getNearestTarget()
    7080{
     81
     82//   PRINTF(0)("size: %i\n", this->selectionList.size());
     83
     84
    7185  if( this->selectionList.size() == 0)
    7286    return NULL;
    73   else if( this->selectionList.size() == 1)
    74     return this->selectionList.back();
     87
    7588
    7689  WorldEntity* nearestEntity     = NULL;
     
    91104  if( nearestEntity != this->owner)
    92105    return nearestEntity;
    93   else return NULL;
     106  else
     107    return NULL;
    94108}
    95109
     
    123137void AimingSystem::draw() const
    124138{
    125   WorldEntity::draw();
     139//   WorldEntity::draw();
    126140
    127   if( this->getOBBTree () != NULL)
    128     this->getOBBTree()->drawBV(0, 1);
     141  glMatrixMode(GL_MODELVIEW);
     142  glPushMatrix();
     143
     144  /* translate */
     145  glTranslatef (this->getAbsCoor ().x,
     146                this->getAbsCoor ().y,
     147                this->getAbsCoor ().z);
     148  Vector tmpRot = this->getAbsDir().getSpacialAxis();
     149  glRotatef (this->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z );
     150
     151  this->obbTree->drawBV(1, 1);
     152
     153  glPopMatrix();
     154
    129155}
Note: See TracChangeset for help on using the changeset viewer.