Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


Ignore:
Timestamp:
Dec 9, 2005, 11:12:04 PM (18 years ago)
Author:
bensch
Message:

orxonox/trunk: new algorithm to rotate entities for drawing works (shifcoor ONLY takes normalized Vectors…)

File:
1 edited

Legend:

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

    r6002 r6004  
    118118
    119119  if (this->models[modelNumber] != NULL)
    120   { 
     120  {
    121121    Resource* resource = ResourceManager::getInstance()->locateResourceByPointer(this->models[modelNumber]);
    122122    if (resource != NULL)
     
    127127  this->models[modelNumber] = model;
    128128
    129 //   if (this->model != NULL) 
     129//   if (this->model != NULL)
    130130//     this->buildObbTree(4);
    131131}
     
    233233    glMatrixMode(GL_MODELVIEW);
    234234    glPushMatrix();
    235     float matrix[4][4];
    236235
    237236    /* translate */
     
    239238                  this->getAbsCoor ().y,
    240239                  this->getAbsCoor ().z);
    241    /* rotate */ // FIXME: devise a new Way to rotate this
    242     this->getAbsDir ().matrix (matrix);
    243     glMultMatrixf((float*)matrix);
    244 
     240    Vector tmpRot = this->getAbsDir().getSpacialAxis();
     241    glRotatef (this->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z );
     242
     243
     244    // This Draws the LOD's
    245245    float cameraDistance = (State::getCamera()->getAbsCoor() - this->getAbsCoor()).len();
    246     if (this->isA(CL_HELICOPTER))
    247         printf("Test %f %d\n", cameraDistance, this->models.size());
    248     if (cameraDistance > 100 && this->models.size() >= 3 && this->models[2] != NULL)
     246    if (cameraDistance > 30 && this->models.size() >= 3 && this->models[2] != NULL)
    249247    {
    250       if (this->isA(CL_HELICOPTER))printf("====== 2 ===\n");
    251248       this->models[2]->draw();
    252     } 
    253     else if (cameraDistance > 50 && this->models.size() >= 2 && this->models[1] != NULL)
     249    }
     250    else if (cameraDistance > 10 && this->models.size() >= 2 && this->models[1] != NULL)
    254251    {
    255       if (this->isA(CL_HELICOPTER))printf("====== 1 ===\n");
    256252      this->models[1]->draw();
    257     } 
    258     else if (this->models.size() >= 1 && this->models[0] != NULL) 
     253    }
     254    else if (this->models.size() >= 1 && this->models[0] != NULL)
    259255    {
    260       if (this->isA(CL_HELICOPTER))printf("====== 0 ===\n");
    261256      this->models[0]->draw();
    262257    }
Note: See TracChangeset for help on using the changeset viewer.