Документ взят из кэша поисковой машины. Адрес
оригинального документа
: http://astro.uni-altai.ru/~aw/stellarium/api/classStelTextureCache.html
Дата изменения: Unknown Дата индексирования: Fri Feb 28 07:37:32 2014 Кодировка: Поисковые слова: 47 tuc |
Stellarium 0.12.3
|
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... | |
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.
Definition at line 53 of file StelTextureCache.hpp.
|
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.
backend | Texture backend to add. |
Definition at line 129 of file StelTextureCache.hpp.
|
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.
name | Name of the texture to get. |
loadingMode | Loading 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. |
Definition at line 83 of file StelTextureCache.hpp.
|
inlinevirtual |
Remove a texture from the cache.
Decrements the reference count. The texture is only actually removed (destroyed) when its reference count hits zero.
backend | Texture backend to remove. |
Definition at line 145 of file StelTextureCache.hpp.