Документ взят из кэша поисковой машины. Адрес оригинального документа : http://astro.uni-altai.ru/~aw/stellarium/api/classStelTextureCache.html
Дата изменения: Unknown
Дата индексирования: Fri Feb 28 07:37:32 2014
Кодировка:

Поисковые слова: р п р п р п р п р п п р п п р п п р п
Stellarium: StelTextureCache< TextureBackend > Class Template Reference
Stellarium 0.12.3
List of all members | Classes | Public Member Functions
StelTextureCache< TextureBackend > Class Template Reference

Caches textures, ensuring no texture is loaded twice. More...

#include <StelTextureCache.hpp>

Public Member Functions

virtual TextureBackend * get (const QString &name, const TextureLoadingMode loadingMode)
 Get a pointer to a cached texture or NULL if not yet in cache. More...
 
virtual void add (TextureBackend *backend)
 Add a texture to the cache (setting its reference count to 1). More...
 
virtual void remove (TextureBackend *backend)
 Remove a texture from the cache. More...
 

Detailed Description

template<class TextureBackend>
class StelTextureCache< TextureBackend >

Caches textures, ensuring no texture is loaded twice.

StelTextureCache is templated by the textured backend used. This way e.g. StelQGLRenderer can have a texture cache storing StelQGLTextureBackend. The template argument class must have a member function called startAsynchronousLoading() which is called to start loading when a texture created with lazy loading mode is requested again with asynchronous or normal loading mode.

Textures are identified by their name, that is full filesystem path or URL. Generated textures without a name can't be cached. The cache keeps pointers to all textures with reference counts; when a texture with the same name is requested more than once, pointer to the previously created texture is returned and the reference count is incremented.

If a texture was created already with asynchronous/lazy loading mode is requested with normal loading mode, and isn't fully loaded yet, the cache waits until the texture loads and then returns it.

Similarly, if the texture was created with lazy loading mode, is requested with asynchronous mode and didn't start loading yet, loading is started and then the texture is returned.

Note
This is an internal class of the Renderer subsystem and should not be used elsewhere.

Definition at line 53 of file StelTextureCache.hpp.

Member Function Documentation

template<class TextureBackend>
virtual void StelTextureCache< TextureBackend >::add ( TextureBackend *  backend)
inlinevirtual

Add a texture to the cache (setting its reference count to 1).

Only a texture that is not yet in cache can be added, use get() to get a texture and increase its reference count.

Parameters
backendTexture backend to add.

Definition at line 129 of file StelTextureCache.hpp.

template<class TextureBackend>
virtual TextureBackend* StelTextureCache< TextureBackend >::get ( const QString &  name,
const TextureLoadingMode  loadingMode 
)
inlinevirtual

Get a pointer to a cached texture or NULL if not yet in cache.

If the texture is already in cache, its reference count is incremented when returing the pointer.

Parameters
nameName of the texture to get.
loadingModeLoading mode used when creating the texture. If the texture is cached but loaded asynchronously, it might not be fully loaded - so if loadingMode is Normal, we wait until it finishes loading. Similarly with lazy/normal or lazy/asynchronous.
Returns
Pointer to the texture if cached, NULL otherwise.

Definition at line 83 of file StelTextureCache.hpp.

template<class TextureBackend>
virtual void StelTextureCache< TextureBackend >::remove ( TextureBackend *  backend)
inlinevirtual

Remove a texture from the cache.

Decrements the reference count. The texture is only actually removed (destroyed) when its reference count hits zero.

Parameters
backendTexture backend to remove.

Definition at line 145 of file StelTextureCache.hpp.


The documentation for this class was generated from the following file: