|
j3d.org Code | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
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).
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.
| Method Summary | |
boolean |
checkImageComponent(java.lang.String filename)
Check to see if a filename is cached for an ImageComponent. |
javax.media.j3d.ImageComponent |
fetchImageComponent(java.lang.String filename)
Param fetch the imagecomponent named by the filename. |
javax.media.j3d.ImageComponent |
fetchImageComponent(java.net.URL url)
Fetch the image component named by the URL. |
javax.media.j3d.Texture |
fetchTexture(java.lang.String filename)
Fetch the texture named by the filename. |
javax.media.j3d.Texture |
fetchTexture(java.net.URL url)
Fetch the texture named by the URL. |
void |
registerImageComponent(javax.media.j3d.ImageComponent component,
java.lang.String filename)
Register an imagecomponent with the cache assigned to a filename. |
void |
registerTexture(javax.media.j3d.Texture texture,
java.lang.String filename)
Register a texture with the cache assigned to a filename. |
| Methods inherited from interface org.j3d.texture.TextureCache |
checkTexture, clearAll, releaseTexture, releaseTexture |
| Method Detail |
public javax.media.j3d.Texture fetchTexture(java.lang.String filename)
throws java.io.IOException
filename - The filename to fetch
java.io.IOException - An I/O error occurred during loading
public javax.media.j3d.Texture fetchTexture(java.net.URL url)
throws java.io.IOException
url - The URL to read data from
java.io.IOException - An I/O error occurred during loading
public javax.media.j3d.ImageComponent fetchImageComponent(java.lang.String filename)
throws java.io.IOException
filename - The filename to fetch
java.io.IOException - An I/O error occurred during loading
public javax.media.j3d.ImageComponent fetchImageComponent(java.net.URL url)
throws java.io.IOException
url - The URL to read data from
java.io.IOException - An I/O error occurred during loadingpublic boolean checkImageComponent(java.lang.String filename)
filename - The filename loaded
public void registerTexture(javax.media.j3d.Texture texture,
java.lang.String filename)
texture - The texture to storefilename - The filename to register
public void registerImageComponent(javax.media.j3d.ImageComponent component,
java.lang.String filename)
component - The texture component to storefilename - The filename to register
|
j3d.org Code | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||