Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


Ignore:
Timestamp:
Oct 8, 2005, 12:32:52 AM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: Fixed a reversive BUG in the ResourceManager:
Since resources, that depend on each other are loaded left tgo right they must be unlinked right to left… this cost me 3 hours.
What a luck i found this :)

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

Legend:

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

    r5306 r5308  
    5757Material::~Material()
    5858{
    59   PRINTF(4)("delete Material %s.\n", this->getName());
     59  PRINTF(5)("delete Material %s.\n", this->getName());
    6060
    6161  if (this->diffuseTexture != NULL)
     62  {
    6263    ResourceManager::getInstance()->unload(this->diffuseTexture);
     64  }
    6365  if (this->ambientTexture != NULL)
    6466    ResourceManager::getInstance()->unload(this->ambientTexture);
     
    6971/**
    7072 *  sets the material with which the following Faces will be painted
    71 */
    72 bool Material::select ()
     73 */
     74bool Material::select () const
    7375{
    7476  // setting diffuse color
     
    127129 *  Sets the Material Illumination Model.
    128130 *  illu illumination Model in int form
    129 */
     131 */
    130132void Material::setIllum (int illum)
    131133{
     
    133135  this->illumModel = illum;
    134136}
     137
    135138/**
    136139 *  Sets the Material Illumination Model.
    137140 *  illu illumination Model in char* form
    138 */void Material::setIllum (char* illum)
     141 */
     142void Material::setIllum (char* illum)
    139143{
    140144  this->setIllum (atoi(illum));
     
    146150 * @param g Green Color Channel.
    147151 * @param b Blue Color Channel.
    148 */
     152 */
    149153void Material::setDiffuse (float r, float g, float b)
    150154{
     
    156160
    157161}
     162
    158163/**
    159164 *  Sets the Material Diffuse Color.
    160165 * @param rgb The red, green, blue channel in char format (with spaces between them)
    161 */
     166 */
    162167void Material::setDiffuse (char* rgb)
    163168{
     
    181186  this->ambient[3] = 1.0;
    182187}
     188
    183189/**
    184190 *  Sets the Material Ambient Color.
    185191 * @param rgb The red, green, blue channel in char format (with spaces between them)
    186 */
     192 */
    187193void Material::setAmbient (char* rgb)
    188194{
     
    197203 * @param g Green Color Channel.
    198204 * @param b Blue Color Channel.
    199 */
     205 */
    200206void Material::setSpecular (float r, float g, float b)
    201207{
     
    206212  this->specular[3] = 1.0;
    207213 }
     214
    208215/**
    209216 *  Sets the Material Specular Color.
     
    269276void Material::setDiffuseMap(const char* dMap)
    270277{
    271   PRINTF(4)("setting Diffuse Map %s\n", dMap);
     278  PRINTF(5)("setting Diffuse Map %s\n", dMap);
    272279  if (this->diffuseTexture != NULL)
    273280    ResourceManager::getInstance()->unload(this->diffuseTexture);
  • trunk/src/lib/graphics/importer/material.h

    r4836 r5308  
    2626 public:
    2727  Material (const char* mtlName = NULL);
    28   ~Material ();
     28  virtual ~Material ();
    2929
    30   bool select ();
     30  bool select () const;
    3131
    3232  void setIllum (int illum);
     
    5858  float       shininess;        //!< The shininess of the Material.
    5959  float       transparency;     //!< The transperency of the Material.
    60 
     60  public:
    6161  Texture*    diffuseTexture;   //!< The diffuse texture of the Material.
    6262  Texture*    ambientTexture;   //!< The ambient texture of the Material.
  • trunk/src/lib/graphics/importer/model.cc

    r5304 r5308  
    6565
    6666  this->next = NULL;
    67 
    6867}
    6968
     
    383382//////////
    384383/**
    385  *  adds a new Material to the Material List
     384 * adds a new Material to the Material List
    386385 * @param material the Material to add
    387386 * @returns the added material
     
    392391Material* Model::addMaterial(Material* material)
    393392{
     393  if (material == NULL)
     394    return NULL;
    394395  ModelMaterial* modMat = new ModelMaterial;
    395396  modMat->external = true;
     
    408409  ModelMaterial* modMat = new ModelMaterial;
    409410  modMat->external = false;
    410   modMat->material = new Material();
    411   modMat->material->setName(materialName);
     411  modMat->material = new Material(materialName);
    412412
    413413  // adding material to the List of materials
     
    474474  float subbuffer3;
    475475  sscanf (vertexString, "%f %f %f", &subbuffer1, &subbuffer2, &subbuffer3);
    476   PRINTF(5)("reading in a vertex: %f %f %f\n", &subbuffer1, &subbuffer2, &subbuffer3);
    477476  this->vertices->addEntry(subbuffer1*scaleFactor, subbuffer2*scaleFactor, subbuffer3*scaleFactor);
    478477  this->vertexCount++;
     
    507506  float subbuffer3;
    508507  sscanf (normalString, "%f %f %f", &subbuffer1, &subbuffer2, &subbuffer3);
    509   PRINTF(5)("found vertex-Normal %f, %f, %f\n", &subbuffer1,&subbuffer2,&subbuffer3);
    510508  this->normals->addEntry(subbuffer1, subbuffer2, subbuffer3);
    511509  this->normalCount++;
     
    543541  float subbuffer2;
    544542  sscanf (vTextureString, "%f %f", &subbuffer1, &subbuffer2);
    545   PRINTF(5)("found vertex-Texture %f, %f\n", &subbuffer1, &subbuffer2);
    546543  this->vTexture->addEntry(subbuffer1);
    547544  this->vTexture->addEntry(1 - subbuffer2);
     
    659656
    660657/**
    661  *  Function that selects a material, if changed in the obj file.
     658 * Function that selects a material, if changed in the obj file.
    662659 * @param matString the Material that will be set.
    663660*/
     
    674671
    675672/**
    676  *  Function that selects a material, if changed in the obj file.
     673 * Function that selects a material, if changed in the obj file.
    677674 * @param mtl the Material that will be set.
    678675*/
     
    11061103  this->addFace (4, VERTEX_TEXCOORD_NORMAL, 1,1,16, 7,10,17, 5,11,18, 3,3,19);
    11071104  this->addFace (4, VERTEX_TEXCOORD_NORMAL, 6,12,20, 0,0,21, 2,2,22, 4,13,23);
    1108 
    1109 }
     1105}
  • trunk/src/lib/graphics/importer/texture.h

    r5304 r5308  
    2121
    2222//! A Class, that reads in Textures from different fileformats.
    23 class Texture : public  BaseObject
     23class Texture : public BaseObject
    2424{
    2525 public:
Note: See TracChangeset for help on using the changeset viewer.