Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Sep 28, 2006, 10:17:56 AM (18 years ago)
Author:
bensch
Message:

more nice comments, and also updated the KeepLevel loading (if you want to load a Resource to a KeepLevel just append it at loadtime:
eg.:
Texture tex = ResourceTexture(orxonox.png, GL_TEXTURE_2D, GameEnd);
where GameEnd is the KeepLevel as defined in orxonox.cc→initResources()

Location:
branches/new_class_id/src/lib/graphics/importer
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • branches/new_class_id/src/lib/graphics/importer/md2/resource_md2.cc

    r9847 r9854  
    66
    77
    8 ResourceMD2::ResourceMD2(const std::string& modelName, const std::string& skinName, float scale)
     8ResourceMD2::ResourceMD2(const std::string& modelName, const std::string& skinName, float scale, const Resources::KeepLevel& keepLevel)
    99    : Resource(&ResourceMD2::type)
    1010{
     
    2222    //std::string skinFileName = this->Resource::locateFile(skinName);
    2323    this->MD2Model::load(modelFileName, skinName, scale);
    24     this->Resource::addResource(new ResourceMD2::MD2ResourcePointer(loadString(modelName, skinName, scale), Resources::KeepLevel(0), this->MD2Model::dataPointer()));
     24    this->Resource::addResource(new ResourceMD2::MD2ResourcePointer(loadString(modelName, skinName, scale), keepLevel, this->MD2Model::dataPointer()));
    2525  }
    2626
    2727}
    2828
    29 ResourceMD2 ResourceMD2::createFromString(const std::string& loadString)
     29ResourceMD2 ResourceMD2::createFromString(const std::string& loadString, const Resources::KeepLevel& keepLevel)
    3030{
    3131  SubString loadValues(loadString, ',');
     
    4040    scale = MultiType(loadValues[2]).getFloat();
    4141
    42   return ResourceMD2(modelName, skinName, scale);
     42  return ResourceMD2(modelName, skinName, scale, keepLevel);
    4343}
    4444
  • branches/new_class_id/src/lib/graphics/importer/md2/resource_md2.h

    r9847 r9854  
    1515{
    1616public:
    17   ResourceMD2(const std::string& modelName, const std::string& skinName = "", float scale = 1.0f);
    18   static ResourceMD2 createFromString(const std::string& loadString);
     17  ResourceMD2(const std::string& modelName,
     18              const std::string& skinName = "",
     19              float scale = 1.0f,
     20              const Resources::KeepLevel& keepLevel = Resources::KeepLevel());
     21  static ResourceMD2 createFromString(const std::string& loadString, const Resources::KeepLevel& keepLevel = Resources::KeepLevel());
    1922  static std::string loadString(const std::string& modelName, const std::string& skinName = "", float scale = 1.0f);
    2023
  • branches/new_class_id/src/lib/graphics/importer/resource_obj.cc

    r9847 r9854  
    66
    77
    8 ResourceOBJ::ResourceOBJ(const std::string& imageName, float scaling)
     8ResourceOBJ::ResourceOBJ(const std::string& imageName, float scaling, const Resources::KeepLevel& keepLevel)
    99    : Resource(&ResourceOBJ::type)
    1010{
     
    2121    std::string fileName = this->Resource::locateFile(imageName);
    2222    this->acquireData(OBJModel(fileName, scaling).dataPointer());
    23     this->Resource::addResource(new ResourceOBJ::OBJResourcePointer(imageName + ',' + MultiType(scaling).getString(), Resources::KeepLevel(0), this->StaticModel::dataPointer()));
     23    this->Resource::addResource(new ResourceOBJ::OBJResourcePointer(imageName + ',' + MultiType(scaling).getString(), keepLevel, this->StaticModel::dataPointer()));
    2424  }
    2525}
    2626
    27 ResourceOBJ ResourceOBJ::createFromString(const std::string& loadString)
     27ResourceOBJ ResourceOBJ::createFromString(const std::string& loadString, const Resources::KeepLevel& keepLevel)
    2828{
    2929  SubString loadValues(loadString, ',');
     
    3535    scaling = (GLenum)MultiType(loadValues[2]).getFloat();
    3636
    37   return ResourceOBJ(imageName, scaling);
     37  return ResourceOBJ(imageName, scaling, keepLevel);
    3838}
    3939
  • branches/new_class_id/src/lib/graphics/importer/resource_obj.h

    r9847 r9854  
    1414{
    1515public:
    16   ResourceOBJ(const std::string& imageName, float scaling = 1.0f);
    17   static ResourceOBJ createFromString(const std::string& loadString);
     16  ResourceOBJ(const std::string& imageName,
     17              float scaling = 1.0f,
     18              const Resources::KeepLevel& keepLevel = Resources::KeepLevel());
     19  static ResourceOBJ createFromString(const std::string& loadString,
     20                                      const Resources::KeepLevel& keepLevel = Resources::KeepLevel());
    1821
    1922private:
  • branches/new_class_id/src/lib/graphics/importer/resource_texture.cc

    r9847 r9854  
    66
    77
    8 ResourceTexture::ResourceTexture(const std::string& imageName, GLenum target)
     8ResourceTexture::ResourceTexture(const std::string& imageName, GLenum target, const Resources::KeepLevel& keepLevel)
    99    : Resource(&ResourceTexture::type)
    1010{
     
    2121    std::string fileName = this->Resource::locateFile(imageName);
    2222    this->Texture::loadImage(fileName, target);
    23     this->Resource::addResource(new ResourceTexture::TextureResourcePointer(imageName + ',' + MultiType((int)target).getString(), Resources::KeepLevel(0), this->Texture::dataPointer()));
     23    this->Resource::addResource(new ResourceTexture::TextureResourcePointer(imageName + ',' + MultiType((int)target).getString(), keepLevel, this->Texture::dataPointer()));
    2424  }
    2525}
    2626
    27 ResourceTexture ResourceTexture::createFromString(const std::string& loadString)
     27ResourceTexture ResourceTexture::createFromString(const std::string& loadString, const Resources::KeepLevel& keepLevel)
    2828{
    2929  SubString loadValues(loadString, ',');
     
    3535    target = (GLenum)MultiType(loadValues[2]).getInt();
    3636
    37   return ResourceTexture(imageName, target);
     37  return ResourceTexture(imageName, target, keepLevel);
    3838}
    3939
  • branches/new_class_id/src/lib/graphics/importer/resource_texture.h

    r9847 r9854  
    1515{
    1616public:
    17   ResourceTexture(const std::string& imageName, GLenum target = GL_TEXTURE_2D);
    18   static ResourceTexture createFromString(const std::string& loadString);
     17  ResourceTexture(const std::string& imageName,
     18                  GLenum target = GL_TEXTURE_2D,
     19                  const Resources::KeepLevel& keepLevel = Resources::KeepLevel());
     20  static ResourceTexture createFromString(const std::string& loadString,
     21                                          const Resources::KeepLevel& keepLevel = Resources::KeepLevel());
    1922
    2023private:
Note: See TracChangeset for help on using the changeset viewer.