public class ES2ResourceFactory extends BaseShaderFactory
Modifier and Type | Field and Description |
---|---|
private static java.util.Map<Image,Texture> |
clampTexCache |
private ES2Context |
context |
private int |
maxTextureSize |
private static java.util.Map<Image,Texture> |
mipmapTexCache |
private static java.util.Map<Image,Texture> |
repeatTexCache |
Constructor and Description |
---|
ES2ResourceFactory(Screen screen) |
Modifier and Type | Method and Description |
---|---|
protected boolean |
canClampToEdge() |
protected boolean |
canClampToZero() |
protected boolean |
canRepeat() |
private int |
computeMaxTextureSize() |
Mesh |
createMesh() |
MeshView |
createMeshView(Mesh mesh) |
PhongMaterial |
createPhongMaterial() |
Presentable |
createPresentable(PresentableState pState) |
RTTexture |
createRTTexture(int width,
int height,
Texture.WrapMode wrapMode) |
RTTexture |
createRTTexture(int width,
int height,
Texture.WrapMode wrapMode,
boolean msaa) |
Shader |
createShader(java.io.InputStream pixelShaderCode,
java.util.Map<java.lang.String,java.lang.Integer> samplers,
java.util.Map<java.lang.String,java.lang.Integer> params,
int maxTexCoordIndex,
boolean isPixcoordUsed,
boolean isPerVertexColorUsed) |
Shader |
createStockShader(java.lang.String name) |
Texture |
createTexture(MediaFrame frame)
Returns a new
Texture that can contain the video image as specified
in the provided MediaFrame . |
Texture |
createTexture(PixelFormat formatHint,
Texture.Usage usageHint,
Texture.WrapMode wrapMode,
int w,
int h)
Returns a new
Texture with the given format and edge wrapping
support. |
Texture |
createTexture(PixelFormat formatHint,
Texture.Usage usageHint,
Texture.WrapMode wrapMode,
int w,
int h,
boolean useMipmap)
Returns a new
Texture with the given format and edge wrapping
support. |
private static java.lang.String |
createVertexShaderCode(boolean includePerVertexColor,
int maxTexCoordIndex) |
void |
dispose() |
int |
getMaximumTextureSize()
Returns the maximum supported texture dimension for this device.
|
int |
getRTTHeight(int h,
Texture.WrapMode wrapMode) |
int |
getRTTWidth(int w,
Texture.WrapMode wrapMode) |
TextureResourcePool |
getTextureResourcePool() |
private java.util.Map<java.lang.String,java.lang.Integer> |
getVertexAttributes(boolean includePerVertexColor,
int maxTexCoordIndex) |
boolean |
isCompatibleTexture(Texture tex)
A Texture may have been obtained from a different resource factory.
|
boolean |
isFormatSupported(PixelFormat format)
Returns true if the given
PixelFormat is supported; otherwise
returns false. |
createArcRep, createEllipseRep, createPathRep, createRoundRectRep
addFactoryListener, clearTextureCache, clearTextureCache, createFloatTexture, createMaskTexture, createTexture, createTexture, getCachedTexture, getCachedTexture, getFactoryListeners, getGlyphTexture, getRegionTexture, isDeviceReady, isSuperShaderAllowed, isWrapModeSupported, notifyReleased, notifyReset, removeFactoryListener, setGlyphTexture, setRegionTexture
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addFactoryListener, createFloatTexture, createMaskTexture, createTexture, createTexture, getCachedTexture, getCachedTexture, getGlyphTexture, getRegionTexture, isDeviceReady, isSuperShaderAllowed, isWrapModeSupported, removeFactoryListener, setGlyphTexture, setRegionTexture
private ES2Context context
private final int maxTextureSize
ES2ResourceFactory(Screen screen)
public TextureResourcePool getTextureResourcePool()
public Presentable createPresentable(PresentableState pState)
public boolean isCompatibleTexture(Texture tex)
ResourceFactory
tex
- the texture to check.protected boolean canClampToZero()
canClampToZero
in class BaseResourceFactory
protected boolean canRepeat()
canRepeat
in class BaseResourceFactory
protected boolean canClampToEdge()
canClampToEdge
in class BaseResourceFactory
public Texture createTexture(PixelFormat formatHint, Texture.Usage usageHint, Texture.WrapMode wrapMode, int w, int h)
ResourceFactory
Texture
with the given format and edge wrapping
support. Note that the dimensions of the returned texture may be larger
than those requested and the wrap mode may be a simulated version of
the type requested.formatHint
- intended pixel format of the data to be stored
in this textureusageHint
- the Dynamic vs. Static nature of the texture datawrapMode
- intended wrap mode to be used for the texturew
- width of the content in the textureh
- height of the content in the texturepublic Texture createTexture(PixelFormat formatHint, Texture.Usage usageHint, Texture.WrapMode wrapMode, int w, int h, boolean useMipmap)
ResourceFactory
Texture
with the given format and edge wrapping
support. Note that the dimensions of the returned texture may be larger
than those requested and the wrap mode may be a simulated version of
the type requested.formatHint
- intended pixel format of the data to be stored
in this textureusageHint
- the Dynamic vs. Static nature of the texture datawrapMode
- intended wrap mode to be used for the texturew
- width of the content in the textureh
- height of the content in the textureuseMipmap
- the flag indicates should texture be created with mipmappublic Texture createTexture(MediaFrame frame)
ResourceFactory
Texture
that can contain the video image as specified
in the provided MediaFrame
. Note that padding is almost implicit
since this method has to accommodate the line strides of each plane. Also
due to renderer limitations, some format conversion may be necessary so
the texture format may end up being different from the video image format.frame
- the video image that we need to create a new texture forpublic int getRTTWidth(int w, Texture.WrapMode wrapMode)
public int getRTTHeight(int h, Texture.WrapMode wrapMode)
public RTTexture createRTTexture(int width, int height, Texture.WrapMode wrapMode)
public RTTexture createRTTexture(int width, int height, Texture.WrapMode wrapMode, boolean msaa)
public boolean isFormatSupported(PixelFormat format)
ResourceFactory
PixelFormat
is supported; otherwise
returns false.
Note that the following formats are guaranteed to be supported across all devices:
BYTE_RGB
BYTE_RGBA_PRE
BYTE_GRAY
BYTE_ALPHA
Support for the other formats depends on the capabilities of the
device. Be sure to call this method before attempting to create
a Texture
with a non-standard format and plan to have an
alternate codepath if the given format is not supported.
format
- the PixelFormat
to testprivate int computeMaxTextureSize()
public int getMaximumTextureSize()
ResourceFactory
public Shader createShader(java.io.InputStream pixelShaderCode, java.util.Map<java.lang.String,java.lang.Integer> samplers, java.util.Map<java.lang.String,java.lang.Integer> params, int maxTexCoordIndex, boolean isPixcoordUsed, boolean isPerVertexColorUsed)
private static java.lang.String createVertexShaderCode(boolean includePerVertexColor, int maxTexCoordIndex)
private java.util.Map<java.lang.String,java.lang.Integer> getVertexAttributes(boolean includePerVertexColor, int maxTexCoordIndex)
public Shader createStockShader(java.lang.String name)
public void dispose()
public PhongMaterial createPhongMaterial()
public Mesh createMesh()