OGRE: OgreTextureManager.h Source File - OGRE Documentation

# 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
    00087         virtual ResourceCreateOrRetrieveResult createOrRetrieve(
    00088             const String &name, const String& group, bool isManual = false,
    00089             ManualResourceLoader* loader = 0, const NameValuePairList* createParams = 0,
    00090             TextureType texType = TEX_TYPE_2D, int numMipmaps = MIP_DEFAULT,
    00091             Real gamma = 1.0f, bool isAlpha = false,
    00092             PixelFormat desiredFormat = PF_UNKNOWN, bool hwGammaCorrection = false);
    00093
    00121         virtual TexturePtr prepare(
    00122             const String& name, const String& group,
    00123             TextureType texType = TEX_TYPE_2D, int numMipmaps = MIP_DEFAULT,
    00124             Real gamma = 1.0f, bool isAlpha = false,
    00125             PixelFormat desiredFormat = PF_UNKNOWN, bool hwGammaCorrection = false);
    00126
    00156         virtual TexturePtr load(
    00157             const String& name, const String& group,
    00158             TextureType texType = TEX_TYPE_2D, int numMipmaps = MIP_DEFAULT,
    00159             Real gamma = 1.0f, bool isAlpha = false,
    00160             PixelFormat desiredFormat = PF_UNKNOWN,
    00161             bool hwGammaCorrection = false);
    00162
    00194         virtual TexturePtr loadImage(
    00195             const String &name, const String& group, const Image &img,
    00196             TextureType texType = TEX_TYPE_2D,
    00197             int iNumMipmaps = MIP_DEFAULT, Real gamma = 1.0f, bool isAlpha = false,
    00198             PixelFormat desiredFormat = PF_UNKNOWN, bool hwGammaCorrection = false);
    00199
    00232         virtual TexturePtr loadRawData(const String &name, const String& group,
    00233             DataStreamPtr& stream, ushort uWidth, ushort uHeight,
    00234             PixelFormat format, TextureType texType = TEX_TYPE_2D,
    00235             int iNumMipmaps = MIP_DEFAULT, Real gamma = 1.0f, bool hwGammaCorrection = false);
    00236
    00279         virtual TexturePtr createManual(const String & name, const String& group,
    00280             TextureType texType, uint width, uint height, uint depth,
    00281             int num_mips, PixelFormat format, int usage = TU_DEFAULT, ManualResourceLoader* loader = 0,
    00282             bool hwGammaCorrection = false, uint fsaa = 0);
    00283
    00326         TexturePtr createManual(const String & name, const String& group,
    00327             TextureType texType, uint width, uint height, int num_mips,
    00328             PixelFormat format, int usage = TU_DEFAULT, ManualResourceLoader* loader = 0,
    00329             bool hwGammaCorrection = false, uint fsaa = 0)
    00330         {
    00331             return createManual(name, group, texType, width, height, 1,
    00332                 num_mips, format, usage, loader, hwGammaCorrection, fsaa);
    00333         }
    00334
    00342         virtual void setPreferredIntegerBitDepth(ushort bits, bool reloadTextures = true);
    00343
    00346         virtual ushort getPreferredIntegerBitDepth(void) const;
    00347
    00355         virtual void setPreferredFloatBitDepth(ushort bits, bool reloadTextures = true);
    00356
    00359         virtual ushort getPreferredFloatBitDepth(void) const;
    00360
    00371         virtual void setPreferredBitDepths(ushort integerBits, ushort floatBits, bool reloadTextures = true);
    00372
    00389         virtual bool isFormatSupported(TextureType ttype, PixelFormat format, int usage);
    00390
    00394         virtual bool isEquivalentFormatSupported(TextureType ttype, PixelFormat format, int usage);
    00395
    00399         virtual PixelFormat getNativeFormat(TextureType ttype, PixelFormat format, int usage) = 0;
    00400
    00440         virtual bool isHardwareFilteringSupported(TextureType ttype, PixelFormat format, int usage,
    00441             bool preciseFormatOnly = false) = 0;
    00442
    00451         virtual void setDefaultNumMipmaps(size_t num);
    00452
    00455         virtual size_t getDefaultNumMipmaps()
    00456         {
    00457             return mDefaultNumMipmaps;
    00458         }
    00459
    00475         static TextureManager& getSingleton(void);
    00491         static TextureManager* getSingletonPtr(void);
    00492
    00493     protected:
    00494
    00495         ushort mPreferredIntegerBitDepth;
    00496         ushort mPreferredFloatBitDepth;
    00497         size_t mDefaultNumMipmaps;
    00498     };
    00499 }// Namespace
    00500
    00501 #endif

Copyright © 2008 Torus Knot Software Ltd
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Sun Jul 26 11:32:21 2009