Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7711 in orxonox.OLD for trunk/src/world_entities


Ignore:
Timestamp:
May 18, 2006, 11:44:21 PM (19 years ago)
Author:
patrick
Message:

trunk: merged the cd branche back to trunk

Location:
trunk/src/world_entities
Files:
4 edited

Legend:

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

    r7193 r7711  
    3737  this->init();
    3838  this->loadModel("models/ships/bolido.obj");
     39//   if(this->obbTree == NULL)
     40//     this->obbTree = new OBBTree(4, (sVec3D*)this->model->getVertexArray(), this->model->getVertexCount());
    3941}
    4042
  • trunk/src/world_entities/test_entity.cc

    r7488 r7711  
    4141{
    4242  this->init();
     43  this->md2Model = new MD2Model("models/droidika.md2", "models/droideka.pcx");
    4344}
    4445
     46
     47//   this->md2Model = new MD2Model("models/tris.md2", "models/tris.pcx");
     48// this->md2Model = new MD2Model("models/goblin.md2", "maps/goblin.bmp");
     49//   this->obbTree = new OBBTree(4, (sVec3D*)this->md2Model->data->pVertices, this->md2Model->data->numVertices);
    4550
    4651
  • trunk/src/world_entities/world_entity.cc

    r7230 r7711  
    3636SHELL_COMMAND(model, WorldEntity, loadModel)
    3737->describe("sets the Model of the WorldEntity")
    38 ->defaultValues("models/ships/fighter.obj", 1.0);
     38->defaultValues("models/ships/fighter.obj", 1.0f);
    3939
    4040SHELL_COMMAND(debugEntity, WorldEntity, debugWE);
     
    118118 * @param fileName the name of the model to load
    119119 * @param scaling the Scaling of the model
    120  */
    121 void WorldEntity::loadModel(const std::string& fileName, float scaling, unsigned int modelNumber)
     120 *
     121 * FIXME
     122 * @todo: separate the obb tree generation from the model
     123 */
     124void WorldEntity::loadModel(const std::string& fileName, float scaling, unsigned int modelNumber, unsigned int obbTreeDepth)
    122125{
    123126  this->modelLODName = fileName;
     
    154157
    155158      if( modelNumber == 0)
    156         this->buildObbTree(4);
     159        this->buildObbTree(obbTreeDepth);
    157160    }
    158161    else if(fileName.find(".md2") != std::string::npos)
     
    164167
    165168      if( m != NULL)
    166         this->buildObbTree(4);
     169        this->buildObbTree(obbTreeDepth);
    167170    }
    168171  }
     
    207210 * @param depth the depth to calculate
    208211 */
    209 bool WorldEntity::buildObbTree(unsigned int depth)
     212bool WorldEntity::buildObbTree(int depth)
    210213{
    211214  if (this->obbTree)
     
    214217  if (this->models[0] != NULL)
    215218  {
    216     PRINTF(4)("creating obb tree\n");
    217 
    218 
    219     this->obbTree = new OBBTree(depth, (sVec3D*)this->models[0]->getVertexArray(), this->models[0]->getVertexCount());
     219    this->obbTree = new OBBTree(depth, models[0]->getModelInfo(), this);
    220220    return true;
    221221  }
    222222  else
    223223  {
    224     PRINTF(2)("could not create obb-tree, because no model was loaded yet\n");
     224    PRINTF(1)("could not create obb-tree, because no model was loaded yet\n");
    225225    this->obbTree = NULL;
    226226    return false;
     
    468468 * @param drawMode the mode to draw this entity under
    469469 */
    470 void WorldEntity::drawBVTree(unsigned int depth, int drawMode) const
     470void WorldEntity::drawBVTree(int depth, int drawMode) const
    471471{
    472472  glMatrixMode(GL_MODELVIEW);
     
    480480  glRotatef (this->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z );
    481481
     482
    482483  if (this->obbTree)
    483484    this->obbTree->drawBV(depth, drawMode);
     485
     486
    484487  glPopMatrix();
    485488}
     
    571574    std::string name = getModel( 0 )->getName();
    572575
    573     if (  name.find( ResourceManager::getInstance()->getDataDir() ) == 0 ) 
     576    if (  name.find( ResourceManager::getInstance()->getDataDir() ) == 0 )
    574577    {
    575578      name.erase(ResourceManager::getInstance()->getDataDir().size());
  • trunk/src/world_entities/world_entity.h

    r7460 r7711  
    22 * @file world_entity.h
    33 * Definition of the basic WorldEntity
    4 */
     4 */
    55
    66#ifndef _WORLD_ENTITY_H
     
    3535  virtual void loadParams(const TiXmlElement* root);
    3636
    37   void loadModel(const std::string& fileName, float scaling = 1.0f, unsigned int modelNumber = 0);
     37  void loadModel(const std::string& fileName, float scaling = 1.0f, unsigned int modelNumber = 0, unsigned int obbTreeDepth = 4);
    3838  void setModel(Model* model, unsigned int modelNumber = 0);
    3939  Model* getModel(unsigned int modelNumber = 0) const { return (this->models.size() > modelNumber)? this->models[modelNumber] : NULL; };
    4040
    4141  inline void loadMD2Texture(const std::string& fileName) { this->md2TextureFileName = fileName; }
    42 
    43   bool buildObbTree(unsigned int depth);
    44   /** @returns a reference to the obb tree of this worldentity */
    45   BVTree* getOBBTree() const { return this->obbTree; };
    4642
    4743  /** @param visibility if the Entity should be visible (been draw) */
     
    5753
    5854  virtual void tick (float time);
    59 
    6055  virtual void draw () const;
    6156
     57  bool buildObbTree(int depth);
    6258  virtual void collidesWith (WorldEntity* entity, const Vector& location);
    63   void drawBVTree(unsigned int depth, int drawMode) const;
    64 
     59  /** @returns a reference to the obb tree of this worldentity */
     60  inline BVTree* getOBBTree() const { return this->obbTree; };
     61  void drawBVTree(int depth, int drawMode) const;
    6562
    6663  void debugWE() { this->debugEntity(); }
     
    7774
    7875  void toList(OM_LIST list);
     76
    7977
    8078  /** @returns a Reference to the objectListNumber to set. */
     
    10199  void setHealthMax(float healthMax);
    102100  void createHealthWidget();
     101
    103102  //  CharacterAttributes*    charAttr;         //!< the character attributes of a world_entity
    104103private:
Note: See TracChangeset for help on using the changeset viewer.