Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 3, 2006, 5:20:13 PM (18 years ago)
Author:
stefalie
Message:

branches/bsp_model: setSDLSurfaceDiffuseMap added to Material

File:
1 edited

Legend:

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

    r7513 r7524  
    167167      glActiveTexture(Material::glTextureArbs[i]);
    168168      glEnable(GL_TEXTURE_2D);
     169      if(this->textures[i]->hasAlpha())
     170      {
     171        glEnable(GL_BLEND);
     172      }
    169173      glBindTexture(GL_TEXTURE_2D, this->textures[i]->getTexture());
    170174    }
     
    355359
    356360/**
     361 *  Sets the Materials Diffuse Map
     362 * @param surface pointer to SDL_Surface which shall be used as texture
     363*/
     364void Material::setSDLDiffuseMap(SDL_Surface *surface, GLenum target, unsigned int textureNumber)
     365{
     366  assert(textureNumber < Material::getMaxTextureUnits());
     367
     368 
     369  if (this->textures.size() > textureNumber && this->textures[textureNumber] != NULL)
     370    ResourceManager::getInstance()->unload(this->textures[textureNumber]);
     371
     372  if (this->textures.size() <= textureNumber)
     373    this->textures.resize(textureNumber+1, NULL);
     374
     375  if(surface != NULL)
     376  {
     377    this->textures[textureNumber] = &Texture(surface, GL_TEXTURE_2D);
     378  }
     379  else
     380  {
     381    this->textures[textureNumber] = NULL;
     382  }
     383
     384}
     385
     386
     387/**
    357388 *  Sets the Materials Ambient Map
    358389 * @param aMap the Name of the Image to Use
Note: See TracChangeset for help on using the changeset viewer.