Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/branches/particle_system/src/importer/texture.h @ 3787

Last change on this file since 3787 was 3365, checked in by bensch, 20 years ago

orxonox/trunk: merged branches/parenting back to the.
merged with command:
svn merge branches/parenting trunk -r 3247:HEAD
resolved all conflicts in favor of parenting.

File size: 2.4 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;     //!< BytesPerPixel
63    GLenum format;  //!< The Format of the PixelData
64    GLuint type;    //!< Type of the Image.
65    GLubyte *data;  //!< The Image Data comes here! DANGER: uncompressed data.
66  };
67  Image* pImage;
68  GLuint texture;
69  SDL_Surface* map;
70  char* searchTextureInPaths(char* texName) const;
71  inline void swap(unsigned char &a, unsigned char &b);
72 public:
73  Texture(void);
74  ~Texture(void);
75
76  inline GLuint getTexture(void) {return this->texture;} //!< \returns The textureID of this texture.
77  bool loadTexToGL (Image* pImage);
78
79  bool loadImage(char* imageName);
80#ifndef HAVE_SDL_SDL_IMAGE_H
81
82  bool loadBMP (char* bmpName);
83
84  bool loadJPG (char* jpgName);
85
86  /// TGA ///
87
88  bool loadTGA(const char * tgaName);
89  bool loadUncompressedTGA(const char * filename, FILE * fTGA);
90  bool loadCompressedTGA(const char * filename, FILE * fTGA);
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.