public interface GpuResourceCache
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DISPLAY_LISTS
Identifies resources as Display List IDs.
|
static java.lang.String |
TEXTURE
Identifies resources as textures.
|
static java.lang.String |
VBO_BUFFERS
Identifies resources as Vertex Buffer IDs.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Removes all entries from this cache.
|
boolean |
contains(java.lang.Object key)
Indicates whether a resource is in the cache.
|
java.lang.Object |
get(java.lang.Object key)
Finds and returns a resource from this cache.
|
long |
getCapacity()
Indicates this cache's capacity in bytes.
|
long |
getFreeCapacity()
Indicates this cache's memory capacity not used by its cached objects.
|
long |
getLowWater()
Indicates the cache's low water size.
|
int |
getNumObjects()
Indicates the number of resources in this cache.
|
Texture |
getTexture(java.lang.Object key)
Finds and returns a texture resource from this cache.
|
long |
getUsedCapacity()
Indicates the amount of memory used by cached objects in this cache.
|
void |
put(java.lang.Object key,
java.lang.Object resource,
java.lang.String resourceType,
long size)
Adds a new resource to this cache.
|
void |
put(java.lang.Object key,
Texture texture)
Add a resource to this cache.
|
void |
remove(java.lang.Object key)
Removes a resource from this cache.
|
void |
setCapacity(long newCapacity)
Specifies this cache's capacity, the amount of memory the cache manages.
|
void |
setLowWater(long loWater)
Specifies the low water size for this cache.
|
static final java.lang.String DISPLAY_LISTS
static final java.lang.String TEXTURE
Texture
.static final java.lang.String VBO_BUFFERS
void clear()
boolean contains(java.lang.Object key)
key
- the resource's key.java.lang.Object get(java.lang.Object key)
key
- the resource's key.java.lang.IllegalArgumentException
- if the key is null.long getCapacity()
long getFreeCapacity()
getCapacity()
long getLowWater()
setLowWater(long)
int getNumObjects()
Texture getTexture(java.lang.Object key)
key
- the texture resource's key.java.lang.IllegalArgumentException
- if the key is null.long getUsedCapacity()
getCapacity()
void put(java.lang.Object key, java.lang.Object resource, java.lang.String resourceType, long size)
key
- the key identifying the resource.resource
- the resource cached.resourceType
- the type of resource, one of the resource-type constants described above.size
- the size of the resource, expressed as the number of bytes it requires on the GPU.put(Object, com.jogamp.opengl.util.texture.Texture)
void put(java.lang.Object key, Texture texture)
key
- the key identifying the resource.texture
- the resource to add to this cache.java.lang.IllegalArgumentException
- if either argument is null.void remove(java.lang.Object key)
key
- the resource's key.java.lang.IllegalArgumentException
- if the key is null.void setCapacity(long newCapacity)
newCapacity
- the number of bytes allowed for the cache's resources. Values less than or equal to 0 are
ignored and cause no change to this cache's capacity.setLowWater(long)
void setLowWater(long loWater)
loWater
- the size to reduce this cache to when added resources would exceed the cache's capacity. Values
less than or equal to 0 are ignored and cause no change to this cache's low water size.setCapacity(long)
,
remove(Object)