Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7513 in orxonox.OLD for branches/bsp_model/src/lib


Ignore:
Timestamp:
May 3, 2006, 3:02:32 PM (19 years ago)
Author:
bensch
Message:

material updated, so now select first deselects tho old Material

Location:
branches/bsp_model/src/lib/graphics/importer
Files:
2 edited

Legend:

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

    r7510 r7513  
    7171  if (this->specularTexture != NULL)
    7272    ResourceManager::getInstance()->unload(this->specularTexture);
    73 }
     73
     74  if (this == Material::selectedMaterial)
     75    Material::selectedMaterial = NULL;
     76}
     77
     78
     79Material* Material::selectedMaterial = NULL;
     80
     81const GLenum Material::glTextureArbs[] =
     82{
     83  GL_TEXTURE0_ARB,
     84  GL_TEXTURE1_ARB,
     85  GL_TEXTURE2_ARB,
     86  GL_TEXTURE3_ARB,
     87  GL_TEXTURE4_ARB,
     88  GL_TEXTURE5_ARB,
     89  GL_TEXTURE6_ARB,
     90  GL_TEXTURE7_ARB
     91};
    7492
    7593
     
    94112// }
    95113
    96 const GLenum Material::glTextureArbs[] =
    97   {
    98     GL_TEXTURE0_ARB,
    99     GL_TEXTURE1_ARB,
    100     GL_TEXTURE2_ARB,
    101     GL_TEXTURE3_ARB,
    102     GL_TEXTURE4_ARB,
    103     GL_TEXTURE5_ARB,
    104     GL_TEXTURE6_ARB,
    105     GL_TEXTURE7_ARB
    106   };
    107114
    108115
     
    112119bool Material::select() const
    113120{
     121  if (unlikely(this == Material::selectedMaterial))
     122      return true;
     123
     124
    114125  // setting diffuse color
    115126  glColor4f (diffuse[0], diffuse[1], diffuse[2], this->transparency);
     
    141152    glShadeModel(GL_SMOOTH);
    142153
     154  if (likely(Material::selectedMaterial != NULL))
     155  {
     156    for(unsigned int i = 0; i < Material::selectedMaterial->textures.size(); ++i)
     157    {
     158        glActiveTexture(Material::glTextureArbs[i]);
     159        glBindTexture(GL_TEXTURE_2D, 0);
     160    }
     161  }
    143162
    144163  for(unsigned int i = 0; i < this->textures.size(); ++i)
  • branches/bsp_model/src/lib/graphics/importer/material.h

    r7510 r7513  
    6767
    6868  private:
    69     int         illumModel;       //!< The IlluminationModel is either flat or smooth.
    70     float       diffuse [4];      //!< The diffuse color of the Material.
    71     float       ambient [4];      //!< The ambient color of the Material.
    72     float       specular [4];     //!< The specular color of the Material.
    73     float       shininess;        //!< The shininess of the Material.
    74     float       transparency;     //!< The transperency of the Material.
    75     GLenum      sFactor;
    76     GLenum      tFactor;
     69    static Material* selectedMaterial; //!< The currently selected material.
    7770
    78     std::vector<Texture*> textures; //!< An Array of Textures.
     71    int              illumModel;       //!< The IlluminationModel is either flat or smooth.
     72    float            diffuse [4];      //!< The diffuse color of the Material.
     73    float            ambient [4];      //!< The ambient color of the Material.
     74    float            specular [4];     //!< The specular color of the Material.
     75    float            shininess;        //!< The shininess of the Material.
     76    float            transparency;     //!< The transperency of the Material.
     77    GLenum           sFactor;
     78    GLenum           tFactor;
    7979
    80     Texture*    ambientTexture;   //!< The ambient texture of the Material.
    81     Texture*    specularTexture;  //!< The specular texture of the Material.
     80    std::vector<Texture*> textures;    //!< An Array of Textures.
     81
     82    Texture*         ambientTexture;   //!< The ambient texture of the Material.
     83    Texture*         specularTexture;  //!< The specular texture of the Material.
    8284
    8385
Note: See TracChangeset for help on using the changeset viewer.