Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10314 in orxonox.OLD for trunk/src/lib/graphics/importer/oif


Ignore:
Timestamp:
Jan 24, 2007, 12:45:39 AM (17 years ago)
Author:
patrick
Message:

merged branche mount_point to trunk. this will add mount point abilities, bsp transparency fix and some other smaller stuff to this trunk

Location:
trunk/src/lib/graphics/importer/oif
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/graphics/importer/oif/object_information_file.cc

    r10147 r10314  
    2424
    2525
     26
     27/**
     28 * constructor
     29 */
     30OIFData::OIFData()
     31{
     32  this->_root = NULL;
     33}
     34
     35
    2636/**
    2737 * constructor
     
    3040OIFData::OIFData(const std::string& fileName)
    3141{
     42  this->_root = NULL;
    3243  this->load(fileName);
     44}
     45
     46
     47OIFData::~OIFData()
     48{
     49  if( this->_root)
     50    delete this->_root;
    3351}
    3452
     
    4058void OIFData::load(const std::string& fileName)
    4159{
    42   //
    43     if( fileName.empty())
     60  if( fileName.empty())
    4461  {
    45     PRINTF(3)("No filename specified for object information loading");
     62    PRINTF(1)("No filename specified for object information loading");
    4663    return;
    4764  }
    4865
    49   TiXmlDocument XMLDoc(fileName);
     66  TiXmlDocument* XMLDoc = new TiXmlDocument(fileName);
    5067  // load the campaign document
    51   if( !XMLDoc.LoadFile(fileName))
     68  if( !XMLDoc->LoadFile(fileName))
    5269  {
    5370    // report an error
    54     PRINTF(3)("Could not load XML File %s: %s @ %d:%d\n", fileName.c_str(), XMLDoc.ErrorDesc(), XMLDoc.ErrorRow(), XMLDoc.ErrorCol());
     71    PRINTF(1)("Could not load XML File %s: %s @ %d:%d\n", fileName.c_str(), XMLDoc->ErrorDesc(), XMLDoc->ErrorRow(), XMLDoc->ErrorCol());
    5572    return;
    5673  }
    5774
    5875  // check basic validity
    59   TiXmlElement* root = XMLDoc.RootElement();
    60   assert( root != NULL);
     76  this->_root = XMLDoc->RootElement();
     77  assert( this->_root != NULL);
    6178
    62   if( strcmp( root->Value(), "ObjectInformationFile"))
     79  if( strcmp( this->_root->Value(), "ObjectInformationFile"))
    6380  {
    6481    // report an error
    65     PRINTF(2)("Specified XML File is not an orxonox object information file (<ObjectInformationFile> element missing)\n");
     82    PRINTF(1)("Specified XML File is not an orxonox object information file (<ObjectInformationFile> element missing)\n");
    6683    return;
    6784  }
    6885
    69   // construct campaign
    70 //   return new Campaign( root);
     86//   this->initMountPoint( this->_root);
    7187}
    7288
    7389
    74 
    7590/**
    76  * standard constructor
     91 * constructor
     92 * @param fileName name of the file
    7793 */
    7894ObjectInformationFile::ObjectInformationFile()
     95  : data(new OIFData)
    7996{
    8097  this->init();
     
    107124
    108125/**
     126 * the definition of the assignment operator
     127 * @param oif
     128 * @return
     129 */
     130ObjectInformationFile& ObjectInformationFile::operator=(const ObjectInformationFile& oif)
     131{
     132  this->init();
     133  this->data = oif.data;
     134
     135  return *this;
     136}
     137
     138/**
    109139 * initizlizing function
    110140 */
     
    112142{
    113143
     144}
     145
     146
     147void ObjectInformationFile::load(const std::string& fileName)
     148{
     149  this->data = OIFData::Pointer(new OIFData(fileName));
    114150}
    115151
     
    124160
    125161
     162/**
     163 * this initializes the mount point
     164 * @param mountPoint to be initialized
     165 */
     166// void ObjectInformationFile::initMountPoint(MountPoint* mountPoint)
     167// {
     168//   TiXmlElement* root = this->data->root();
     169//
     170// }
    126171
    127 ObjectInformationFile& ObjectInformationFile::operator=(const ObjectInformationFile& oif)
    128 {
    129   this->data = oif.data;
    130   return *this;
    131 }
    132 
    133 
    134 
  • trunk/src/lib/graphics/importer/oif/object_information_file.h

    r10147 r10314  
    2020
    2121public:
     22  OIFData();
    2223  OIFData(const std::string& fileName);
    23   virtual ~OIFData() {}
     24  virtual ~OIFData();
    2425
    2526  void load(const std::string& fileName);
     27  void initMountPoint(const TiXmlElement* root);
     28
     29  inline const TiXmlElement* root() { return this->_root; }
    2630
    2731
    2832private:
    29 
     33  TiXmlElement* _root;           //!< root of the xml file
    3034};
    3135
     
    4044  virtual ~ObjectInformationFile();
    4145
     46  void load(const std::string& fileName);
     47
    4248  ObjectInformationFile& operator=(const ObjectInformationFile& oif);
     49
     50  /** @returns a reference to the xml oif file */
     51  inline const TiXmlElement* getMountPointDescription() { return this->data->root(); }
     52
     53  inline void acquireData(const OIFData::Pointer& data) { this->data = data; }
     54  const OIFData::Pointer& dataPointer() const { return this->data; };
     55
     56
    4357
    4458  private:
  • trunk/src/lib/graphics/importer/oif/resource_oif.cc

    r10147 r10314  
    2626  Resources::StorePointer* ptr = this->acquireResource(fileName);
    2727
     28
    2829  if (ptr)
    2930  {
    30     PRINTF(0)("FOUND OIF: %s\n", fileName.c_str());
    31     //this->acquireData(static_cast<ResourceOIF::OIFResourcePointer*>(ptr)->ptr());
     31    PRINTF(5)("FOUND OIF: %s\n", fileName.c_str());
     32    this->acquireData(static_cast<ResourceOIF::OIFResourcePointer*>(ptr)->ptr());
    3233  }
    3334  else
    3435  {
    35     PRINTF(4)("NOT FOUND OIF: %s\n", fileName.c_str());
    36 //     std::string modelFileName = this->Resource::locateFile(modelName);
    37 //     //std::string skinFileName = this->Resource::locateFile(skinName);
    38 //     this->MD2Model::load(modelFileName, skinName, scale);
    39 //     this->Resource::addResource(new ResourceOIF::OIFResourcePointer(loadString(modelName, skinName, scale), keepLevel, this->MD2Model::dataPointer()));
     36    PRINTF(5)("NOT FOUND OIF: %s\n", fileName.c_str());
     37    std::string fullName = this->Resource::locateFile(fileName);
     38    PRINTF(5)("trying loading of: %s\n", fullName.c_str());
     39    this->load(fullName);
     40    this->Resource::addResource(new ResourceOIF::OIFResourcePointer(fileName, keepLevel, this->ObjectInformationFile::dataPointer()));
    4041  }
    4142
  • trunk/src/lib/graphics/importer/oif/resource_oif.h

    r10147 r10314  
    1515{
    1616public:
    17   ResourceOIF(const std::string& fileName, const Resources::KeepLevel& keepLevel = Resources::KeepLevel());
     17  ResourceOIF(const std::string& fileName,
     18              const Resources::KeepLevel& keepLevel = Resources::KeepLevel());
    1819  static ResourceOIF createFromString(const std::string& loadString, const Resources::KeepLevel& keepLevel = Resources::KeepLevel());
    1920
Note: See TracChangeset for help on using the changeset viewer.