Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/branches/trackManager/src/importer/texture.h @ 3369

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

orxonox/branches: added branche trackManager.

File size: 2.4 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
12#include "../stdincl.h"
13extern int verbose;
14#ifdef HAVE_SDL_SDL_IMAGE_H
15#include <SDL/SDL_image.h>
16#else
17// IMAGE LIBS //
18#ifdef HAVE_JPEGLIB_H
19extern "C"{         // This has to be done, because not a c++ lib
20#include <jpeglib.h>
21}
22#endif /* HAVE_JPEGLIB_H */
23#ifdef HAVE_PNG_H
24#include <png.h>
25#endif /* HAVE_PNG_H */
26#endif /* HAVE_SDL_SDL_IMAGE_H */
27
28
29
30//! Class to handle lists of paths.
31/**
32   \todo Ability to return Paths by itself.
33
34   It is simple to use, and good, for all PathList you want.
35   just create a new Pathlist, and add Paths.
36*/
37class PathList
38{
39 private:
40  PathList();
41  static PathList* firstPath; //!< A static Pointer to the first PathList in the List.
42 public:
43  PathList(char* pName);
44  ~PathList();
45  static PathList* getInstance(void);
46 
47  void addPath (char* pName);
48  char* pathName;              //!< The Name of the current Path.
49  PathList* next;              //!< Pointer to the next Pathlist.
50};
51
52//! A Class, that reads in Textures from different fileformats.
53class Texture
54{
55 private:
56  //! Struct to handle Infos about an Image
57  struct Image
58  {
59    int rowSpan;    //!< The count of the rows this Image has.
60    GLuint width;   //!< The width of the Image.
61    GLuint height;  //!< The height of the Image.
[3343]62    GLuint bpp;     //!< BytesPerPixel
[3347]63    GLenum format;  //!< The Format of the PixelData
[3341]64    GLuint type;    //!< Type of the Image.
65    GLubyte *data;  //!< The Image Data comes here! DANGER: uncompressed data.
66  };
[3344]67  Image* pImage;
68  GLuint texture;
[3346]69  SDL_Surface* map;
[3341]70  char* searchTextureInPaths(char* texName) const;
[3343]71  inline void swap(unsigned char &a, unsigned char &b);
[3341]72 public:
[3344]73  Texture(void);
74  ~Texture(void);
[3341]75
[3345]76  inline GLuint getTexture(void) {return this->texture;} //!< \returns The textureID of this texture.
[3344]77  bool loadTexToGL (Image* pImage);
[3341]78
[3344]79  bool loadImage(char* imageName);
[3341]80#ifndef HAVE_SDL_SDL_IMAGE_H
81
[3344]82  bool loadBMP (char* bmpName);
[3341]83
[3344]84  bool loadJPG (char* jpgName);
[3341]85
86  /// TGA ///
87
[3344]88  bool loadTGA(const char * tgaName);
89  bool loadUncompressedTGA(const char * filename, FILE * fTGA);
90  bool loadCompressedTGA(const char * filename, FILE * fTGA);
[3341]91
92  bool loadPNG(const char* pngName, GLuint* texture);
93#endif
94
95
96};
97
98
99
100#endif /* _TEXTURE_H */
Note: See TracBrowser for help on using the repository browser.