|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.cult3d.world.Texture
This class provides a Java representation of a texture that is mapped to some object in the scenegraph. By using the setTexture() methods, it is possible to dynamically update the texture an object of this class represents. Usually this is accomplished by painting on a TextureImage and then using the setTexture(Image) method to update the texture.
It is not possible to create new textures. Thus, if dynamic textures are needed, dummy textures must first be mapped to the objects in question in the 3D modelling tool of choice.
Field Summary | |
static byte |
AA_DEFAULT
Sets the object to a none antialiased state when changing textures. |
static byte |
AA_IGNORE
The object stays in its current mode when changing textures, as opposed to AA_DEFAULT. |
Constructor Summary | |
Texture(java.lang.String name)
Constructs a Java representation of an texture. |
|
Texture(java.lang.String name,
int timeout)
Constructs a Java representation of an texture. |
Method Summary | |
int |
getHeight()
Gets the height of the texture. |
java.lang.String |
getInfo()
Returns a string representation of the values of this object. |
java.lang.String |
getName()
Gets the name of the texture. |
int[] |
getTexture()
Gets an int array containig the RGB values of the texture. |
void |
getTexture(java.awt.Image surface)
Copies the texture to an Image. |
int |
getWidth()
Gets the width of the texture. |
void |
replaceColor(java.awt.Color oldColor,
java.awt.Color newColor)
Replaces a color in the texture with a new color. |
void |
replaceColor(java.awt.Color oldColor,
java.awt.Color newColor,
int tolerance)
Replaces a color in the texture with a new color. |
void |
replaceColor(RGB oldColor,
RGB newColor)
Replaces a color in the texture with a new color. |
void |
replaceColor(RGB oldColor,
RGB newColor,
int tolerance)
Replaces a color in the texture with a new color. |
void |
setTexture(java.awt.Image surface)
Sets the texture from an Image instance, it sets the antialasing to default when changing. |
void |
setTexture(java.awt.Image surface,
byte antialiasingMode)
Sets the texture from an Image instance. |
void |
setTexture(int[] data)
Sets the texture from an array of int-values. |
java.lang.String |
toString()
This method is intended to be used only for debugging purposes, and the content and format of the returned string may vary between implementations and versions of Cult3D. |
Methods inherited from class java.lang.Object |
equals,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Field Detail |
public static final byte AA_DEFAULT
public static final byte AA_IGNORE
Constructor Detail |
public Texture(java.lang.String name)
name
- the name of the texture.public Texture(java.lang.String name, int timeout)
name
- the name of the texture.timeout
- the timeout for retrieving the texture in ms with a granularity of 100 ms.Method Detail |
public java.lang.String getName()
public int getWidth()
public int getHeight()
public int[] getTexture()
public void getTexture(java.awt.Image surface)
surface
- the Image instance to copy the texture to. The image must be a instance of com.cult3d.TextureImageTextureImage
public void setTexture(int[] data)
data
- An array of int-values.public void setTexture(java.awt.Image surface)
surface
- the Image to be set.public void setTexture(java.awt.Image surface, byte antialiasingMode)
surface
- the Image to be set.antialiasingMode
- AntiAliasing beahvior. Set to AA_DEFAULT for default behavior, AA_IGNORE for Antialiasing not to care about this call.public void replaceColor(RGB oldColor, RGB newColor)
oldColor
- the color to replacenewColor
- the new colorpublic void replaceColor(java.awt.Color oldColor, java.awt.Color newColor)
oldColor
- the color to replacenewColor
- the new colorpublic void replaceColor(RGB oldColor, RGB newColor, int tolerance)
oldColor
- the color to replacenewColor
- the new colortolerance
- the tolerancepublic void replaceColor(java.awt.Color oldColor, java.awt.Color newColor, int tolerance)
oldColor
- the color to replacenewColor
- the new colortolerance
- the tolerancepublic java.lang.String getInfo()
Returns a string representation of the values of this object.
This method is intended to be used only for debugging purposes, and the content and format of the returned string may vary between implementations and versions of Cult3D.
public java.lang.String toString()
This method is intended to be used only for debugging purposes, and the content and format of the returned string may vary between implementations and versions of Cult3D.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |