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 (c) 2000-2005 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); 00056 virtual ~TextureManager(); 00057 00073 virtual TexturePtr load( 00074 const String& name, const String& group, 00075 TextureType texType = TEX_TYPE_2D, int numMipmaps = -1, 00076 Real gamma = 1.0f, bool isAlpha = false); 00077 00097 virtual TexturePtr loadImage( 00098 const String &name, const String& group, const Image &img, 00099 TextureType texType = TEX_TYPE_2D, 00100 int iNumMipmaps = -1, Real gamma = 1.0f, bool isAlpha = false); 00101 00127 virtual TexturePtr loadRawData(const String &name, const String& group, 00128 DataStreamPtr& stream, ushort uWidth, ushort uHeight, 00129 PixelFormat format, TextureType texType = TEX_TYPE_2D, 00130 int iNumMipmaps = -1, Real gamma = 1.0f); 00131 00166 virtual TexturePtr createManual(const String & name, const String& group, 00167 TextureType texType, uint width, uint height, uint depth, 00168 int num_mips, PixelFormat format, int usage = TU_DEFAULT, ManualResourceLoader* loader = 0 ); 00169 00204 TexturePtr createManual(const String & name, const String& group, 00205 TextureType texType, uint width, uint height, int num_mips, 00206 PixelFormat format, int usage = TU_DEFAULT, ManualResourceLoader* loader = 0 ) 00207 { 00208 return createManual(name, group, texType, width, height, 1, 00209 num_mips, format, usage, loader); 00210 } 00211 00214 virtual void enable32BitTextures(bool setting = true); 00215 00218 virtual bool isEnable32BitTextures(void) 00219 { 00220 return mIs32Bit; 00221 } 00222 00239 virtual bool isFormatSupported(TextureType ttype, PixelFormat format, int usage); 00240 00244 virtual bool isEquivalentFormatSupported(TextureType ttype, PixelFormat format, int usage); 00245 00249 virtual PixelFormat getNativeFormat(TextureType ttype, PixelFormat format, int usage) = 0; 00250 00259 virtual void setDefaultNumMipmaps(size_t num); 00260 00263 virtual size_t getDefaultNumMipmaps() 00264 { 00265 return mDefaultNumMipmaps; 00266 } 00267 00283 static TextureManager& getSingleton(void); 00299 static TextureManager* getSingletonPtr(void); 00300 00301 protected: 00302 00303 bool mIs32Bit; 00304 size_t mDefaultNumMipmaps; 00305 }; 00306 }// Namespace 00307 00308 #endif
Copyright © 2000-2005 by The OGRE Team
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Sun Mar 12 14:37:51 2006