CS::RenderManager::TextureCacheT< ReuseCondition, PurgeCondition > Class Template Reference
Cache for caching precreated textures. More...
#include <csplugincommon/rendermanager/texturecache.h>
Public Types | |
enum | { tcacheExactSizeMatch = 1, tcachePowerOfTwo = 2 } |
Options for querying textures. More... | |
Public Member Functions | |
void | AdvanceFrame (csTicks currentTime) |
Do per-frame house keeping - MUST be called every frame/ RenderView() execution. | |
void | Clear () |
Remove all textures in the cache. | |
const char * | GetClass () const |
Return class of textures created by a cache. | |
int | GetFlags () const |
Return flags of textures created by a cache. | |
const char * | GetFormat () const |
Return format of textures created by a cache. | |
iTextureHandle * | QueryUnusedTexture (int width, int height) |
Get a texture with size that is at least width x height (or exactly that size if the tcacheExactSizeMatch option is set). | |
iTextureHandle * | QueryUnusedTexture (int width, int height, int &real_w, int &real_h) |
Get a texture with size that is at least width x height (or exactly that size if the tcacheExactSizeMatch option is set). | |
void | SetClass (const char *texClass) |
Set class of textures created by a cache. | |
void | SetFlags (int flags) |
Set flags of textures created by a cache. | |
void | SetFormat (const char *format) |
Set format of textures created by a cache. | |
void | SetG3D (iGraphics3D *g3d) |
Set iGraphics3D to use. | |
TextureCacheT (csImageType imgtype, const char *format, int textureFlags, const char *texClass, uint options, const ReuseCondition &reuse=CS::Utility::ResourceCache::ReuseConditionAfterTime< uint >(), const PurgeCondition &purge=CS::Utility::ResourceCache::PurgeConditionAfterTime< uint >(10000)) | |
Construct texture cache. |
Detailed Description
template<typename ReuseCondition = CS::Utility::ResourceCache::ReuseConditionAfterTime<csTicks>, typename PurgeCondition = CS::Utility::ResourceCache::PurgeConditionAfterTime<csTicks>>
class CS::RenderManager::TextureCacheT< ReuseCondition, PurgeCondition >
Cache for caching precreated textures.
When a texture is needed somewhere, the texture cache will either return an existing textures which can be used, if available, or create a new texture. Texture format, flags and size requirements can be user-controlled. Before first use, SetG3D() has to be called.
The template arguments ReuseCondition controls when a texture can be reused, PurgeCondition controls when it's purged (ie completely freed). The requirements are the same as for GenericResourceCache.
Definition at line 118 of file texturecache.h.
Member Enumeration Documentation
anonymous enum |
Options for querying textures.
- Enumerator:
tcacheExactSizeMatch The sizes of returned textures should exactly fit the requested size.
If not set, a larger texture may be returned.
tcachePowerOfTwo The textures created should have power of two dimensions.
This flag is stronger than tcacheExactSizeMatch: returned textures will always have power of two dimensions, even though it may mean non-exact sizes.
Definition at line 122 of file texturecache.h.
Constructor & Destructor Documentation
CS::RenderManager::TextureCacheT< ReuseCondition, PurgeCondition >::TextureCacheT | ( | csImageType | imgtype, | |
const char * | format, | |||
int | textureFlags, | |||
const char * | texClass, | |||
uint | options, | |||
const ReuseCondition & | reuse = CS::Utility::ResourceCache::ReuseConditionAfterTime<uint> () , |
|||
const PurgeCondition & | purge = CS::Utility::ResourceCache::PurgeConditionAfterTime<uint> (10000) | |||
) | [inline] |
Construct texture cache.
- Parameters:
-
imgtype Image type of textures to create. format Format of textures to create. textureFlags Flags of textures to create. texClass Class of textures to create. options Options for cache behaviour when querying textures. Can be tcacheExactSizeMatch, tcachePowerOfTwo. reuse Options for the reuse condition to use. purge Options for the purge condition to use.
- See also:
- iTextureManager::CreateTexture();
Definition at line 150 of file texturecache.h.
Member Function Documentation
void CS::RenderManager::TextureCacheT< ReuseCondition, PurgeCondition >::AdvanceFrame | ( | csTicks | currentTime | ) | [inline] |
Do per-frame house keeping - MUST be called every frame/ RenderView() execution.
Definition at line 182 of file texturecache.h.
void CS::RenderManager::TextureCacheT< ReuseCondition, PurgeCondition >::Clear | ( | ) | [inline] |
Remove all textures in the cache.
Definition at line 173 of file texturecache.h.
const char* CS::RenderManager::TextureCacheT< ReuseCondition, PurgeCondition >::GetClass | ( | ) | const [inline] |
Return class of textures created by a cache.
Definition at line 241 of file texturecache.h.
int CS::RenderManager::TextureCacheT< ReuseCondition, PurgeCondition >::GetFlags | ( | ) | const [inline] |
Return flags of textures created by a cache.
Definition at line 239 of file texturecache.h.
const char* CS::RenderManager::TextureCacheT< ReuseCondition, PurgeCondition >::GetFormat | ( | ) | const [inline] |
Return format of textures created by a cache.
Definition at line 237 of file texturecache.h.
iTextureHandle* CS::RenderManager::TextureCacheT< ReuseCondition, PurgeCondition >::QueryUnusedTexture | ( | int | width, | |
int | height | |||
) | [inline] |
Get a texture with size that is at least width x height (or exactly that size if the tcacheExactSizeMatch option is set).
Definition at line 230 of file texturecache.h.
iTextureHandle* CS::RenderManager::TextureCacheT< ReuseCondition, PurgeCondition >::QueryUnusedTexture | ( | int | width, | |
int | height, | |||
int & | real_w, | |||
int & | real_h | |||
) | [inline] |
Get a texture with size that is at least width x height (or exactly that size if the tcacheExactSizeMatch option is set).
The real size of the texture acquired is stored in real_w and real_h.
Definition at line 193 of file texturecache.h.
void CS::RenderManager::TextureCacheT< ReuseCondition, PurgeCondition >::SetClass | ( | const char * | texClass | ) | [inline] |
Set class of textures created by a cache.
- Remarks:
- Will only affect newly created textures. Cache will be cleared.
Definition at line 265 of file texturecache.h.
void CS::RenderManager::TextureCacheT< ReuseCondition, PurgeCondition >::SetFlags | ( | int | flags | ) | [inline] |
Set flags of textures created by a cache.
- Remarks:
- Will only affect newly created textures. Cache will be cleared.
Definition at line 256 of file texturecache.h.
void CS::RenderManager::TextureCacheT< ReuseCondition, PurgeCondition >::SetFormat | ( | const char * | format | ) | [inline] |
Set format of textures created by a cache.
- Remarks:
- Will only affect newly created textures. Cache will be cleared.
Definition at line 247 of file texturecache.h.
void CS::RenderManager::TextureCacheT< ReuseCondition, PurgeCondition >::SetG3D | ( | iGraphics3D * | g3d | ) | [inline] |
Set iGraphics3D to use.
Definition at line 165 of file texturecache.h.
The documentation for this class was generated from the following file:
- csplugincommon/rendermanager/texturecache.h
Generated for Crystal Space 2.0 by doxygen 1.6.1