# 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 (c) 2000-2006 Torus Knot Software Ltd
    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 You may alternatively use this source under the terms of a specific version of
    00025 the OGRE Unrestricted License provided you have obtained such a license from
    00026 Torus Knot Software Ltd.
    00027 -----------------------------------------------------------------------------
    00028 */
    00029 #ifndef _TextureManager_H__
    00030 #define _TextureManager_H__
    00031
    00032
    00033 #include "OgrePrerequisites.h"
    00034
    00035 #include "OgreResourceManager.h"
    00036 #include "OgreTexture.h"
    00037 #include "OgreSingleton.h"
    00038
    00039
    00040 namespace Ogre {
    00041
    00055     class _OgreExport TextureManager : public ResourceManager, public Singleton<TextureManager>
    00056     {
    00057     public:
    00058
    00059         TextureManager(void);
    00060         virtual ~TextureManager();
    00061
    00084         virtual TexturePtr load(
    00085             const String& name, const String& group,
    00086             TextureType texType = TEX_TYPE_2D, int numMipmaps = MIP_DEFAULT,
    00087             Real gamma = 1.0f, bool isAlpha = false,
    00088             PixelFormat desiredFormat = PF_UNKNOWN);
    00089
    00116         virtual TexturePtr loadImage(
    00117             const String &name, const String& group, const Image &img,
    00118             TextureType texType = TEX_TYPE_2D,
    00119             int iNumMipmaps = MIP_DEFAULT, Real gamma = 1.0f, bool isAlpha = false,
    00120             PixelFormat desiredFormat = PF_UNKNOWN);
    00121
    00147         virtual TexturePtr loadRawData(const String &name, const String& group,
    00148             DataStreamPtr& stream, ushort uWidth, ushort uHeight,
    00149             PixelFormat format, TextureType texType = TEX_TYPE_2D,
    00150             int iNumMipmaps = MIP_DEFAULT, Real gamma = 1.0f);
    00151
    00186         virtual TexturePtr createManual(const String & name, const String& group,
    00187             TextureType texType, uint width, uint height, uint depth,
    00188             int num_mips, PixelFormat format, int usage = TU_DEFAULT, ManualResourceLoader* loader = 0 );
    00189
    00224         TexturePtr createManual(const String & name, const String& group,
    00225             TextureType texType, uint width, uint height, int num_mips,
    00226             PixelFormat format, int usage = TU_DEFAULT, ManualResourceLoader* loader = 0 )
    00227         {
    00228             return createManual(name, group, texType, width, height, 1,
    00229                 num_mips, format, usage, loader);
    00230         }
    00231
    00239         virtual void setPreferredIntegerBitDepth(ushort bits, bool reloadTextures = true);
    00240
    00243         virtual ushort getPreferredIntegerBitDepth(void) const;
    00244
    00252         virtual void setPreferredFloatBitDepth(ushort bits, bool reloadTextures = true);
    00253
    00256         virtual ushort getPreferredFloatBitDepth(void) const;
    00257
    00268         virtual void setPreferredBitDepths(ushort integerBits, ushort floatBits, bool reloadTextures = true);
    00269
    00286         virtual bool isFormatSupported(TextureType ttype, PixelFormat format, int usage);
    00287
    00291         virtual bool isEquivalentFormatSupported(TextureType ttype, PixelFormat format, int usage);
    00292
    00296         virtual PixelFormat getNativeFormat(TextureType ttype, PixelFormat format, int usage) = 0;
    00297
    00337         virtual bool isHardwareFilteringSupported(TextureType ttype, PixelFormat format, int usage,
    00338             bool preciseFormatOnly = false) = 0;
    00339
    00348         virtual void setDefaultNumMipmaps(size_t num);
    00349
    00352         virtual size_t getDefaultNumMipmaps()
    00353         {
    00354             return mDefaultNumMipmaps;
    00355         }
    00356
    00372         static TextureManager& getSingleton(void);
    00388         static TextureManager* getSingletonPtr(void);
    00389
    00390     protected:
    00391
    00392         ushort mPreferredIntegerBitDepth;
    00393         ushort mPreferredFloatBitDepth;
    00394         size_t mDefaultNumMipmaps;
    00395     };
    00396 }// Namespace
    00397
    00398 #endif

Copyright © 2000-2005 by The OGRE Team
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Sat May 10 16:25:04 2008