Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

OgreTextureManager.h

Go to the documentation of this file.
00001 /*
00002 -----------------------------------------------------------------------------
00003 This source file is part of OGRE
00004     (Object-oriented Graphics Rendering Engine)
00005 For the latest info, see http://www.ogre3d.org/
00006 
00007 Copyright © 2000-2002 The OGRE Team
00008 Also see acknowledgements in Readme.html
00009 
00010 This program is free software; you can redistribute it and/or modify it under
00011 the terms of the GNU Lesser General Public License as published by the Free Software
00012 Foundation; either version 2 of the License, or (at your option) any later
00013 version.
00014 
00015 This program is distributed in the hope that it will be useful, but WITHOUT
00016 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00017 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
00018 
00019 You should have received a copy of the GNU Lesser General Public License along with
00020 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
00021 Place - Suite 330, Boston, MA 02111-1307, USA, or go to
00022 http://www.gnu.org/copyleft/lesser.txt.
00023 -----------------------------------------------------------------------------
00024 */
00025 #ifndef _TextureManager_H__
00026 #define _TextureManager_H__
00027 
00028 
00029 #include "OgrePrerequisites.h"
00030 
00031 #include "OgreResourceManager.h"
00032 #include "OgreTexture.h"
00033 #include "OgreSingleton.h"
00034 
00035 
00036 namespace Ogre {
00037 
00051     class _OgreExport TextureManager : public ResourceManager, public Singleton<TextureManager>
00052     {
00053     public:
00054 
00055         TextureManager(bool enable32Bit = true) : mIs32Bit(enable32Bit), mDefaultNumMipMaps(0) {}
00056         virtual ~TextureManager();
00057 
00085         virtual Texture * load( 
00086             const String& name, TextureType texType = TEX_TYPE_2D,
00087             int numMipMaps = -1, Real gamma = 1.0f, int priority = 1 );
00088 
00089         virtual Texture * loadImage( 
00090             const String &name, const Image &img, 
00091             TextureType texType = TEX_TYPE_2D,
00092             int iNumMipMaps = -1, Real gamma = 1.0f, int priority = 1 );
00093             
00094         virtual Texture *loadRawData( 
00095             const String &name, const DataChunk &pData, 
00096             ushort uWidth, ushort uHeight, PixelFormat eFormat,
00097             TextureType texType = TEX_TYPE_2D,
00098             int iNumMipMaps = -1, Real gamma = 1.0f, int priority = 1 );
00099 
00101         virtual void load( Resource *res, int priority = 1 )
00102         {
00103             ResourceManager::load( res, priority );
00104         }
00105 
00106         virtual Resource * create( const String& name )
00107         {
00108             return create(name, TEX_TYPE_2D);
00109         }
00110 
00111         virtual Texture * create( const String& name, TextureType texType) = 0;
00112 
00113         virtual Texture * createAsRenderTarget( const String& name ) = 0;
00114 
00115         virtual Texture * createManual( 
00116             const String & name,
00117             TextureType texType,
00118             uint width,
00119             uint height,
00120             uint num_mips,
00121             PixelFormat format,
00122             TextureUsage usage ) = 0;
00123 
00126         virtual void unload(const String& filename);
00127 
00130         virtual void enable32BitTextures(bool setting = true);
00131 
00138         virtual void setDefaultNumMipMaps(int num);
00139 
00142         virtual int getDefaultNumMipMaps()
00143         {
00144             return mDefaultNumMipMaps;
00145         }
00146 
00162         static TextureManager& getSingleton(void);
00178         static TextureManager* getSingletonPtr(void);
00179 
00180     protected:
00181         bool mIs32Bit;
00182         int mDefaultNumMipMaps;
00183     };
00184 }// Namespace
00185 
00186 #endif

Copyright © 2002-2003 by The OGRE Team
Last modified Fri May 14 23:22:52 2004