Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

Ogre::D3D8TextureManager Class Reference

#include <OgreD3D8TextureManager.h>

Inheritance diagram for Ogre::D3D8TextureManager:

Ogre::TextureManager Ogre::ResourceManager Ogre::Singleton< TextureManager > List of all members.

Public Methods

 D3D8TextureManager (LPDIRECT3DDEVICE8 pD3DDevice)
 ~D3D8TextureManager ()
virtual Resourcecreate (const String &name)
 Creates a D3D8Texture resource. More...

virtual TexturecreateAsRenderTarget (const String &name)
virtual TexturecreateManual (const String &name, uint width, uint height, uint num_mips, PixelFormat format, TextureUsage usage)
void unloadAndDestroyAll ()
 Unloads all Resources from memory. More...

virtual Textureload (const String &name, int numMipMaps=-1, Real gamma=1.0f, int priority=1)
 Loads a texture from a file. More...

virtual void load (Resource *res, int priority=1)
 @copydoc ResourceManager::load. More...

virtual TextureloadImage (const String &name, const Image &img, int iNumMipMaps=-1, Real gamma=1.0f, int priority=1)
virtual void unload (String filename)
 Manually unloads a texture from the loaded set. More...

virtual void unload (Resource *res)
 Unloads a Resource from the managed resources list, calling it's unload() method. More...

virtual void enable32BitTextures (bool setting=true)
 Enables / disables 32-bit textures. More...

