OgreTextureManager.h
Go to the documentation of this file.
/*
-----------------------------------------------------------------------------
This source file is part of OGRE
(Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org/
Copyright (c) 2000-2013 Torus Knot Software Ltd
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-----------------------------------------------------------------------------
*/
#ifndef _TextureManager_H__
#define _TextureManager_H__
#include "OgrePrerequisites.h"
#include "OgreResourceManager.h"
#include "OgreTexture.h"
#include "OgreSingleton.h"
namespace Ogre {
class _OgreExport TextureManager : public ResourceManager, public Singleton<TextureManager>
{
public:
TextureManager(void);
virtual ~TextureManager();
TexturePtr create (const String& name, const String& group,
bool isManual = false, ManualResourceLoader* loader = 0,
const NameValuePairList* createParams = 0);
TexturePtr getByName(const String& name, const String& groupName = ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME);
virtual ResourceCreateOrRetrieveResult createOrRetrieve(
const String &name, const String& group, bool isManual = false,
ManualResourceLoader* loader = 0, const NameValuePairList* createParams = 0,
TextureType texType = TEX_TYPE_2D, int numMipmaps = MIP_DEFAULT,
Real gamma = 1.0f, bool isAlpha = false,
PixelFormat desiredFormat = PF_UNKNOWN, bool hwGammaCorrection = false);
virtual TexturePtr prepare(
const String& name, const String& group,
TextureType texType = TEX_TYPE_2D, int numMipmaps = MIP_DEFAULT,
Real gamma = 1.0f, bool isAlpha = false,
PixelFormat desiredFormat = PF_UNKNOWN, bool hwGammaCorrection = false);
virtual TexturePtr load(
const String& name, const String& group,
TextureType texType = TEX_TYPE_2D, int numMipmaps = MIP_DEFAULT,
Real gamma = 1.0f, bool isAlpha = false,
PixelFormat desiredFormat = PF_UNKNOWN,
bool hwGammaCorrection = false);
virtual TexturePtr loadImage(
const String &name, const String& group, const Image &img,
TextureType texType = TEX_TYPE_2D,
int numMipmaps = MIP_DEFAULT, Real gamma = 1.0f, bool isAlpha = false,
PixelFormat desiredFormat = PF_UNKNOWN, bool hwGammaCorrection = false);
virtual TexturePtr loadRawData(const String &name, const String& group,
DataStreamPtr& stream, ushort width, ushort height,
PixelFormat format, TextureType texType = TEX_TYPE_2D,
int numMipmaps = MIP_DEFAULT, Real gamma = 1.0f, bool hwGammaCorrection = false);
virtual TexturePtr createManual(const String & name, const String& group,
TextureType texType, uint width, uint height, uint depth,
int numMipmaps, PixelFormat format, int usage = TU_DEFAULT, ManualResourceLoader* loader = 0,
bool hwGammaCorrection = false, uint fsaa = 0, const String& fsaaHint = StringUtil::BLANK);
TexturePtr createManual(const String & name, const String& group,
TextureType texType, uint width, uint height, int numMipmaps,
PixelFormat format, int usage = TU_DEFAULT, ManualResourceLoader* loader = 0,
bool hwGammaCorrection = false, uint fsaa = 0, const String& fsaaHint = StringUtil::BLANK)
{
return createManual(name, group, texType, width, height, 1,
numMipmaps, format, usage, loader, hwGammaCorrection, fsaa, fsaaHint);
}
virtual void setPreferredIntegerBitDepth(ushort bits, bool reloadTextures = true);
virtual ushort getPreferredIntegerBitDepth(void) const;
virtual void setPreferredFloatBitDepth(ushort bits, bool reloadTextures = true);
virtual ushort getPreferredFloatBitDepth(void) const;
virtual void setPreferredBitDepths(ushort integerBits, ushort floatBits, bool reloadTextures = true);
virtual bool isFormatSupported(TextureType ttype, PixelFormat format, int usage);
virtual bool isEquivalentFormatSupported(TextureType ttype, PixelFormat format, int usage);
virtual PixelFormat getNativeFormat(TextureType ttype, PixelFormat format, int usage) = 0;
virtual bool isHardwareFilteringSupported(TextureType ttype, PixelFormat format, int usage,
bool preciseFormatOnly = false) = 0;
virtual void setDefaultNumMipmaps(size_t num);
virtual size_t getDefaultNumMipmaps()
{
return mDefaultNumMipmaps;
}
static TextureManager& getSingleton(void);
static TextureManager* getSingletonPtr(void);
protected:
ushort mPreferredIntegerBitDepth;
ushort mPreferredFloatBitDepth;
size_t mDefaultNumMipmaps;
};
}// Namespace
#endif
Ogre::ResourceManager::ResourceCreateOrRetrieveResult
std::pair< ResourcePtr, bool > ResourceCreateOrRetrieveResult
Definition: OgreResourceManager.h:152
Ogre::TextureManager
Class for loading & managing textures.
Definition: OgreTextureManager.h:60
_OgreExport
#define _OgreExport
Definition: OgrePlatform.h:257
Ogre::uint
unsigned int uint
Definition: OgrePrerequisites.h:114
Ogre::PF_UNKNOWN
Unknown pixel format.
Definition: OgrePixelFormat.h:46
Ogre::TextureManager::mPreferredFloatBitDepth
ushort mPreferredFloatBitDepth
Definition: OgreTextureManager.h:518
Ogre::TEX_TYPE_2D
2D texture, used in combination with 2D texture coordinates (default)
Definition: OgreTexture.h:72
Ogre::ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME
static String AUTODETECT_RESOURCE_GROUP_NAME
Special resource group name which causes resource group to be automatically determined based on searc...
Definition: OgreResourceGroupManager.h:270
Ogre::Real
float Real
Software floating point type.
Definition: OgrePrerequisites.h:70
Ogre::TextureManager::getDefaultNumMipmaps
virtual size_t getDefaultNumMipmaps()
Gets the default number of mipmaps to be used for loaded textures.
Definition: OgreTextureManager.h:477
Ogre::PixelFormat
PixelFormat
The pixel format used for images, textures, and render surfaces.
Definition: OgrePixelFormat.h:43
Ogre::ManualResourceLoader
Interface describing a manual resource loader.
Definition: OgreResource.h:514
OgreSingleton.h
OgrePrerequisites.h
OgreTexture.h
Ogre::TU_DEFAULT
Default to automatic mipmap generation static textures.
Definition: OgreTexture.h:62
Ogre::NameValuePairList
map< String, String >::type NameValuePairList
Name / value parameter pair (first = name, second = value)
Definition: OgreCommon.h:550
Ogre::TextureType
TextureType
Enum identifying the texture type.
Definition: OgreTexture.h:67
Ogre::String
_StringBase String
Definition: OgrePrerequisites.h:439
OgreResourceManager.h
Ogre::TextureManager::mDefaultNumMipmaps
size_t mDefaultNumMipmaps
Definition: OgreTextureManager.h:519
Ogre::ResourceManager
Defines a generic resource handler.
Definition: OgreResourceManager.h:122
Ogre::Image
Class representing an image file.
Definition: OgreImage.h:61
Ogre::TextureManager::createManual
TexturePtr createManual(const String &name, const String &group, TextureType texType, uint width, uint height, int numMipmaps, PixelFormat format, int usage=TU_DEFAULT, ManualResourceLoader *loader=0, bool hwGammaCorrection=false, uint fsaa=0, const String &fsaaHint=StringUtil::BLANK)
Create a manual texture with a depth of 1 (not loaded from a file).
Definition: OgreTextureManager.h:348
Ogre
Definition: OgreAndroidLogListener.h:34
Ogre::SharedPtr< Texture >
Ogre::Singleton
Template class for creating single-instance global classes.
Definition: OgreSingleton.h:64
Ogre::ushort
unsigned short ushort
Definition: OgrePrerequisites.h:113
Ogre::MIP_DEFAULT
Use TextureManager default.
Definition: OgreTexture.h:90
Ogre::TextureManager::mPreferredIntegerBitDepth
ushort mPreferredIntegerBitDepth
Definition: OgreTextureManager.h:517
Ogre::StringUtil::BLANK
static const String BLANK
Constant blank string, useful for returning by ref where local does not exist.
Definition: OgreString.h:196

Copyright © 2012 Torus Knot Software Ltd
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.