Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3952 in orxonox.OLD


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

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

Location:
orxonox/branches/particleEngine/src/lib/graphics
Files:
4 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);
  • orxonox/branches/particleEngine/src/lib/graphics/particles/particle_system.cc

    r3951 r3952  
    230230  //  glDisable(GL_LIGHTING);
    231231  material->select();
    232   glPushAttrib(GL_ENABLE_BIT);
    233   glDisable(GL_DEPTH_TEST);
    234   glDisable(GL_CULL_FACE);
    235   glDisable(GL_LIGHTING);  // will be set back when leaving 2D-mode
    236   glEnable(GL_TEXTURE_2D);
    237 
    238   /* This allows alpha blending of 2D textures with the scene */
    239   glEnable(GL_BLEND);
    240   glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    241 
    242232
    243233  Particle* drawPart = particles;
     
    259249      glEnd();
    260250    }
    261   glPopAttrib();
    262 
    263251}
    264252
Note: See TracChangeset for help on using the changeset viewer.