Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members  

WP_TextureManager.h

Go to the documentation of this file.
00001 /* Copyright (C) 2001 W.P. van Paassen - peter@paassen.tmfweb.nl
00002 
00003    This program is free software; you can redistribute it and/or modify it under
00004    the terms of the GNU General Public License as published by the Free
00005    Software Foundation; either version 2 of the License, or (at your
00006    option) any later version.
00007 
00008    This program is distributed in the hope that it will be useful, but WITHOUT
00009    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00010    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00011    for more details.
00012 
00013    You should have received a copy of the GNU General Public License
00014    along with this program; see the file COPYING.  If not, write to the Free
00015    Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
00016 
00017 #ifndef WP_TEXTUREMANAGER_H
00018 #define WP_TEXTUREMANAGER_H
00019 
00020 #include <list>
00021 #include "WPCG.h"
00022 
00023 namespace WPCG
00024 {
00043 class WP_TextureManager
00044 {
00045 public:
00046   ~WP_TextureManager();
00047         
00052   static WP_TextureManager* getInstance();
00053 
00060   int getTexture(const string &name, void* owner);
00061 
00067   bool removeTextures(void* owner);
00068 
00072   bool mipmapping;
00073 
00074 private:
00075         WP_TextureManager();
00076 
00095         class WP_Texture
00096         {
00097         public:
00098           WP_Texture():texture_id(0), texture_ok(false){};
00099 
00103           WP_Texture(const string &name);
00104           ~WP_Texture();
00105 
00111           bool removeInstance(void* owner);
00112           
00116           string name;
00117 
00121           GLuint texture_id;
00122 
00126           list<void*> owners;
00127 
00131           bool texture_ok;
00132         };
00133         
00139         WP_Texture* findInstance(const string &name);
00140 
00146         int countTextures(void* owner) const;
00147 
00151         list<WP_Texture*> textures;
00152 
00156         static WP_TextureManager* tm_instance;   
00157 };
00158 }
00159 #endif

Generated on Tue Jan 28 20:26:35 2003 by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002