public interface AVTextureCache
extends org.j3d.texture.TextureCache
The cache works at the Aviatrix 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).
Internal storage and key management is using strings. The URLs are converted to string form as the key and used to look up items. The filenames are always relative to the classpath. If the filename/url has been loaded as an image component before and then a request is made for a texture, then the previously loaded component is used as the basis for the texture.
All fetch methods work in the same way - if the texture has not been previously loaded, then it will be loaded and converted to a BufferedImage using the utilities of this class.
| Modifier and Type | Method and Description |
|---|---|
boolean |
checkTextureComponent(String filename)
Check to see if a filename is cached for an TextureComponent.
|
Texture |
fetchTexture(String filename)
Fetch the texture named by the filename.
|
Texture |
fetchTexture(URL url)
Fetch the texture named by the URL.
|
TextureComponent |
fetchTextureComponent(String filename)
Param fetch the imagecomponent named by the filename.
|
TextureComponent |
fetchTextureComponent(URL url)
Fetch the image component named by the URL.
|
void |
registerTexture(Texture texture,
String filename)
Register a texture with the cache assigned to a filename.
|
void |
registerTextureComponent(TextureComponent component,
String filename)
Register an imagecomponent with the cache assigned to a filename.
|
Texture fetchTexture(String filename) throws IOException
filename - The filename to fetchIOException - An I/O error occurred during loadingTexture fetchTexture(URL url) throws IOException
url - The URL to read data fromIOException - An I/O error occurred during loadingTextureComponent fetchTextureComponent(String filename) throws IOException
filename - The filename to fetchIOException - An I/O error occurred during loadingTextureComponent fetchTextureComponent(URL url) throws IOException
url - The URL to read data fromIOException - An I/O error occurred during loadingboolean checkTextureComponent(String filename)
filename - The filename loadedvoid registerTexture(Texture texture, String filename)
texture - The texture to storefilename - The filename to registervoid registerTextureComponent(TextureComponent component, String filename)
component - The texture to storefilename - The filename to register
Copyright © 2001 - 2015 j3d.org