|
Aviatrix3D 2.1.0 |
|||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |
See:
Description
Interface Summary | |
---|---|
AVTextureCache | A representation of global cache for texture instance management. |
Class Summary | |
---|---|
AbstractTextureCache | An abstract implementation of the cache with a collection of useful utility methods for any cache implementation. |
AVTextureCacheFactory | A representation of global cache for texture instance management. |
TextureCreateUtils | Convenience class with a collection of useful utility methods taking an image and turning it into a Aviatrix3D texture object. |
Generalised classes for handling of textures.
The cache is based around a factory and a number of cache implementations. Because different applications have different caching requirements, there are three default cache types available and you may also register your own custom versions with the system. All cache implementations are represented by an abstract interface. Your application code never deals directly with the implementation classes. An implementation is fetched from the factory. It is guaranteed that for each cache type, there will only be one instance created over the lifetime of your application. Feel free to grab the cache from the factory and then throw the reference away immediately as the factory maintains everything.
For those that don't feel like having to remember cache type configurations all the time, the factory also provides a way of setting a default cache. Once set, you can always fetch this without having to remember which type to use.
Fixed cache never throws anything away unless you explicitly tell it to. Useful if you have a lot of small textures or a small amount of large ones that you use frequently.
WeakRef cache uses the Java weak-reference system to maintain textures. All textures are maintained with a weak reference. The normal rules apply. If the reference is garbage collected, we fetch all the object back again and put it back into the cache. Useful when you have a relatively small memory footprint or if you are using several really large images that impact memory usage elsewhere and you don't care if they disappear or not (that is, you access them infrequently and the performance penalty of having to reload them from disk is not an issue).
LRU cache uses the standard Least Recently Used algorithm to maintain the items in the cache. The most recently accessed objects are maintained and when too many are loaded the cache starts tossing away the ones that have not been accessed recently. The implementation here uses a fixed size cache (20 by default, but can be changed). Any more textures stored than the given number and the oldest items are turfed.
org.j3d.texture.DefaultCacheType org.j3d.texture.LRUSizeThe default cache type is a string with one of the values
fixed
,
lru
or weakref
(case-sensitive strings). This sets
the type of cache to be returned if there is a request for the default cache.
The LRUSize is used to control the maximum number of items that can be stored in that cache implementation before items start getting removed. The value is an integer and the default value is 20.
|
Aviatrix3D 2.1.0 |
|||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |