Class TextureAtlas.AtlasBackingStore
- java.lang.Object
-
- gov.nasa.worldwind.util.TextureAtlas.AtlasBackingStore
-
- All Implemented Interfaces:
com.jogamp.opengl.util.packrect.BackingStoreManager
- Enclosing class:
- TextureAtlas
protected class TextureAtlas.AtlasBackingStore extends java.lang.Object implements com.jogamp.opengl.util.packrect.BackingStoreManager
Implementation of the JOGL BackingStoreManager interface for texture atlas. This is used by the JOGLRectanglePacker
, and delegates calls from a JOGL rectangle packer to methods in this texture atlas.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AtlasBackingStore()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
additionFailed(com.jogamp.opengl.util.packrect.Rect cause, int attemptNumber)
java.lang.Object
allocateBackingStore(int w, int h)
void
beginMovement(java.lang.Object oldBackingStore, java.lang.Object newBackingStore)
boolean
canCompact()
void
deleteBackingStore(java.lang.Object backingStore)
void
endMovement(java.lang.Object oldBackingStore, java.lang.Object newBackingStore)
void
move(java.lang.Object oldBackingStore, com.jogamp.opengl.util.packrect.Rect oldLocation, java.lang.Object newBackingStore, com.jogamp.opengl.util.packrect.Rect newLocation)
boolean
preExpand(com.jogamp.opengl.util.packrect.Rect cause, int attemptNumber)
-
-
-
Method Detail
-
allocateBackingStore
public java.lang.Object allocateBackingStore(int w, int h)
Calls
TextureAtlas.createBackingImage(int, int)
with the specified width and height.- Specified by:
allocateBackingStore
in interfacecom.jogamp.opengl.util.packrect.BackingStoreManager
-
deleteBackingStore
public void deleteBackingStore(java.lang.Object backingStore)
- Specified by:
deleteBackingStore
in interfacecom.jogamp.opengl.util.packrect.BackingStoreManager
-
canCompact
public boolean canCompact()
Returns
true
. The texture atlas can always attempt to expand or compact.- Specified by:
canCompact
in interfacecom.jogamp.opengl.util.packrect.BackingStoreManager
-
preExpand
public boolean preExpand(com.jogamp.opengl.util.packrect.Rect cause, int attemptNumber)
Returns
false
, indicating that the rectangle packer should just expand. When configured to do so, texture atlas evicts old elements inadditionFailed
if this texture atlas is full and the addition would otherwise fail.- Specified by:
preExpand
in interfacecom.jogamp.opengl.util.packrect.BackingStoreManager
-
additionFailed
public boolean additionFailed(com.jogamp.opengl.util.packrect.Rect cause, int attemptNumber)
If this texture atlas is configured to evicts old elements, this attempts to remove the oldest one then exits, allowing the caller to attempt the addition again. This throws a WWRuntimeException if this texture atlas is not configured to evict old elements, or if there are no more elements to evict.
- Specified by:
additionFailed
in interfacecom.jogamp.opengl.util.packrect.BackingStoreManager
- Throws:
WWRuntimeException
- if this backing store cannot fit the rectangle in its layout.
-
beginMovement
public void beginMovement(java.lang.Object oldBackingStore, java.lang.Object newBackingStore)
Calls
TextureAtlas.beginMoveEntries(java.awt.image.BufferedImage, java.awt.image.BufferedImage)
, casting the specified backing stores to BufferedImages.- Specified by:
beginMovement
in interfacecom.jogamp.opengl.util.packrect.BackingStoreManager
-
move
public void move(java.lang.Object oldBackingStore, com.jogamp.opengl.util.packrect.Rect oldLocation, java.lang.Object newBackingStore, com.jogamp.opengl.util.packrect.Rect newLocation)
Calls
TextureAtlas.moveEntry(java.awt.image.BufferedImage, com.jogamp.opengl.util.packrect.Rect, java.awt.image.BufferedImage, com.jogamp.opengl.util.packrect.Rect)
, casting the specified backing stores to BufferedImages.- Specified by:
move
in interfacecom.jogamp.opengl.util.packrect.BackingStoreManager
-
endMovement
public void endMovement(java.lang.Object oldBackingStore, java.lang.Object newBackingStore)
Calls
TextureAtlas.endMoveEntries(java.awt.image.BufferedImage, java.awt.image.BufferedImage)
, casting the specified backing stores to BufferedImages.- Specified by:
endMovement
in interfacecom.jogamp.opengl.util.packrect.BackingStoreManager
-
-