|
j3d.org Code | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.j3d.renderer.java3d.texture.J3DTextureCacheFactory
A representation of global cache for texture instance management.
The cache works at the Java3D Texture or ImageComponent 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.
| Field Summary |
| Fields inherited from interface org.j3d.texture.TextureCacheFactory |
DEFAULT_CACHE_PROP, FIXED_CACHE, LAST_CACHE_ID, LRU_CACHE, WEAKREF_CACHE |
| Method Summary | |
static J3DTextureCache |
getCache()
Fetch the default cache provided by the factory. |
static J3DTextureCache |
getCache(int cacheType)
Fetch the cache instance for the given type, creating a new instance if necessary. |
static void |
registerCacheType(int cacheType,
J3DTextureCache cache)
Register your custom instance of a texture cache. |
static void |
setDefaultCacheType(int type)
Set the default cache type to be used. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
public static void setDefaultCacheType(int type)
throws CacheAlreadySetException
type - The default type ID
CacheAlreadySetException - The default type has already been setpublic static J3DTextureCache getCache()
setDefaultCacheType(int) method.
public static J3DTextureCache getCache(int cacheType)
cacheType - An identifier of the required caching algorithm
java.lang.IllegalArgumentException - The cacheType is not a valid type
public static void registerCacheType(int cacheType,
J3DTextureCache cache)
cacheType - The ID to associate with this cachecache - The instance of the cache to register
java.lang.IllegalArgumentException - The cacheType is invalid
|
j3d.org Code | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||