Hauptseite | Liste aller Namensbereiche | Klassenhierarchie | Alphabetische Liste | Datenstrukturen | Auflistung der Dateien | Datenstruktur-Elemente | Datei-Elemente

TextureManager.h

gehe zur Dokumentation dieser Datei
00001 /*
00002 Autor: $Author: kunkel $ State: $State: Exp $
00003 Datum: $Date: 2005/05/30 12:35:25 $
00004 Version: $Revision: 1.1 $
00005 */
00006 
00012 #ifndef TEXTURE_H
00013 #define TEXTURE_H
00014 
00015 #include "config.h"
00016 #include <png.h>
00017 #include <GL/glu.h>
00018 #include <string>
00019 
00020 using namespace std;
00021 
00034 class TextureManager {
00035 private:
00040     enum {PNG_BYTES_TO_CHECK = 4,ERROR = -1};
00045     class oneTexture {
00046     public:
00047 
00051         GLuint number;
00052 
00056         string name;
00057 
00061         int references;
00062 
00066         unsigned int width;
00067 
00071         unsigned int height;
00072 
00076         GLbyte * data;
00077 
00081         oneTexture():references(0) {}
00082     }
00083     ;
00084 
00089     oneTexture textureArray[MAX_TEXTURES];
00090 
00097     bool check_if_png(FILE *fp);
00098 
00109     bool read_png(const char *fname, oneTexture & target);
00110 
00124     void createPNGTexture(const string & filename,
00125                           oneTexture & targetTexture, bool createMipmaps);
00126 public:
00130     ~TextureManager();
00131 
00138     unsigned short getTextureNumber(const string & tex);
00139 
00145     GLuint getOpenglTexture(unsigned short num);
00146 
00153     void freeReference(unsigned short texture);
00154 
00159     void freeTextures();
00160 };
00161 
00162 extern TextureManager ourTextureManager;
00163 
00164 #endif

Erzeugt am Mon May 30 14:31:16 2005 für Sunsystembuildingandsimulation von doxygen 1.3.6