public class AVTextureCacheFactory extends Object implements org.j3d.texture.TextureCacheFactory
The cache works at the Aviatrix3D Texture or TextureComponent instance level rather than down at the individual images. This allows the VM to discard the lower level image instances if needed, allowing Java3D to do its own management. In addition, it benefits runtime performance of the Java3D scene graph by allowing textures instances to be shared, rather than duplicated.
Different types of cache implementations are allowed (ie different ways of deciding when an texture no longer needs to be in the cache).
The factory also supports the concept of the "default cache". This is used when you want a simple system that doesn't really care about the cache type used and just wants to use this class as a global singleton for storing the texture information. The default cache type can be controlled through either directly setting the value in this class, or using a system property. By defining a value for the property
org.j3d.texture.DefaultCacheTypewith one of the values (case-sensitive)
fixed, lru
or weakref. Setting the type through the method call will
override this setting. However, the cache type can only be set once. All
further attempts will result in an exception.
Internationalisation Resource Names
| Modifier and Type | Method and Description |
|---|---|
static AVTextureCache |
getCache()
Fetch the default cache provided by the factory.
|
static AVTextureCache |
getCache(int cacheType)
Fetch the cache instance for the given type, creating a new instance
if necessary.
|
static void |
registerCacheType(int cacheType,
AVTextureCache cache)
Register your custom instance of a texture cache.
|
static void |
setDefaultCacheType(int type)
Set the default cache type to be used.
|
public static void setDefaultCacheType(int type)
throws org.j3d.texture.CacheAlreadySetException
type - The default type IDorg.j3d.texture.CacheAlreadySetException - The default type has already been setpublic static AVTextureCache getCache()
setDefaultCacheType(int) method.public static AVTextureCache getCache(int cacheType)
cacheType - An identifier of the required caching algorithmIllegalArgumentException - The cacheType is not a valid typepublic static void registerCacheType(int cacheType,
AVTextureCache cache)
cacheType - The ID to associate with this cachecache - The instance of the cache to registerIllegalArgumentException - The cacheType is invalid
Copyright © 2001 - 2015 j3d.org