Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/branches/parenting/src/importer/texture.h @ 3341

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

orxonox/branches/parentin: :importer: added missing files

File size: 2.2 KB
Line 
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.
62    GLuint bpp;     //!< BitsPerPixel
63    GLuint type;    //!< Type of the Image.
64    GLubyte *data;  //!< The Image Data comes here! DANGER: uncompressed data.
65  };
66  char* searchTextureInPaths(char* texName) const;
67
68 public:
69
70  bool loadTexToGL (Image* pImage, GLuint* texture);
71
72  bool loadImage(char* imageName, GLuint* texture);
73#ifndef HAVE_SDL_SDL_IMAGE_H
74
75  bool loadBMP (char* bmpName, GLuint* texture);
76
77  bool loadJPG (char* jpgName, GLuint* texture);
78
79  /// TGA ///
80
81  bool loadTGA(const char * tgaName, GLuint* texture);
82  bool loadUncompressedTGA(const char * filename, FILE * fTGA, GLuint* texture);
83  bool loadCompressedTGA(const char * filename, FILE * fTGA, GLuint* texture);
84
85  bool loadPNG(const char* pngName, GLuint* texture);
86#endif
87
88
89};
90
91
92
93#endif /* _TEXTURE_H */
Note: See TracBrowser for help on using the repository browser.