public class Texture
extends java.lang.Object
implements java.io.Serializable
TextureManager
,
Serialized FormModifier and Type | Field and Description |
---|---|
static int |
DEFAULT_HEIGHT
The default height of a texture (16 pixels).
|
static int |
DEFAULT_WIDTH
The default width of a texture (16 pixels).
|
Constructor and Description |
---|
Texture(Bitmap image)
Creates a texture using a Bitmap. jPCT supports every format that JAVA
supports for creating images from files as long as the result is a 24bpp
image.
|
Texture(Bitmap image,
boolean useAlpha)
Creates a texture using a Bitmap. jPCT supports every format that JAVA
supports for creating images from files as long as the result is a 24bpp
image.
|
Texture(Drawable image)
Creates a texture using a Drawble. jPCT supports every format that JAVA
supports for creating images from files as long as the result is a 24bpp
image.
|
Texture(Drawable image,
boolean useAlpha)
Creates a texture using a Drawable. jPCT supports every format that JAVA
supports for creating images from files as long as the result is a 24bpp
image.
|
Texture(java.io.InputStream is)
Creates a texture using an image from file. jPCT supports every format
that JAVA supports for creating images from files as long as the result
is a 24bpp image.
|
Texture(java.io.InputStream is,
boolean useAlpha)
Creates a texture using an image from file (usually in jpeg format). jPCT
supports every format that JAVA supports for creating images from files
as long as the result is a 24bpp image.
|
Texture(java.io.InputStream is,
boolean useAlpha,
boolean closeStream)
Creates a texture using an image from file (usually in jpeg format). jPCT
supports every format that JAVA supports for creating images from files
as long as the result is a 24bpp image.
|
Texture(int width,
int height)
Creates a black texture with no alpha in the given dimensions.
|
Texture(int width,
int height,
int alpha)
Creates a black texture with alpha in the given dimensions.
|
Texture(int width,
int height,
RGBColor col)
Creates a colored texture with no alpha in the given dimensions.
|
Modifier and Type | Method and Description |
---|---|
void |
add(Texture ta,
float weight)
Adds a textures color (and alpha) information to this one.
|
void |
applyEffect()
Applies the effect to the texture.
|
void |
compress()
Compresses the texture so that is uses less main memory.
|
static void |
defaultTo4bpp(boolean doit)
Static method to set the textures' default depth to 4bpp (respectively
5bpp without a dedicated alpha channel).
|
static void |
defaultToKeepPixels(boolean doit)
Static method to set the textures' default behaviour for keeping the
pixel data after uploading to the gpu.
|
static void |
defaultToMipmapping(boolean doit)
Static method to make all textures use mipmaps by default.
|
void |
enable4bpp(boolean doit)
Makes jPCT converting this texture to use 4 bits per pixel/alpha
(respectively 5/1 without a dedicated alpha channel) instead of 8, i.e.
|
void |
enableClamping()
Deprecated.
|
int |
getArraySize()
Returns the size of the texture array.
|
DepthBuffer |
getDepthBuffer()
Returns the depth buffer if one has been set or null otherwise.
|
int |
getExternalId()
Returns the external id if one has been set or -1 otherwise.
|
int |
getHeight()
Returns the height of the texture in pixels.
|
int |
getMemoryUsage()
Returns the actual memory usage in VM memory.
|
int |
getWidth()
Returns the width of the texture in pixels.
|
boolean |
isEnabled()
Returns if the texture is enabled or not.
|
void |
keepPixelData(boolean keepData)
Should a texture's pixels be kept even when the texture has been uploaded
to the GPU?
|
void |
overrideTexelData(java.nio.ByteBuffer texels)
This will override the actual texel data with the data from the buffer.
|
void |
removeAlpha()
Removes any alpha information from a texture.
|
void |
removeEffect()
Removes an ITextureEffect from the Texture
|
void |
removePixels()
Removes the backing int-array from this texture.
|
void |
setAsShadowMap(boolean isShadowMap)
Marks this texture as a shadow map.
|
void |
setClamping(boolean clamping)
Set texture coordinate to clamping or wrapping/repeating.
|
void |
setDepthBuffer(DepthBuffer depthBuffer)
When used as a render target, jPCT-AE creates an internal depth buffer
for this texture so that rendering into it works as expected.
|
void |
setEffect(ITextureEffect effect)
Sets an effect for this texture.
|
void |
setEnabled(boolean isEnabled)
Sets the texture to enable/disabled.
|
void |
setExternalId(int glId,
int glTarget)
Sets an external id.
|
void |
setFiltering(boolean filter)
Sets the bilinear filtering state on textures.
|
void |
setMipmap(boolean mipmap)
Enabled/Disables mip map setting for a texture.
|
void |
setMipmapMode(int mode)
Experimental, doesn't do much ATM.
|
void |
setTextureCompression(boolean enabled)
Enables ETC1-texture compression if available on the platform.
|
public static final int DEFAULT_WIDTH
public static final int DEFAULT_HEIGHT
public Texture(java.io.InputStream is)
is
- the InputStream for the dataTextureManager
public Texture(java.io.InputStream is, boolean useAlpha)
is
- the InputStream containing the datauseAlpha
- use alpha information from texture?TextureManager
public Texture(java.io.InputStream is, boolean useAlpha, boolean closeStream)
is
- the InputStream containing the datauseAlpha
- use alpha information from texture?closeStream
- should the stream be closed (true) or left open (false)TextureManager
public Texture(Bitmap image)
image
- the BitmapTextureManager
public Texture(Bitmap image, boolean useAlpha)
image
- the BitmapuseAlpha
- use alpha information from texture?TextureManager
public Texture(Drawable image)
image
- the DrawableTextureManager
public Texture(Drawable image, boolean useAlpha)
image
- the DrawableuseAlpha
- use alpha information from texture?TextureManager
public Texture(int width, int height)
width
- the width of the texture. Has to be a power of 2.height
- the height of the texture. Has to be a power of 2.public Texture(int width, int height, int alpha)
width
- the width of the texture. Has to be a power of 2. If its not,
it will be adjusted accordingly.height
- the height of the texture. Has to be a power of 2. If its not,
it will be adjusted accordingly.alpha
- the alpha value (0..255)public Texture(int width, int height, RGBColor col)
width
- the width of the texture. Has to be a power of 2.height
- the height of the texture. Has to be a power of 2.col
- the color. Can be null for render targets.public void add(Texture ta, float weight)
ta
- the texture whose color should be addedweight
- the weight of the second texture's data. May be even negative.public void setEffect(ITextureEffect effect)
effect
- the effectITextureEffect
public void removeEffect()
public void applyEffect()
public void overrideTexelData(java.nio.ByteBuffer texels)
texels
- the buffer with the texel data in RGBA-format.public void setEnabled(boolean isEnabled)
isEnabled
- is it enabled?public boolean isEnabled()
public void enable4bpp(boolean doit)
doit
- should we?public static void defaultTo4bpp(boolean doit)
doit
- should 4bpp be the default?public static void defaultToKeepPixels(boolean doit)
doit
- public static void defaultToMipmapping(boolean doit)
doit
- should mipmapping be the default?public void setTextureCompression(boolean enabled)
enabled
- enable ETC1 texture compressionpublic void compress()
public int getArraySize()
public int getMemoryUsage()
public int getWidth()
public int getHeight()
public void enableClamping()
public void setClamping(boolean clamping)
public void setFiltering(boolean filter)
filter
- the mode, true for bilinear, false for pick nearestpublic void setMipmap(boolean mipmap)
mipmap
- true, if there's no override. false means no mip
mapping/trilinear for this texturepublic void setMipmapMode(int mode)
mode
- the mode, default is 0.public void removeAlpha()
public void removePixels()
public void keepPixelData(boolean keepData)
keepData
- should they?public void setAsShadowMap(boolean isShadowMap)
isShadowMap
- is it a shadow map or not?public void setDepthBuffer(DepthBuffer depthBuffer)
depthBuffer
- the depth bufferpublic DepthBuffer getDepthBuffer()
public void setExternalId(int glId, int glTarget)
glId
- the idglTarget
- the target, in most cases this will be GL10.GL_TEXTURE_2D.public int getExternalId()