j3d.org Code

org.j3d.texture
Interface TextureCache


public interface TextureCache

A representation of global cache for texture instance management.

This is the abstract representation of the cache functionality, which may be used across different renderer types. Look in the renderer-specific packages for details on the specific renderer API calls.

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.

Version:
$Revision: 1.3 $
Author:
Justin Couch

Method Summary
 boolean checkTexture(java.lang.String filename)
          Check to see if a filename is cached for a Texture.
 void clearAll()
          Clear the entire cache now.
 void releaseTexture(java.lang.String filename)
          Explicitly remove the named texture and image component from the cache.
 void releaseTexture(java.net.URL url)
          Explicitly remove the named texture and image component from the cache.
 

Method Detail

releaseTexture

void releaseTexture(java.lang.String filename)
Explicitly remove the named texture and image component from the cache. If the objects have already been freed according to the rules of the cache system, this request is silently ignored.

Parameters:
filename - The name the texture was registered under

releaseTexture

void releaseTexture(java.net.URL url)
Explicitly remove the named texture and image component from the cache. If the objects have already been freed according to the rules of the cache system, this request is silently ignored.

Parameters:
url - The URL the texture was registered under

clearAll

void clearAll()
Clear the entire cache now. It will be empty after this call, forcing all fetch requests to reload the data from the source. Use with caution.


checkTexture

boolean checkTexture(java.lang.String filename)
Check to see if a filename is cached for a Texture.

Parameters:
filename - The filename loaded
Returns:
Whether the filename is cached as a Texture

j3d.org Code

Latest Info from http://code.j3d.org/
Copyright © 2001 - j3d.org