Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10184 in orxonox.OLD for branches/mount_points/src


Ignore:
Timestamp:
Jan 6, 2007, 5:03:27 PM (18 years ago)
Author:
patrick
Message:

extended model again, added mounting point generation procedures now working on a nicer interface

Location:
branches/mount_points/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • branches/mount_points/src/lib/graphics/importer/model.h

    r10182 r10184  
    5555typedef struct
    5656{
     57  std::string      name;                 //!< the name of the mount point
    5758  Vector           up;                   //!< the up vector
    5859  Vector           forward;              //!< the forward vector
     
    100101    inline const mpList& getMountPoints() const { return this->mountPoints; }
    101102    /** adds a mounting point to the model @param up up vector @param forward forward vector @param center center vector */
    102     inline void addMountPoint(Vector up, Vector forward, Vector center)
    103     { mountPointSkeleton mps; mps.up = up; mps.forward = forward; mps.center = center; }
     103    inline void addMountPoint(const Vector& up, const Vector& forward, const Vector& center, const std::string& name)
     104    { mountPointSkeleton mps; mps.up = up; mps.forward = forward; mps.center = center; mps.name = name; }
    104105
    105106
  • branches/mount_points/src/lib/graphics/importer/static_model.cc

    r10183 r10184  
    197197
    198198    // now add the mount point
    199     this->addMountPoint( up, forward, center);
     199    this->addMountPoint( up, forward, center, groupName);
    200200  }
    201201}
  • branches/mount_points/src/world_entities/mount_point.cc

    r10147 r10184  
    3333 * construct
    3434 */
    35 MountPoint::MountPoint ()
     35MountPoint::MountPoint (const Vector& up, const Vector& forward, const Vector& center, const std::string& name)
    3636{
     37
     38  this->name = name;
     39  this->setAbsCoor( center);
     40  this->setAbsDir( Quaternion(forward, up));
     41
    3742  this->init();
    3843}
  • branches/mount_points/src/world_entities/mount_point.h

    r10147 r10184  
    1212
    1313  public:
    14     MountPoint ();
     14    MountPoint (const Vector& up, const Vector& forward, const Vector& center, const std::string& name);
    1515    MountPoint(const TiXmlElement* root);
    1616    virtual ~MountPoint ();
     
    3232  private:
    3333    WorldEntity*         _mount;       //!< the entity mounted at this mount point
     34    std::string          _name;        //!< the name of the mount point
    3435
    3536};
  • branches/mount_points/src/world_entities/world_entity.cc

    r10147 r10184  
    207207      {
    208208        this->setModel(model, modelNumber);
    209         if( modelNumber == 0 /* FIXME && !this->isA(CL_WEAPON) */)
     209        if( modelNumber == 0)
    210210          this->buildObbTree(obbTreeDepth);
     211
     212        // now get the object information file for this model, if any
     213        std::string oifName = fileName.substr(0, fileName.length() - 4) + ".oif";
     214        this->loadMountPoints( oifName);
    211215      }
    212216      else
    213217        delete model;
    214 
    215       // now get the object information file for this model, if any
    216       std::string oifName = fileName.substr(0, fileName.length() - 4) + ".oif";
    217       this->loadObjectInformationFile( oifName);
    218218    }
    219219    /// LOADING AN MD2-model
     
    269269 * @param fileName the name of the file
    270270 */
    271 void WorldEntity::loadObjectInformationFile(const std::string& fileName)
     271void WorldEntity::loadMountPoints(const std::string& fileName)
    272272{
    273273  PRINTF(4)("loading the oif File: %s\n", fileName.c_str());
    274274
     275  // first get all mount points from the model
     276  std::list<mountPointSkeleton> mpList = this->models[0]->getMountPoints();
     277
     278  // for each skeleton create a mounting point world entity
     279  std::list<mountPointSkeleton>::const_iterator it = mpList.begin();
     280  for( ; it != mpList.end(); it++)
     281  {
     282    MountPoint* mp = new MountPoint((*it).up, (*it).forward, (*it).center, (*it).name);
     283
     284    this->mountPoints.push_back(mp);
     285  }
     286
     287  // now load the object information file
    275288  this->oiFile = new ObjectInformationFile(fileName);
     289
     290
     291
    276292}
    277293
  • branches/mount_points/src/world_entities/world_entity.h

    r10147 r10184  
    5353  Model* getModel(unsigned int modelNumber = 0) const { return (this->models.size() > modelNumber)? this->models[modelNumber] : NULL; };
    5454
    55   void loadObjectInformationFile(const std::string& fileName);
     55  void loadMountPoints(const std::string& fileName);
    5656  inline void loadMD2Texture(const std::string& fileName) { this->md2TextureFileName = fileName; }
    5757
Note: See TracChangeset for help on using the changeset viewer.