|
NASA World Wind | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectgov.nasa.worldwind.cache.BasicGpuResourceCache
public class BasicGpuResourceCache
Provides the interface for caching of OpenGL resources that are stored on or registered with a GL context. This cache
maintains a map of resources that fit within a specifiable memory capacity. If adding a resource would exceed this
cache's capacity, existing but least recently used resources are removed from the cache to make room. The cache is
reduced to the "low water" size in this case (see setLowWater(long).
| Nested Class Summary | |
|---|---|
static class |
BasicGpuResourceCache.CacheEntry
|
| Field Summary | |
|---|---|
protected BasicMemoryCache |
resources
|
| Fields inherited from interface gov.nasa.worldwind.cache.GpuResourceCache |
|---|
DISPLAY_LISTS, TEXTURE, VBO_BUFFERS |
| Constructor Summary | |
|---|---|
BasicGpuResourceCache(long loWater,
long hiWater)
|
|
| Method Summary | |
|---|---|
void |
clear()
Removes all entries from this cache. |
protected long |
computeEntrySize(BasicGpuResourceCache.CacheEntry entry)
|
protected long |
computeTextureSize(BasicGpuResourceCache.CacheEntry entry)
|
boolean |
contains(Object key)
Indicates whether a resource is in the cache. |
protected BasicGpuResourceCache.CacheEntry |
createCacheEntry(Object resource,
String resourceType)
|
protected BasicGpuResourceCache.CacheEntry |
createCacheEntry(Object resource,
String resourceType,
long size)
|
Object |
get(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()
Returns the low water level in bytes. |
int |
getNumObjects()
Indicates the number of resources in this cache. |
Texture |
getTexture(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. |
protected void |
onEntryRemoved(Object key,
Object clientObject)
|
void |
put(Object key,
Object resource,
String resourceType,
long size)
Adds a new resource to this cache. |
void |
put(Object key,
Texture texture)
Add a resource to this cache. |
void |
remove(Object key)
Removes a resource from this cache. |
void |
setCapacity(long newCapacity)
Sets the new capacity (in bytes) for the cache. |
void |
setLowWater(long loWater)
Sets the new low water level in bytes, which controls how aggresively the cache discards items. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final BasicMemoryCache resources
| Constructor Detail |
|---|
public BasicGpuResourceCache(long loWater,
long hiWater)
| Method Detail |
|---|
public void clear()
GpuResourceCache
clear in interface GpuResourceCacheprotected long computeEntrySize(BasicGpuResourceCache.CacheEntry entry)
protected long computeTextureSize(BasicGpuResourceCache.CacheEntry entry)
public boolean contains(Object key)
GpuResourceCache
contains in interface GpuResourceCachekey - the resource's key.
protected BasicGpuResourceCache.CacheEntry createCacheEntry(Object resource,
String resourceType)
protected BasicGpuResourceCache.CacheEntry createCacheEntry(Object resource,
String resourceType,
long size)
public Object get(Object key)
GpuResourceCache
get in interface GpuResourceCachekey - the resource's key.
public long getCapacity()
GpuResourceCache
getCapacity in interface GpuResourceCachepublic long getFreeCapacity()
GpuResourceCache
getFreeCapacity in interface GpuResourceCacheGpuResourceCache.getCapacity()public long getLowWater()
getLowWater in interface GpuResourceCacheGpuResourceCache.setLowWater(long)public int getNumObjects()
GpuResourceCache
getNumObjects in interface GpuResourceCachepublic Texture getTexture(Object key)
GpuResourceCache
getTexture in interface GpuResourceCachekey - the texture resource's key.
public long getUsedCapacity()
GpuResourceCache
getUsedCapacity in interface GpuResourceCacheGpuResourceCache.getCapacity()
protected void onEntryRemoved(Object key,
Object clientObject)
public void put(Object key,
Object resource,
String resourceType,
long size)
GpuResourceCache
put in interface GpuResourceCachekey - 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.GpuResourceCache.put(Object, com.jogamp.opengl.util.texture.Texture)
public void put(Object key,
Texture texture)
GpuResourceCache
put in interface GpuResourceCachekey - the key identifying the resource.texture - the resource to add to this cache.public void remove(Object key)
GpuResourceCache
remove in interface GpuResourceCachekey - the resource's key.public void setCapacity(long newCapacity)
setCapacity in interface GpuResourceCachenewCapacity - the new capacity of the cache.GpuResourceCache.setLowWater(long)public void setLowWater(long loWater)
setLowWater in interface GpuResourceCacheloWater - the new low water level in bytes.GpuResourceCache.setCapacity(long),
GpuResourceCache.remove(Object)
|
NASA World Wind | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||