Last change
on this file since 3863 was
3863,
checked in by bensch, 19 years ago
|
orxonox/trunk: efence compile support, minor changes at animation, and texture has now only support for sdl-image
|
File size:
1.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 "glincl.h" |
---|
13 | |
---|
14 | #include "debug.h" |
---|
15 | |
---|
16 | #include <SDL_image.h> |
---|
17 | |
---|
18 | //! A Class, that reads in Textures from different fileformats. |
---|
19 | class Texture |
---|
20 | { |
---|
21 | private: |
---|
22 | //! Struct to handle Infos about an Image |
---|
23 | struct Image |
---|
24 | { |
---|
25 | int rowSpan; //!< The count of the rows this Image has. |
---|
26 | GLuint width; //!< The width of the Image. |
---|
27 | GLuint height; //!< The height of the Image. |
---|
28 | GLuint bpp; //!< BytesPerPixel |
---|
29 | GLenum format; //!< The Format of the PixelData |
---|
30 | GLuint type; //!< Type of the Image. |
---|
31 | GLubyte *data; //!< The Image Data comes here! DANGER: uncompressed data. |
---|
32 | }; |
---|
33 | Image* pImage; //!< The data of an Image |
---|
34 | GLuint texture; //!< The Texture-ID of opengl from this Texture. |
---|
35 | SDL_Surface* map; //!< The map SDL initializes for this element. |
---|
36 | char* searchTextureInPaths(const char* texName) const; |
---|
37 | void swap(unsigned char &a, unsigned char &b); |
---|
38 | public: |
---|
39 | Texture(void); |
---|
40 | Texture(const char* imageName); |
---|
41 | ~Texture(void); |
---|
42 | /** \returns The textureID of this texture. */ |
---|
43 | inline GLuint getTexture(void) {return this->texture;} |
---|
44 | bool loadTexToGL (Image* pImage); |
---|
45 | |
---|
46 | bool loadImage(const char* imageName); |
---|
47 | }; |
---|
48 | |
---|
49 | #endif /* _TEXTURE_H */ |
---|
Note: See
TracBrowser
for help on using the repository browser.