com.cult3d.world
Class Texture

java.lang.Object
  |
  +--com.cult3d.world.Texture

public class Texture
extends java.lang.Object

This class provides a representation of a Cult3D texture. All objects in Cult3D have textures. This class provides a way to dynamicaly update a texture from Java.


Constructor Summary
Texture(java.lang.String name)
          Constructs a Java representation of a Cult3D texture.
 
Method Summary
 int getHeight()
          Gets the height of the texture.
 int[] getTexture()
          Gets the currently set texture.
 void getTexture(java.awt.Image surface)
          Copies the texture to an Image.
 int getWidth()
          Gets the width of the texture.
 void setTexture(java.awt.Image surface)
          Sets the texture from an Image instance.
 void setTexture(int[] data)
          Sets the texture from an array of int-values.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Texture

public Texture(java.lang.String name)
Constructs a Java representation of a Cult3D texture.
Parameters:
name - the name of the object.
Throws:
NameNotFoundException - for invalid name.
Method Detail

getWidth

public int getWidth()
Gets the width of the texture.
Returns:
the width.

getHeight

public int getHeight()
Gets the height of the texture.
Returns:
the height.

getTexture

public int[] getTexture()
Gets the currently set texture.
Returns:
an array of int-values containging RGB-values for the texture.

getTexture

public void getTexture(java.awt.Image surface)
Copies the texture to an Image. The Image must be created by a call to com.cult3d.Cult.createImage().
Parameters:
surface - the Image instance to copy the texture to.
See Also:
TextureImage

setTexture

public void setTexture(int[] data)
Sets the texture from an array of int-values.
Parameters:
data - An array of int-values.

setTexture

public void setTexture(java.awt.Image surface)
Sets the texture from an Image instance.
Parameters:
surface - the Image to be set.