Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/trunk/src/lib/graphics/importer/texture.h @ 3790

Last change on this file since 3790 was 3790, checked in by bensch, 19 years ago

orxonox/trunk: merged the textEngine back into the trunk.
merged with command:
svn merge -r 3681:HEAD branches/textEngine/ trunk/

conflicts in:
world.cc/h orxonox.cc NEWS
changed in favor of the trunk

File size: 2.0 KB
RevLine 
[3341]1/*!
2  \file texture.h
3  \brief Contains the texture class, that handles the reading of Images into Texutre-files.
4
5  \todo free SDL-surface when deleting Material.
6  \todo delete imgNameWithPath after use creation.
7*/
8
9#ifndef _TEXTURE_H
10#define _TEXTURE_H
11
[3548]12#include "glincl.h"
13
14#include "debug.h"
15
[3790]16#ifdef HAVE_SDL_IMAGE_H
17#include <SDL_image.h>
[3341]18#else
19// IMAGE LIBS //
20#ifdef HAVE_JPEGLIB_H
21extern "C"{         // This has to be done, because not a c++ lib
22#include <jpeglib.h>
23}
24#endif /* HAVE_JPEGLIB_H */
25#ifdef HAVE_PNG_H
26#include <png.h>
27#endif /* HAVE_PNG_H */
[3790]28#endif /* HAVE_SDL_IMAGE_H */
[3341]29
30//! A Class, that reads in Textures from different fileformats.
31class Texture
32{
33 private:
34  //! Struct to handle Infos about an Image
35  struct Image
36  {
37    int rowSpan;    //!< The count of the rows this Image has.
38    GLuint width;   //!< The width of the Image.
39    GLuint height;  //!< The height of the Image.
[3343]40    GLuint bpp;     //!< BytesPerPixel
[3347]41    GLenum format;  //!< The Format of the PixelData
[3341]42    GLuint type;    //!< Type of the Image.
43    GLubyte *data;  //!< The Image Data comes here! DANGER: uncompressed data.
44  };
[3454]45  Image* pImage;    //!< The data of an Image
46  GLuint texture;   //!< The Texture-ID of opengl from this Texture.
47  SDL_Surface* map; //!< The map SDL initializes for this element.
[3655]48  char* searchTextureInPaths(const char* texName) const;
[3343]49  inline void swap(unsigned char &a, unsigned char &b);
[3341]50 public:
[3344]51  Texture(void);
[3655]52  Texture(const char* imageName);
[3344]53  ~Texture(void);
[3454]54  /** \returns The textureID of this texture.  */
55  inline GLuint getTexture(void) {return this->texture;} 
[3344]56  bool loadTexToGL (Image* pImage);
[3341]57
[3655]58  bool loadImage(const char* imageName);
[3790]59#ifndef HAVE_SDL_IMAGE_H
[3341]60
[3344]61  bool loadBMP (char* bmpName);
[3341]62
[3344]63  bool loadJPG (char* jpgName);
[3341]64
65  /// TGA ///
66
[3344]67  bool loadTGA(const char * tgaName);
68  bool loadUncompressedTGA(const char * filename, FILE * fTGA);
69  bool loadCompressedTGA(const char * filename, FILE * fTGA);
[3341]70
[3454]71  bool loadPNG(const char* pngName);
[3341]72#endif
73
74
75};
76#endif /* _TEXTURE_H */
Note: See TracBrowser for help on using the repository browser.