public abstract class BaseResourceFactory extends java.lang.Object implements ResourceFactory
| Modifier and Type | Field and Description |
|---|---|
private java.util.Map<Image,Texture> |
clampTexCache |
private Texture |
glyphTexture |
private java.util.WeakHashMap<ResourceFactoryListener,java.lang.Boolean> |
listenerMap |
private java.util.Map<Image,Texture> |
mipmapTexCache |
private Texture |
regionTexture |
private java.util.Map<Image,Texture> |
repeatTexCache |
private boolean |
superShaderAllowed |
| Constructor and Description |
|---|
BaseResourceFactory() |
BaseResourceFactory(java.util.Map<Image,Texture> clampTexCache,
java.util.Map<Image,Texture> repeatTexCache,
java.util.Map<Image,Texture> mipmapTexCache) |
| Modifier and Type | Method and Description |
|---|---|
void |
addFactoryListener(ResourceFactoryListener l) |
protected boolean |
canClampToEdge() |
protected boolean |
canClampToZero() |
protected boolean |
canRepeat() |
protected void |
clearTextureCache() |
protected void |
clearTextureCache(java.util.Map<Image,Texture> texCache) |
Texture |
createFloatTexture(int width,
int height) |
Texture |
createMaskTexture(int width,
int height,
Texture.WrapMode wrapMode) |
Texture |
createTexture(Image image,
Texture.Usage usageHint,
Texture.WrapMode wrapMode)
Returns a new
Texture containing the pixels from the given
image with the indicated texture edge wrap mode. |
Texture |
createTexture(Image image,
Texture.Usage usageHint,
Texture.WrapMode wrapMode,
boolean useMipmap)
Returns a new
Texture containing the pixels from the given
image with the indicated texture edge wrap mode. |
Texture |
getCachedTexture(Image image,
Texture.WrapMode wrapMode)
Returns a
Texture for the given image set up to use or
simulate the indicated wrap mode. |
Texture |
getCachedTexture(Image image,
Texture.WrapMode wrapMode,
boolean useMipmap)
Returns a
Texture for the given image set up to use or
simulate the indicated wrap mode. |
protected ResourceFactoryListener[] |
getFactoryListeners() |
Texture |
getGlyphTexture() |
Texture |
getRegionTexture() |
boolean |
isDeviceReady()
Returns status of this graphics device.
|
boolean |
isSuperShaderAllowed() |
boolean |
isWrapModeSupported(Texture.WrapMode mode)
Returns true iff the indicated
wrap mode is directly
supported (i.e. |
protected void |
notifyReleased()
Called when the factory's data is released
|
protected void |
notifyReset()
Called when the factory is reset.
|
void |
removeFactoryListener(ResourceFactoryListener l) |
void |
setGlyphTexture(Texture texture) |
void |
setRegionTexture(Texture texture) |
(package private) static long |
sizeWithMipMap(int w,
int h,
PixelFormat format) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcreateArcRep, createEllipseRep, createMesh, createMeshView, createPathRep, createPhongMaterial, createPresentable, createRoundRectRep, createRTTexture, createRTTexture, createTexture, createTexture, createTexture, dispose, getMaximumTextureSize, getRTTHeight, getRTTWidth, getTextureResourcePool, isCompatibleTexture, isFormatSupportedprivate final java.util.WeakHashMap<ResourceFactoryListener,java.lang.Boolean> listenerMap
private Texture regionTexture
private Texture glyphTexture
private boolean superShaderAllowed
public void addFactoryListener(ResourceFactoryListener l)
addFactoryListener in interface ResourceFactorypublic void removeFactoryListener(ResourceFactoryListener l)
removeFactoryListener in interface ResourceFactorypublic boolean isDeviceReady()
ResourceFactoryisDeviceReady in interface ResourceFactoryprotected void clearTextureCache()
protected ResourceFactoryListener[] getFactoryListeners()
protected void notifyReset()
protected void notifyReleased()
static long sizeWithMipMap(int w,
int h,
PixelFormat format)
public Texture getCachedTexture(Image image, Texture.WrapMode wrapMode)
ResourceFactoryTexture for the given image set up to use or
simulate the indicated wrap mode.
If no texture could be found in the cache, this method will create a
new texture and put it in the cache before returning it.
NOTE: the caller of this method should not hold a reference to the
cached texture beyond its immediate needs since the cache may be
cleared at any time.getCachedTexture in interface ResourceFactoryimage - the pixel data to be uploaded if the texture is new or
needs new fringe pixels to simulate a new wrap modewrapMode - the mode that describes the behavior for samples
outside the content areapublic Texture getCachedTexture(Image image, Texture.WrapMode wrapMode, boolean useMipmap)
ResourceFactoryTexture for the given image set up to use or
simulate the indicated wrap mode.
If no texture could be found in the cache, this method will create a
new texture and put it in the cache before returning it.
NOTE: the caller of this method should not hold a reference to the
cached texture beyond its immediate needs since the cache may be
cleared at any time.getCachedTexture in interface ResourceFactoryimage - the pixel data to be uploaded if the texture is new or
needs new fringe pixels to simulate a new wrap modewrapMode - the mode that describes the behavior for samples
outside the contentuseMipmap - the flag indicates should mipmapping be used for this
texturepublic Texture createTexture(Image image, Texture.Usage usageHint, Texture.WrapMode wrapMode)
ResourceFactoryTexture containing the pixels from the given
image with the indicated texture edge wrap mode.
Note that the dimensions of the returned texture may be larger
than those of the given image.
Equivalent to (but perhaps more efficient than):
PixelFormat format = image.getPixelFormat();
int w = image.getWidth();
int h = image.getHeight();
Texture tex = createTexture(format, usageHint, wrapMode, w, h);
tex.update(image, 0, 0, w, h);
createTexture in interface ResourceFactoryimage - the pixel data to be uploaded to the new textureusageHint - the Dynamic vs. Static nature of the texture datawrapMode - the desired edge behavior (clamping vs. wrapping)public Texture createTexture(Image image, Texture.Usage usageHint, Texture.WrapMode wrapMode, boolean useMipmap)
ResourceFactoryTexture containing the pixels from the given
image with the indicated texture edge wrap mode.
Note that the dimensions of the returned texture may be larger
than those of the given image.
Equivalent to (but perhaps more efficient than):
PixelFormat format = image.getPixelFormat();
int w = image.getWidth();
int h = image.getHeight();
Texture tex = createTexture(format, usageHint, wrapMode, w, h, useMipmap);
tex.update(image, 0, 0, w, h);
createTexture in interface ResourceFactoryimage - the pixel data to be uploaded to the new textureusageHint - the Dynamic vs. Static nature of the texture datawrapMode - the desired edge behavior (clamping vs. wrapping)useMipmap - the flag indicates should texture be created with mipmappublic Texture createMaskTexture(int width, int height, Texture.WrapMode wrapMode)
createMaskTexture in interface ResourceFactorypublic Texture createFloatTexture(int width, int height)
createFloatTexture in interface ResourceFactorypublic void setRegionTexture(Texture texture)
setRegionTexture in interface ResourceFactorypublic Texture getRegionTexture()
getRegionTexture in interface ResourceFactorypublic void setGlyphTexture(Texture texture)
setGlyphTexture in interface ResourceFactorypublic Texture getGlyphTexture()
getGlyphTexture in interface ResourceFactorypublic boolean isSuperShaderAllowed()
isSuperShaderAllowed in interface ResourceFactoryprotected boolean canClampToZero()
protected boolean canClampToEdge()
protected boolean canRepeat()
public boolean isWrapModeSupported(Texture.WrapMode mode)
ResourceFactorywrap mode is directly
supported (i.e. not simulated) by the underlying pipeline and platform.isWrapModeSupported in interface ResourceFactorymode - the desired WrapMode