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-2012 Torus Knot Software Ltd
    00008
    00009 Permission is hereby granted, free of charge, to any person obtaining a copy
    00010 of this software and associated documentation files (the "Software"), to deal
    00011 in the Software without restriction, including without limitation the rights
    00012 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    00013 copies of the Software, and to permit persons to whom the Software is
    00014 furnished to do so, subject to the following conditions:
    00015
    00016 The above copyright notice and this permission notice shall be included in
    00017 all copies or substantial portions of the Software.
    00018
    00019 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    00020 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    00021 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    00022 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    00023 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    00024 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
    00025 THE SOFTWARE.
    00026 -----------------------------------------------------------------------------
    00027 */
    00028 #ifndef _TextureManager_H__
    00029 #define _TextureManager_H__
    00030
    00031
    00032 #include "OgrePrerequisites.h"
    00033
    00034 #include "OgreResourceManager.h"
    00035 #include "OgreTexture.h"
    00036 #include "OgreSingleton.h"
    00037
    00038
    00039 namespace Ogre {
    00040
    00060     class _OgreExport TextureManager : public ResourceManager, public Singleton<TextureManager>
    00061     {
    00062     public:
    00063
    00064         TextureManager(void);
    00065         virtual ~TextureManager();
    00066
    00092         virtual ResourceCreateOrRetrieveResult createOrRetrieve(
    00093             const String &name, const String& group, bool isManual = false,
    00094             ManualResourceLoader* loader = 0, const NameValuePairList* createParams = 0,
    00095             TextureType texType = TEX_TYPE_2D, int numMipmaps = MIP_DEFAULT,
    00096             Real gamma = 1.0f, bool isAlpha = false,
    00097             PixelFormat desiredFormat = PF_UNKNOWN, bool hwGammaCorrection = false);
    00098
    00126         virtual TexturePtr prepare(
    00127             const String& name, const String& group,
    00128             TextureType texType = TEX_TYPE_2D, int numMipmaps = MIP_DEFAULT,
    00129             Real gamma = 1.0f, bool isAlpha = false,
    00130             PixelFormat desiredFormat = PF_UNKNOWN, bool hwGammaCorrection = false);
    00131
    00161         virtual TexturePtr load(
    00162             const String& name, const String& group,
    00163             TextureType texType = TEX_TYPE_2D, int numMipmaps = MIP_DEFAULT,
    00164             Real gamma = 1.0f, bool isAlpha = false,
    00165             PixelFormat desiredFormat = PF_UNKNOWN,
    00166             bool hwGammaCorrection = false);
    00167
    00199         virtual TexturePtr loadImage(
    00200             const String &name, const String& group, const Image &img,
    00201             TextureType texType = TEX_TYPE_2D,
    00202             int iNumMipmaps = MIP_DEFAULT, Real gamma = 1.0f, bool isAlpha = false,
    00203             PixelFormat desiredFormat = PF_UNKNOWN, bool hwGammaCorrection = false);
    00204
    00237         virtual TexturePtr loadRawData(const String &name, const String& group,
    00238             DataStreamPtr& stream, ushort uWidth, ushort uHeight,
    00239             PixelFormat format, TextureType texType = TEX_TYPE_2D,
    00240             int iNumMipmaps = MIP_DEFAULT, Real gamma = 1.0f, bool hwGammaCorrection = false);
    00241
    00284         virtual TexturePtr createManual(const String & name, const String& group,
    00285             TextureType texType, uint width, uint height, uint depth,
    00286             int num_mips, PixelFormat format, int usage = TU_DEFAULT, ManualResourceLoader* loader = 0,
    00287             bool hwGammaCorrection = false, uint fsaa = 0, const String& fsaaHint = StringUtil::BLANK);
    00288
    00331         TexturePtr createManual(const String & name, const String& group,
    00332             TextureType texType, uint width, uint height, int num_mips,
    00333             PixelFormat format, int usage = TU_DEFAULT, ManualResourceLoader* loader = 0,
    00334             bool hwGammaCorrection = false, uint fsaa = 0, const String& fsaaHint = StringUtil::BLANK)
    00335         {
    00336             return createManual(name, group, texType, width, height, 1,
    00337                 num_mips, format, usage, loader, hwGammaCorrection, fsaa, fsaaHint);
    00338         }
    00339
    00347         virtual void setPreferredIntegerBitDepth(ushort bits, bool reloadTextures = true);
    00348
    00351         virtual ushort getPreferredIntegerBitDepth(void) const;
    00352
    00360         virtual void setPreferredFloatBitDepth(ushort bits, bool reloadTextures = true);
    00361
    00364         virtual ushort getPreferredFloatBitDepth(void) const;
    00365
    00376         virtual void setPreferredBitDepths(ushort integerBits, ushort floatBits, bool reloadTextures = true);
    00377
    00394         virtual bool isFormatSupported(TextureType ttype, PixelFormat format, int usage);
    00395
    00399         virtual bool isEquivalentFormatSupported(TextureType ttype, PixelFormat format, int usage);
    00400
    00404         virtual PixelFormat getNativeFormat(TextureType ttype, PixelFormat format, int usage) = 0;
    00405
    00445         virtual bool isHardwareFilteringSupported(TextureType ttype, PixelFormat format, int usage,
    00446             bool preciseFormatOnly = false) = 0;
    00447
    00456         virtual void setDefaultNumMipmaps(size_t num);
    00457
    00460         virtual size_t getDefaultNumMipmaps()
    00461         {
    00462             return mDefaultNumMipmaps;
    00463         }
    00464
    00480         static TextureManager& getSingleton(void);
    00496         static TextureManager* getSingletonPtr(void);
    00497
    00498     protected:
    00499
    00500         ushort mPreferredIntegerBitDepth;
    00501         ushort mPreferredFloatBitDepth;
    00502         size_t mDefaultNumMipmaps;
    00503     };
    00506 }// Namespace
    00507
    00508 #endif

Copyright © 2012 Torus Knot Software Ltd
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Last modified Sun Sep 2 2012 07:27:24