virtual void setDefaultNumMipMaps (int num)
 Sets the default number of mipmaps to be used for loaded textures, for when textures are loaded automatically (e.g. More...

virtual int getDefaultNumMipMaps ()
 Sets the default number of mipmaps to be used for loaded textures. More...

virtual void setMemoryBudget (size_t bytes)
 Set a limit on the amount of memory this resource handler may use. More...

virtual ResourcegetByName (const String &name)
 Retrieves a pointer to a resource by name. More...

void addSearchPath (const String &path)
 Adds a relative path to search for resources of this type. More...

void addArchiveEx (const String &strName, const String &strDriverName)
 Adds an archive to the search path for this type of resource. More...

bool _findResourceData (const String &filename, DataChunk &refChunk)
 Internal method, used for locating resource data in the file system / archives. More...


Static Public Methods

TextureManagergetSingleton (void)
 Override standard Singleton retrieval. More...

void addCommonSearchPath (const String &path)
 Adds a relative search path for resources of ALL types. More...

void addCommonArchiveEx (const String &strName, const String &strDriverName)
 Adds an archive to the search path for all resources. More...

std::set< String_getAllCommonNamesLike (const String &startPath, const String &extension)
 Returns a collection of files with the given extension in the common resource paths. More...

bool _findCommonResourceData (const String &filename, DataChunk &refChunk)
 Internal method, used for locating common resource data in the file system / archives. More...

TextureManagergetSingletonPtr (void)

Protected Types

typedef HashMap< String, ArchiveEx *,
_StringHash
FileMap

Protected Methods

void checkUsage (void)
 Checks memory usage and pages out if required. More...


Protected Attributes

bool mIs32Bit
int mDefaultNumMipMaps
FileMap mArchiveFiles
ResourceMap mResources
size_t mMemoryBudget
size_t mMemoryUsage
std::vector< ArchiveEx * > mVFS
 Collection of searchable ArchiveEx classes (virtual file system) for this resource type. More...


Static Protected Attributes

FileMap mCommonArchiveFiles
std::vector< ArchiveEx * > mCommonVFS
 Collection of searchable ArchiveEx classes (virtual file system) for all resource types. More...

TextureManagerms_Singleton = 0

Private Attributes

LPDIRECT3DDEVICE8 mpD3DDevice

Member Typedef Documentation

typedef HashMap< String, ArchiveEx *, _StringHash > Ogre::ResourceManager::FileMap [protected, inherited]
 


Constructor & Destructor Documentation

Ogre::D3D8TextureManager::D3D8TextureManager LPDIRECT3DDEVICE8    pD3DDevice
 

Ogre::D3D8TextureManager::~D3D8TextureManager  
 


Member Function Documentation

bool Ogre::ResourceManager::_findCommonResourceData const String   filename,
DataChunk   refChunk
[static, inherited]
 

Internal method, used for locating common resource data in the file system / archives.

Remarks:
This is a static version of _findResourceData specifically designed to only search in the common resource archives, and is therefore usable from non-ResourceManager subclasses.
Parameters:
filename  File to find
refChunk  Reference to a DataChunk object to fill with the data from the file
Returns:
On success, true is returned

On failiure, false is returned

bool Ogre::ResourceManager::_findResourceData const String   filename,
DataChunk   refChunk
[inherited]
 

Internal method, used for locating resource data in the file system / archives.

Parameters:
filename  File to find
refChunk  Reference to a DataChunk object to fill with the data from the file
Returns:
On success, true is returned

On failiure, false is returnec

std::set< String > Ogre::ResourceManager::_getAllCommonNamesLike const String   startPath,
const String   extension
[static, inherited]
 

Returns a collection of files with the given extension in the common resource paths.

Remarks:
This is a convenience method to allow non-subclasses to search for files in the common paths.
Parameters:
startPath  The path, relative to each common resource start, to search in (use "./" for the root)
extension  The extension of file to search for.
Returns:
A set of String filenames (it is a set because duplicates will be ignored)

void Ogre::ResourceManager::addArchiveEx const String   strName,
const String   strDriverName
[inherited]
 

Adds an archive to the search path for this type of resource.

Remarks:
Ogre can load resources from archives. This method adds the named archive to the search path for the type of resource managed by the specific resource manager. Archives are not searched for themselves so a complete path must be specified here (or relative to the current path). Archives take precedence over files in the filesystem.

void Ogre::ResourceManager::addCommonArchiveEx const String   strName,
const String   strDriverName
[static, inherited]
 

Adds an archive to the search path for all resources.

Remarks:
As ResourceManager::addArchive, except this archive is used for all types of resources, not just the type managed by the resource manager in question.

void Ogre::ResourceManager::addCommonSearchPath const String   path [static, inherited]
 

Adds a relative search path for resources of ALL types.

This method has the same effect as ResourceManager::addSearchPath, except that the path added applies to ALL resources, not just the one managed by the subclass in question.

void Ogre::ResourceManager::addSearchPath const String   path [inherited]
 

Adds a relative path to search for resources of this type.

Remarks:
This method adds the supplied path to the list of relative locations that that will be searched for a single type of resource only. Each subclass of ResourceManager will maintain it's own list of specific subpaths, which it will append to the current path as it searches for matching files.

void Ogre::ResourceManager::checkUsage void    [protected, inherited]
 

Checks memory usage and pages out if required.

Resource * Ogre::D3D8TextureManager::create const String   name [virtual]
 

Creates a D3D8Texture resource.

Implements Ogre::ResourceManager.

Texture * Ogre::D3D8TextureManager::createAsRenderTarget const String   name [virtual]
 

Implements Ogre::TextureManager.

Texture * Ogre::D3D8TextureManager::createManual const String   name,
uint    width,
uint    height,
uint    num_mips,
PixelFormat    format,
TextureUsage    usage
[virtual]
 

Implements Ogre::TextureManager.

void Ogre::TextureManager::enable32BitTextures bool    setting = true [virtual, inherited]
 

Enables / disables 32-bit textures.

Resource * Ogre::ResourceManager::getByName const String   name [virtual, inherited]
 

Retrieves a pointer to a resource by name.

virtual int Ogre::TextureManager::getDefaultNumMipMaps   [inline, virtual, inherited]
 

Sets the default number of mipmaps to be used for loaded textures.

TextureManager & Ogre::TextureManager::getSingleton void    [static, inherited]
 

Override standard Singleton retrieval.

Remarks:
Why do we do this? Well, it's because the Singleton implementation is in a .h file, which means it gets compiled into anybody who includes it. This is needed for the Singleton template to work, but we actually only want it compiled into the implementation of the class based on the Singleton, not all of them. If we don't change this, we get link errors when trying to use the Singleton-based class from an outside dll.

This method just delegates to the template version anyway, but the implementation stays in this single compilation unit, preventing link errors.

Reimplemented from Ogre::Singleton< TextureManager >.

TextureManager* Ogre::Singleton< TextureManager >::getSingletonPtr void    [inline, static, inherited]
 

virtual void Ogre::TextureManager::load Resource   res,
int    priority = 1
[inline, virtual, inherited]
 

@copydoc ResourceManager::load.

Reimplemented from Ogre::ResourceManager.

Texture * Ogre::TextureManager::load const String   name,
int    numMipMaps = -1,
Real    gamma = 1.0f,
int    priority = 1
[virtual, inherited]
 

Loads a texture from a file.

Remarks:
Loads a texture from a graphics file (PNG, JPG or TGA). Textures will be kept in memory unless resources become short, in which case textures with lower priority will be unloaded first. Textures of equal priority will be unloaded on a 'least recently used' (LRU) basis. Textures will be automatically reloaded when used again but this will involve a performance hit.

The budget for texture memory can be set through the ResourceManager::setMemoryBudget method.

Parameters:
filename  The file to load (JPG or PNG accepted, also BMP on Windows)
numMipMaps  The number of pre-filtered mipmaps to generate. If left to default (-1) then the TextureManager's default number of mipmaps will be used (see setDefaultNumMipMaps())
gamma  The gamma adjustment factor to apply to this texture (brightening/darkening)
priority  The higher the priority, the less likely this texture will be unloaded due to memory limits.
See also:
ResourceManager::setMemoryBudget

Texture * Ogre::TextureManager::loadImage const String   name,
const Image   img,
int    iNumMipMaps = -1,
Real    gamma = 1.0f,
int    priority = 1
[virtual, inherited]
 

void Ogre::TextureManager::setDefaultNumMipMaps int    num [virtual, inherited]
 

Sets the default number of mipmaps to be used for loaded textures, for when textures are loaded automatically (e.g.

by Material class) or when 'load' is called with the default parameters by the application.

Note:
The default value is 0.

void Ogre::ResourceManager::setMemoryBudget size_t    bytes [virtual, inherited]
 

Set a limit on the amount of memory this resource handler may use.

Remarks:
If, when asked to load a new resource, the manager believes it will exceed this memory budget, it will temporarily unload a resource to make room for the new one. This unloading is not permanent and the Resource is not destroyed; it simply needs to be reloaded when next used.

void Ogre::ResourceManager::unload Resource   res [virtual, inherited]
 

Unloads a Resource from the managed resources list, calling it's unload() method.

Remarks:
This method removes a resource from the list maintained by this manager, and unloads it from memory. It does NOT destroy the resource itself, although the memory used by it will be largely freed up. This would allow you to reload the resource again if you wished.

Permanently destroying the resource is, as mentioned in ResourceManager::create, the library user's responsibility.

void Ogre::TextureManager::unload String    filename [virtual, inherited]
 

Manually unloads a texture from the loaded set.

void Ogre::D3D8TextureManager::unloadAndDestroyAll   [virtual]
 

Unloads all Resources from memory.

Remarks:
Note that unlike ResourceManager::unload, Resource objects are DESTROYED as well as unloaded. This is because you are unlikely to be managing the deletion of the objects individually in this case.

Reimplemented from Ogre::ResourceManager.


Member Data Documentation

FileMap Ogre::ResourceManager::mArchiveFiles [protected, inherited]
 

ResourceManager::FileMap Ogre::ResourceManager::mCommonArchiveFiles [static, protected, inherited]
 

std::vector< ArchiveEx * > Ogre::ResourceManager::mCommonVFS [static, protected, inherited]
 

Collection of searchable ArchiveEx classes (virtual file system) for all resource types.

int Ogre::TextureManager::mDefaultNumMipMaps [protected, inherited]
 

bool Ogre::TextureManager::mIs32Bit [protected, inherited]
 

size_t Ogre::ResourceManager::mMemoryBudget [protected, inherited]
 

size_t Ogre::ResourceManager::mMemoryUsage [protected, inherited]
 

LPDIRECT3DDEVICE8 Ogre::D3D8TextureManager::mpD3DDevice [private]
 

ResourceMap Ogre::ResourceManager::mResources [protected, inherited]
 

TextureManager * Ogre::Singleton< TextureManager >::ms_Singleton = 0 [static, protected, inherited]
 

std::vector<ArchiveEx*> Ogre::ResourceManager::mVFS [protected, inherited]
 

Collection of searchable ArchiveEx classes (virtual file system) for this resource type.

Copyright © 2002 by The OGRE Team