Changeset 3343 in orxonox.OLD for orxonox/branches
- Timestamp:
- Jan 5, 2005, 3:39:08 PM (20 years ago)
- Location:
- orxonox/branches/parenting/src/importer
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/parenting/src/importer/texture.cc
r3341 r3343 146 146 return NULL; 147 147 } 148 149 inline void Texture::swap (unsigned char &a, unsigned char &b) 150 { 151 unsigned char temp; 152 temp = a; 153 a = b; 154 b = temp; 155 } 156 148 157 149 158 /** … … 186 195 pImage->width = map->w; 187 196 pImage->data = (GLubyte*)map->pixels; 197 pImage->bpp = 3;//map->BytesPerPixel; 188 198 if( !IMG_isPNG(SDL_RWFromFile(imgNameWithPath, "rb")) && !IMG_isJPG(SDL_RWFromFile(imgNameWithPath, "rb"))) 189 199 for (int i=0;i<map->h * map->w *3;i+=3) … … 193 203 pImage->data[i+2] = temp; 194 204 } 205 /* this is the real swapping algorithm */ 206 for( int i = 0 ; i < (pImage->height / 2) ; ++i ) 207 for( int j = 0 ; j < pImage->width * pImage->bpp; j += pImage->bpp ) 208 for(int k = 0; k < pImage->bpp; ++k) 209 swap( pImage->data[ (i * pImage->width * pImage->bpp) + j + k], pImage->data[ ( (pImage->height - i - 1) * pImage->width * pImage->bpp ) + j + k]); 210 195 211 this->loadTexToGL (pImage, texture); 196 212 } -
orxonox/branches/parenting/src/importer/texture.h
r3341 r3343 60 60 GLuint width; //!< The width of the Image. 61 61 GLuint height; //!< The height of the Image. 62 GLuint bpp; //!< B itsPerPixel62 GLuint bpp; //!< BytesPerPixel 63 63 GLuint type; //!< Type of the Image. 64 64 GLubyte *data; //!< The Image Data comes here! DANGER: uncompressed data. 65 65 }; 66 66 char* searchTextureInPaths(char* texName) const; 67 67 inline void swap(unsigned char &a, unsigned char &b); 68 68 public: 69 69
Note: See TracChangeset
for help on using the changeset viewer.