|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.threed.jpct.Texture
public class Texture
A Texture in jPCT-AE is a bitmap with a width/height of 2^x and a color-depth
of 24 bpp with 8 bit alpha. You can enable 4bpp per texture, if you want to
convert it to a 16 bit texture instead. This might be faster on some
hardware.
If a texture with a different width/height is used, an error will be raised
Textures are managed by the TextureManager.
TextureManager
,
Serialized FormField Summary | |
---|---|
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 Summary | |
---|---|
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(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. |
Method Summary | |
---|---|
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()
|
int |
getHeight()
Returns the height of the texture in pixels. |
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 |
removeAlpha()
Removes any alpha information from a texture. |
void |
removeEffect()
Removes an ITextureEffect from the 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 |
setFiltering(boolean filter)
Sets the bilinear filtering state on textures. |
void |
setMipmap(boolean mipmap)
Enabled/Disables mip map setting for a texture. |
void |
setTextureCompression(boolean enabled)
Enables ETC1-texture compression if available on the platform. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int DEFAULT_WIDTH
public static final int DEFAULT_HEIGHT
Constructor Detail |
---|
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(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.Method Detail |
---|
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 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 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 removeAlpha()
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()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |