Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8376 in orxonox.OLD for trunk/src/lib/graphics/importer/material.cc


Ignore:
Timestamp:
Jun 14, 2006, 12:13:16 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: no more seg-fault when copying a Texture

File:
1 edited

Legend:

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

    r8370 r8376  
    132132
    133133    // setting diffuse color
    134   glColor4f (diffuse[0], diffuse[1], diffuse[2], this->transparency);
     134  glColor4f (diffuse.r(), diffuse.g(), diffuse.b(), diffuse.a());
    135135  // setting ambient color
    136   glMaterialfv(GL_FRONT, GL_AMBIENT, this->ambient);
     136  glMaterialfv(GL_FRONT, GL_AMBIENT, &this->ambient[0]);
    137137  // setting up Sprecular
    138   glMaterialfv(GL_FRONT, GL_SPECULAR, this->specular);
     138  glMaterialfv(GL_FRONT, GL_SPECULAR, &this->specular[0]);
    139139  // setting up Shininess
    140140  glMaterialf(GL_FRONT, GL_SHININESS, this->shininess);
    141141
    142142  // setting the transparency
    143   if (this->transparency < 1.0 ||       /* This allows alpha blending of 2D textures with the scene */
     143  if (this->diffuse.a() < 1.0 ||       /* This allows alpha blending of 2D textures with the scene */
    144144      (likely(!this->textures.empty() && this->textures[0].hasAlpha())))
    145145  {
     
    206206{
    207207  PRINTF(4)("setting Diffuse Color of Material %s to r=%f g=%f b=%f.\n", this->getName(), r, g, b);
    208   this->diffuse[0] = r;
    209   this->diffuse[1] = g;
    210   this->diffuse[2] = b;
    211   this->diffuse[3] = 1.0;
    212 
     208  this->diffuse = Color(r, g, b, this->diffuse.a() );
    213209}
    214210
     
    223219{
    224220  PRINTF(4)("setting Ambient Color of Material %s to r=%f g=%f b=%f.\n", this->getName(), r, g, b);
    225   this->ambient[0] = r;
    226   this->ambient[1] = g;
    227   this->ambient[2] = b;
    228   this->ambient[3] = 1.0;
     221  this->ambient = Color(r, g, b, 1.0);
    229222}
    230223
     
    238231{
    239232  PRINTF(4)("setting Specular Color of Material %s to r=%f g=%f b=%f.\n", this->getName(), r, g, b);
    240   this->specular[0] = r;
    241   this->specular[1] = g;
    242   this->specular[2] = b;
    243   this->specular[3] = 1.0;
     233  this->specular = Color (r, g, b, 1.0);
    244234}
    245235
     
    260250{
    261251  PRINTF(4)("setting Transparency of Material %s to %f.\n", this->getName(), trans);
    262   this->transparency = trans;
     252  this->diffuse.a() = trans;
    263253}
    264254
     
    310300    Texture* tex = dynamic_cast<Texture*>(ResourceManager::getInstance()->load(dMap, IMAGE, RP_GAME, (int)target));
    311301    if (tex != NULL)
    312     this->textures[textureNumber] = *tex;
     302      this->textures[textureNumber] = *tex;
    313303    else
    314304      this->textures[textureNumber] = Texture();
     
    373363 * @brief Sets the Materials Ambient Map
    374364 * @todo implement this
    375 */
     365 */
    376366void Material::setAmbientMap(const std::string& aMap, GLenum target)
    377367{
     
    383373 * @brief Sets the Materials Specular Map
    384374 * @param sMap the Name of the Image to Use
    385    @todo implement this
    386 */
     375 * @todo implement this
     376 */
    387377void Material::setSpecularMap(const std::string& sMap, GLenum target)
    388378{
     
    395385 * @param bump the Name of the Image to Use
    396386 * @todo implemet this
    397 */
     387 */
    398388void Material::setBump(const std::string& bump)
    399389{
Note: See TracChangeset for help on using the changeset viewer.