Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


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

christmas: the draw funciton now is original again

Location:
branches/christmas_branche/src/world_entities
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/christmas_branche/src/world_entities/world_entity.cc

    r6178 r6179  
    5757  this->objectListNumber = OM_INIT;
    5858  this->objectListIterator = NULL;
    59   this->supportsLOD = false;
    6059
    6160  this->toList(OM_NULL);
     
    119118          this->loadModel(lodFile, scaling, i);
    120119      }
    121       this->supportsLOD = true;
    122120      return;
    123121    }
     
    140138      MD2Model* m = new MD2Model(fileName, "");
    141139      m->debug();
    142       this->supportsLOD = false;
    143140        //this->setModel((Model*)ResourceManager::getInstance()->load(fileName, MD2, RP_CAMPAIGN), 0);
    144141      this->setModel((Model*)m, 0);
     
    299296  if (!unlikely(this->models.empty()))
    300297  {
    301     if( likely(this->supportsLOD))
    302     {
    303       glMatrixMode(GL_MODELVIEW);
    304       glPushMatrix();
    305 
    306       /* translate */
    307       glTranslatef (this->getAbsCoor ().x,
    308                     this->getAbsCoor ().y,
    309                     this->getAbsCoor ().z);
    310       Vector tmpRot = this->getAbsDir().getSpacialAxis();
    311       glRotatef (this->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z );
     298    glMatrixMode(GL_MODELVIEW);
     299    glPushMatrix();
     300
     301    /* translate */
     302    glTranslatef (this->getAbsCoor ().x,
     303                  this->getAbsCoor ().y,
     304                  this->getAbsCoor ().z);
     305    Vector tmpRot = this->getAbsDir().getSpacialAxis();
     306    glRotatef (this->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z );
    312307
    313308
    314309    // This Draws the LOD's
    315       float cameraDistance = (State::getCamera()->getAbsCoor() - this->getAbsCoor()).len();
    316       if (cameraDistance > 30 && this->models.size() >= 3 && this->models[2] != NULL)
    317       {
    318         this->models[2]->draw();
    319       }
    320       else if (cameraDistance > 10 && this->models.size() >= 2 && this->models[1] != NULL)
    321       {
    322         this->models[1]->draw();
    323       }
    324       else if (this->models.size() >= 1 && this->models[0] != NULL)
    325       {
    326         this->models[0]->draw();
    327       }
    328       glPopMatrix();
    329     }
    330     else // no LOD
    331     {
    332       glMatrixMode(GL_MODELVIEW);
    333       glPushMatrix();
    334 
    335       /* translate */
    336       glTranslatef (this->getAbsCoor ().x,
    337                     this->getAbsCoor ().y,
    338                     this->getAbsCoor ().z);
    339       Vector tmpRot = this->getAbsDir().getSpacialAxis();
    340       glRotatef (this->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z );
    341 
     310    float cameraDistance = (State::getCamera()->getAbsCoor() - this->getAbsCoor()).len();
     311    if (cameraDistance > 30 && this->models.size() >= 3 && this->models[2] != NULL)
     312    {
     313      this->models[2]->draw();
     314    }
     315    else if (cameraDistance > 10 && this->models.size() >= 2 && this->models[1] != NULL)
     316    {
     317      this->models[1]->draw();
     318    }
     319    else if (this->models.size() >= 1 && this->models[0] != NULL)
     320    {
    342321      this->models[0]->draw();
    343 
    344       glPopMatrix();
    345     }
    346   }
    347 
     322    }
     323    glPopMatrix();
     324  }
    348325}
    349326
  • branches/christmas_branche/src/world_entities/world_entity.h

    r6177 r6179  
    7979 private:
    8080  std::vector<Model*>     models;             //!< The model that should be loaded for this entity.
    81   bool                    supportsLOD;        //!< If this model format supports LOD (level of detail) this is true
    8281  BVTree*                 obbTree;            //!< this is the obb tree reference needed for collision detection
    8382
Note: See TracChangeset for help on using the changeset viewer.