Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5863 in orxonox.OLD for trunk/src/lib/graphics/importer/texture.cc


Ignore:
Timestamp:
Dec 1, 2005, 9:14:30 PM (18 years ago)
Author:
bensch
Message:

orxonox/trunk: TextureSequence finished for testing

File:
1 edited

Legend:

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

    r5860 r5863  
    4545}
    4646
     47
    4748/**
    4849 *  Destructor of a Texture
     
    5758    SDL_FreeSurface(this->image);
    5859}
     60
    5961
    6062/**
     
    114116}
    115117
     118
     119/**
     120 * rebuilds the texture.
     121 * reloads the Texture from Memory to OpenGL.
     122 */
    116123bool Texture::rebuild()
    117124{
     
    128135      this->setTexture(loadTexToGL(this->image));
    129136    }
    130 
    131 }
    132 
     137}
     138
     139
     140/**
     141 * set the surface this Texture handles
     142 * @param newSurface the new Surface to set as the image for this Texture.
     143 *
     144 * This deletes the old version of the stored Texture,
     145 * and sets the newly given Surface as current.
     146 */
     147bool Texture::setSurface(SDL_Surface* newSurface)
     148{
     149  if (this->image != NULL)
     150    SDL_FreeSurface(this->image);
     151
     152  this->image = newSurface;
     153
     154  return (this->image != NULL);
     155}
     156
     157
     158bool Texture::texturesEnabled = true;
     159
     160/**
     161 * enables, disables textures
     162 * @param texturesEnabled true if the textures should be enabled
     163 */
     164void Texture::setTextureEnableState(bool texturesEnabled)
     165{
     166  Texture::texturesEnabled = texturesEnabled;
     167}
     168
     169
     170//////////////////////////////////////
     171// UTILITY FUNCTIONALITY OF TEXTURE //
     172//////////////////////////////////////
    133173/**
    134174 * converts surface to a new SDL_Surface, that is loadable by openGL
     
    148188  hasAlpha = false;
    149189  retSurface = SDL_CreateRGBSurface(SDL_SWSURFACE,
    150                                surface->w, surface->h,
    151                                32,
     190                                    surface->w, surface->h,
     191                                    32,
    152192#if SDL_BYTEORDER == SDL_LIL_ENDIAN /* OpenGL RGBA masks */
    153193                               0x000000FF,
     
    156196                               0xFF000000
    157197#else
    158                                0xFF000000,
     198                                   0xFF000000,
    159199                               0x00FF0000,
    160200                               0x0000FF00,
    161201                               0x000000FF
    162202#endif
    163                                );
     203                                   );
    164204  if ( retSurface == NULL )
    165205  {
     
    191231}
    192232
    193 /**
    194  * set the surface this Texture handles
    195  * @param newSurface the new Surface to set as the image for this Texture.
    196  *
    197  * This deletes the old version of the stored Texture,
    198  * and sets the newly given Surface as current.
    199  */
    200 bool Texture::setSurface(SDL_Surface* newSurface)
    201 {
    202   if (this->image != NULL)
    203     SDL_FreeSurface(this->image);
    204 
    205   this->image = newSurface;
    206 
    207   return (this->image != NULL);
    208 }
    209 
    210 
    211 bool Texture::texturesEnabled = true;
    212 
    213 /**
    214  * enables, disables textures
    215  * @param texturesEnabled true if the textures should be enabled
    216  */
    217 void Texture::setTextureEnableState(bool texturesEnabled)
    218 {
    219   Texture::texturesEnabled = texturesEnabled;
    220 }
    221 
    222 
    223 //////////////////////////////////////
    224 // UTILITY FUNCTIONALITY OF TEXTURE //
    225 //////////////////////////////////////
     233
    226234/**
    227235 *  Loads a Texture to the openGL-environment.
Note: See TracChangeset for help on using the changeset viewer.