Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Sep 22, 2006, 3:40:06 PM (18 years ago)
Author:
bensch
Message:

some implementations of the new self sustained Resources. It works, but does not yet load the correct stuff

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

Legend:

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

    r9718 r9785  
    2525#include "loading/load_param.h"
    2626
    27 #include "util/loading/resource_manager.h"
     27#include "resource_texture.h"
     28//#include "util/loading/resource_manager.h"
    2829
    2930ObjectListDefinition(Material);
     
    9192{
    9293  PRINTF(5)("delete Material %s.\n", this->getCName());
    93 
    94   if (this->ambientTexture != NULL)
    95     ResourceManager::getInstance()->unload(this->ambientTexture);
    96   if (this->specularTexture != NULL)
    97     ResourceManager::getInstance()->unload(this->specularTexture);
    9894
    9995  if (this == Material::selectedMaterial)
     
    297293void Material::addTexturePath(const std::string& pathName)
    298294{
    299   ResourceManager::getInstance()->addImageDir(pathName);
     295  printf("HUPS\n");
     296  //ResourceManager::getInstance()->addImageDir(pathName);
    300297}
    301298
     
    351348  if (!dMap.empty())
    352349  {
    353     Texture* tex = dynamic_cast<Texture*>(ResourceManager::getInstance()->load(dMap, IMAGE, RP_GAME, (int)target));
    354     if (tex != NULL)
    355       this->textures[textureNumber] = *tex;
     350    this->textures[textureNumber] = ResourceTexture(dMap);
     351        //dynamic_cast<Texture*>(ResourceManager::getInstance()->load(dMap, IMAGE, RP_GAME, (int)target));
     352/*    if (tex != NULL)
     353      this->textures[textureNumber] = tex;
    356354    else
    357       this->textures[textureNumber] = Texture();
     355      this->textures[textureNumber] = Texture();*/
    358356  }
    359357  else
  • branches/new_class_id/src/lib/graphics/importer/resource_texture.cc

    r9784 r9785  
    66
    77ResourceTexture::ResourceTexture(const std::string& imageName, GLenum target)
     8    : Resource(&ResourceTexture::type)
    89{
    9   Resource::Pointer* ptr = this->acquireResource(ResourceTexture::type, imageName + ',' + "TEST");
     10  Resource::Pointer* ptr = this->acquireResource(imageName + ',' + "TEST");
    1011
    1112  if (ptr)
     
    1314  else
    1415  {
    15     this->loadImage(imageName, target);
     16    std::string fileName = this->Resource::locateFile(imageName);
     17    this->Texture::loadImage(fileName, target);
     18    this->Resource::addResource(new ResourceTexture::TextureResourcePointer(imageName + ',' + "TEST", KeepLevel(), this->Texture::dataPointer()));
    1619  }
    1720}
     
    2427
    2528
    26 ResourceTexture::TextureResourcePointer::TextureResourcePointer(const std::string& loadString, const Resource::KeepLevel& keepLevel, TextureData* data)
     29ResourceTexture::TextureResourcePointer::TextureResourcePointer(const std::string& loadString, const Resource::KeepLevel& keepLevel, const TextureData::Pointer& data)
    2730    : Resource::Pointer(loadString, keepLevel) , pointer(data)
    28 {
    29 }
     31{}
    3032
    3133
  • branches/new_class_id/src/lib/graphics/importer/resource_texture.h

    r9784 r9785  
    1414class ResourceTexture : public Texture, public Resource
    1515{
     16public:
    1617  ResourceTexture(const std::string& imageName, GLenum target = GL_TEXTURE_2D);
    1718
    1819
    1920private:
    20   class TextureResourcePointer : public Resource::Pointer
     21class TextureResourcePointer : public Resource::Pointer
    2122  {
    2223  public:
    23     TextureResourcePointer(const std::string& loadString, const Resource::KeepLevel& keepLevel, TextureData* data);
     24    TextureResourcePointer(const std::string& loadString, const Resource::KeepLevel& keepLevel, const TextureData::Pointer& data);
    2425    inline const TextureData::Pointer& ptr() const { return pointer; }
    2526  private:
     
    2728  };
    2829
    29   private:
    30     static Resource::Type type;
     30private:
     31  static Resource::Type type;
    3132};
    3233
Note: See TracChangeset for help on using the changeset viewer.