Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

texmanager.h

Go to the documentation of this file.
00001 // texmanager.h
00002 //
00003 // Copyright (C) 2001 Chris Laurel <claurel@shatters.net>
00004 //
00005 // This program is free software; you can redistribute it and/or
00006 // modify it under the terms of the GNU General Public License
00007 // as published by the Free Software Foundation; either version 2
00008 // of the License, or (at your option) any later version.
00009 
00010 #ifndef _TEXMANAGER_H_
00011 #define _TEXMANAGER_H_
00012 
00013 #include <string>
00014 #include <map>
00015 #include <celutil/resmanager.h>
00016 #include <celengine/texture.h>
00017 #include "multitexture.h"
00018 
00019 
00020 class TextureInfo : public ResourceInfo<Texture>
00021 {
00022  public:
00023     std::string source;
00024     std::string path;
00025     unsigned int flags;
00026     float bumpHeight;
00027     unsigned int resolution;
00028 
00029     enum {
00030         WrapTexture      = 0x1,
00031         CompressTexture  = 0x2,
00032         NoMipMaps        = 0x4,
00033         AutoMipMaps      = 0x8,
00034         AllowSplitting   = 0x10,
00035         BorderClamp      = 0x20,
00036     };
00037 
00038     TextureInfo(const std::string _source,
00039                 const std::string _path,
00040                 unsigned int _flags,
00041                 unsigned int _resolution = medres) :
00042         source(_source),
00043         path(_path),
00044         flags(_flags),
00045         bumpHeight(0.0f),
00046         resolution(_resolution) {};
00047 
00048     TextureInfo(const std::string _source,
00049                 const std::string _path,
00050                 float _bumpHeight,
00051                 unsigned int _flags,
00052                 unsigned int _resolution = medres) :
00053         source(_source),
00054         path(_path),
00055         flags(_flags),
00056         bumpHeight(_bumpHeight),
00057         resolution(_resolution) {};
00058 
00059     TextureInfo(const std::string _source,
00060                 unsigned int _flags,
00061                 unsigned int _resolution = medres) :
00062         source(_source),
00063         path(""),
00064         flags(_flags),
00065         bumpHeight(0.0f),
00066         resolution(_resolution) {};
00067 
00068     virtual std::string resolve(const std::string&);
00069     virtual Texture* load(const std::string&);
00070 };
00071 
00072 inline bool operator<(const TextureInfo& ti0, const TextureInfo& ti1)
00073 {
00074     if (ti0.resolution == ti1.resolution)
00075     {
00076         if (ti0.source == ti1.source)
00077             return ti0.path < ti1.path;
00078         else
00079             return ti0.source < ti1.source;
00080     }
00081     else
00082     {
00083         return ti0.resolution < ti1.resolution;
00084     }
00085 }
00086 
00087 typedef ResourceManager<TextureInfo> TextureManager;
00088 
00089 extern TextureManager* GetTextureManager();
00090 
00091 #endif // _TEXMANAGER_H_
00092 

Generated on Sat Jan 14 22:30:29 2006 for Celestia by  doxygen 1.4.1