|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.threed.jpct.Texture
A Texture in jPCT is a bitmap with a width/height of 2^x and a color-depth of
24 bpp. If a texture with a different width/height is used, it will be scaled
to a width/height of 256 automatically, but a warning will be printed out
because this shouldn't be the normal way to scale the textures... Textures
are used to give objects a realistic looking surface as well as for some
special effects. Textures are managed by the TextureManager class.
When using OpenGL support, the textures will be converted into an
OpenGL-compatible format at runtime, so accessing a texture for the first
time may result in little 'hickup' while the texture gets converted, but
usually this shouldn't be noticeable.
TextureManager
,
Serialized FormField Summary | |
static int |
DEFAULT_BPP
The default color-depth of 24 bpp. |
static int |
DEFAULT_HEIGHT
The default height of a texture (256 pixels). |
static int |
DEFAULT_WIDTH
The default width of a texture (256 pixels). |
Constructor Summary | |
Texture(java.awt.Image image)
Creates a texture using a java.awt.Image. jPCT supports every format that JAVA supports for creating images from files as long as the result is a 24bpp image. |
|
Texture(java.awt.Image image,
boolean useAlpha)
Creates a texture using a java.awt.Imagem. 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,
java.awt.Color col)
Creates a colored 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(java.lang.String filename)
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.lang.String filename,
boolean useAlpha)
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.net.URL docBase,
java.lang.String filename)
Creates a texture using an image from an URL (intended to be used in applets). jPCT supports every format that JAVA supports for creating images from files as long as the result is a 24bpp image. |
|
Texture(java.net.URL docBase,
java.lang.String filename,
boolean useAlpha)
Creates a texture using an image from an URL (intended to be used in applets). jPCT supports every format that JAVA supports for creating images from files as long as the result is a 24bpp image. |
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 |
enableGLClamping()
Deprecated. |
int |
getArraySize()
Returns the size of the texture array. jPCT stores a little more for every texture than the actual texture data would need. |
int |
getByteSize()
Deprecated. |
int |
getExternalId()
Returns the external id if one has been set or -1 otherwise. |
int |
getHeight()
Returns the height of the texture in pixels. |
long |
getLastFrame()
Returns the number of the last frame the texture was used in. |
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. |
boolean |
isShadowMap()
Returns if this texture is used as a shadow map 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 |
setAlpha(int al)
Sets an alpha value for the whole 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 |
setEffect(ITextureEffect effect)
Sets an effect for this texture. |
void |
setEnabled(boolean isEnabled)
Sets the texture to enable/disabled. |
void |
setExternalId(int glId,
int dontCare)
Sets an external id. |
void |
setGLFiltering(boolean filter)
Sets the bilinear filtering state on textures when using a GL renderer. |
void |
setGLMipmap(boolean mipmap)
Deprecated. |
void |
setMipmap(boolean mipmap)
Overrides a global mip map setting in Config for this particular texture. |
void |
setMipmapMode(int mode)
Exists solely for compatibility with jPCT-AE. |
void |
setProjector(Projector proj,
boolean reload)
Sets a projector, i.e. this texture will be treated as if it would be projected onto the scene from the projector's position (and into its direction). |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int DEFAULT_BPP
public static final int DEFAULT_WIDTH
public static final int DEFAULT_HEIGHT
Constructor Detail |
public Texture(java.lang.String filename)
filename
- the name of the textureTextureManager
public Texture(java.lang.String filename, boolean useAlpha)
filename
- the name of the textureuseAlpha
- use alpha information from texture?TextureManager
public Texture(java.net.URL docBase, java.lang.String filename)
docBase
- the document basefilename
- the name of the textureTextureManager
public Texture(java.net.URL docBase, java.lang.String filename, boolean useAlpha)
docBase
- the document basefilename
- the name of the textureuseAlpha
- use alpha information from texture?TextureManager
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(java.awt.Image image)
image
- an ImageTextureManager
public Texture(java.awt.Image image, boolean useAlpha)
image
- an ImageuseAlpha
- 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. 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.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, java.awt.Color col)
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.col
- the color. If color is null, no int[]-array for texture data
will be created in main memory.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 setProjector(Projector proj, boolean reload)
proj
- the projector from which the texture is projected onto the
scene. Set it to null to stop projection.reload
- if true, the texture will be uploaded again. This can be
necessary if the texture has already been uploaded to the
graphics card before the projector has been set. Remember that
uploading textures is costly. Don't do this every frame.public void setAsShadowMap(boolean isShadowMap)
isShadowMap
- is it a shadow map or not?ShadowHelper
public boolean isShadowMap()
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 int getByteSize()
public int getArraySize()
public int getMemoryUsage()
public int getWidth()
public int getHeight()
public long getLastFrame()
World.getFrameCounter()
public void enableGLClamping()
public void setClamping(boolean clamping)
public void setGLFiltering(boolean filter)
filter
- the mode, true for bilinear, false for pick nearestpublic void setGLMipmap(boolean mipmap)
mipmap
- true, if there's no override. false means no mip
mapping/trilinear for this texturesetMipmap(boolean)
public 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
- some int, which doesn't matterpublic void removeAlpha()
public void removePixels()
public void setAlpha(int al)
al
- the alpha valuepublic void keepPixelData(boolean keepData)
keepData
- should they?public void setExternalId(int glId, int dontCare)
glId
- the iddontCare
- has no meaning in desktop jPCT. It's here to make the method
signature equal to that of jPCT-AEpublic int getExternalId()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |