Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 25, 2005, 1:10:24 AM (20 years ago)
Author:
bensch
Message:

orxonox/branches/particleEngine: blending now an option of material

Location:
orxonox/branches/particleEngine/src/lib/graphics/importer
Files:
3 edited

Legend:

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

    r3946 r3952  
    100100    }
    101101
     102
    102103  // setting illumination Model
    103104  if (this->illumModel == 1) //! \todo make this work, if no vertex-normals are read.
     
    110111      glEnable(GL_TEXTURE_2D);
    111112      glBindTexture(GL_TEXTURE_2D, this->diffuseTexture->getTexture());
     113
     114      /* This allows alpha blending of 2D textures with the scene */
     115      if (this->diffuseTexture->hasAlpha())
     116        {
     117          glEnable(GL_BLEND);
     118          glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
     119        }
    112120    }
    113121  else
  • orxonox/branches/particleEngine/src/lib/graphics/importer/texture.cc

    r3947 r3952  
    2525Texture::Texture(const char* imageName)
    2626{
     27  bAlpha = false;
    2728  this->texture = 0;
    2829  if (imageName)
     
    112113      if ( (saved_flags & SDL_SRCALPHA) == SDL_SRCALPHA ) {
    113114        SDL_SetAlpha(surface, saved_flags | SDL_OPENGL, saved_alpha);
     115        this->bAlpha = true;
    114116      }
    115117     
  • orxonox/branches/particleEngine/src/lib/graphics/importer/texture.h

    r3905 r3952  
    2323  char* searchTextureInPaths(const char* texName) const;
    2424  void swap(unsigned char &a, unsigned char &b);
     25
     26  bool bAlpha;           //!< if the texture has an alpha channel.
    2527 public:
    2628  Texture(const char* imageName = NULL);
     
    3032  inline GLuint getTexture(void) {return this->texture;}
    3133  GLuint loadTexToGL (SDL_Surface* surface);
     34  inline bool hasAlpha(void) {return bAlpha;}
    3235
    3336  bool loadImage(const char* imageName);
Note: See TracChangeset for help on using the changeset viewer.