com.jme3.texture
Class Texture

java.lang.Object
  extended by com.jme3.texture.Texture
All Implemented Interfaces:
CloneableSmartAsset, Savable, java.lang.Cloneable
Direct Known Subclasses:
Texture2D, Texture3D, TextureArray, TextureCubeMap

public abstract class Texture
extends java.lang.Object
implements CloneableSmartAsset, Savable, java.lang.Cloneable

Texture defines a texture object to be used to display an image on a piece of geometry. The image to be displayed is defined by the Image class. All attributes required for texture mapping are contained within this class. This includes mipmapping if desired, magnificationFilter options, apply options and correction options. Default values are as follows: minificationFilter - NearestNeighborNoMipMaps, magnificationFilter - NearestNeighbor, wrap - EdgeClamp on S,T and R, apply - Modulate, environment - None.

See Also:
Image

Nested Class Summary
static class Texture.MagFilter
           
static class Texture.MinFilter
           
static class Texture.ShadowCompareMode
          If this texture is a depth texture (the format is Depth*) then this value may be used to compare the texture depth to the R texture coordinate.
static class Texture.Type
           
static class Texture.WrapAxis
           
static class Texture.WrapMode
           
 
Constructor Summary
Texture()
          Constructor instantiates a new Texture object with default attributes.
 
Method Summary
 Texture clone()
          Creates a clone of the asset.
abstract  Texture createSimpleClone()
          Deprecated. Use clone() instead.
 Texture createSimpleClone(Texture rVal)
          Deprecated. Use clone() instead.
 boolean equals(java.lang.Object obj)
           
 int getAnisotropicFilter()
           
 Image getImage()
          getImage returns the image data that makes up this texture.
 AssetKey getKey()
          Returns the asset key that is used to track this asset for garbage collection.
 Texture.MagFilter getMagFilter()
           
 Texture.MinFilter getMinFilter()
           
 java.lang.String getName()
           
 Texture.ShadowCompareMode getShadowCompareMode()
           
abstract  Texture.Type getType()
           
abstract  Texture.WrapMode getWrap(Texture.WrapAxis axis)
          getWrap returns the wrap mode for a given coordinate axis on this texture.
 int hashCode()
           
 void read(JmeImporter e)
           
 void setAnisotropicFilter(int level)
           
 void setImage(Image image)
          setImage sets the image object that defines the texture.
 void setKey(AssetKey key)
          Set by the AssetManager to track this asset.
 void setMagFilter(Texture.MagFilter magnificationFilter)
           
 void setMinFilter(Texture.MinFilter minificationFilter)
           
 void setName(java.lang.String name)
           
 void setShadowCompareMode(Texture.ShadowCompareMode compareMode)
           
abstract  void setWrap(Texture.WrapAxis axis, Texture.WrapMode mode)
          setWrap sets the wrap mode of this texture for a particular axis.
abstract  void setWrap(Texture.WrapMode mode)
          setWrap sets the wrap mode of this texture for all axis.
 java.lang.String toString()
           
 void write(JmeExporter e)
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Texture

public Texture()
Constructor instantiates a new Texture object with default attributes.

Method Detail

clone

public Texture clone()
Description copied from interface: CloneableSmartAsset
Creates a clone of the asset. Please see Object.clone() for more info on how this method should be implemented.

Specified by:
clone in interface CloneableSmartAsset
Overrides:
clone in class java.lang.Object
Returns:
A cloned Texture object.

getMinFilter

public Texture.MinFilter getMinFilter()
Returns:
the MinificationFilterMode of this texture.

setMinFilter

public void setMinFilter(Texture.MinFilter minificationFilter)
Parameters:
minificationFilter - the new MinificationFilterMode for this texture.
Throws:
java.lang.IllegalArgumentException - if minificationFilter is null

getMagFilter

public Texture.MagFilter getMagFilter()
Returns:
the MagnificationFilterMode of this texture.

setMagFilter

public void setMagFilter(Texture.MagFilter magnificationFilter)
Parameters:
magnificationFilter - the new MagnificationFilter for this texture.
Throws:
java.lang.IllegalArgumentException - if magnificationFilter is null

getShadowCompareMode

public Texture.ShadowCompareMode getShadowCompareMode()
Returns:
The ShadowCompareMode of this texture.
See Also:
Texture.ShadowCompareMode

setShadowCompareMode

public void setShadowCompareMode(Texture.ShadowCompareMode compareMode)
Parameters:
compareMode - the new ShadowCompareMode for this texture.
Throws:
java.lang.IllegalArgumentException - if compareMode is null
See Also:
Texture.ShadowCompareMode

setImage

public void setImage(Image image)
setImage sets the image object that defines the texture.

Parameters:
image - the image that defines the texture.

setKey

public void setKey(AssetKey key)
Description copied from interface: CloneableSmartAsset
Set by the AssetManager to track this asset. Only clones of the asset has this set, the original copy that was loaded has this key set to null so that only the clones are tracked for garbage collection.

Specified by:
setKey in interface CloneableSmartAsset
Parameters:
key - The texture key that was used to load this texture

getKey

public AssetKey getKey()
Description copied from interface: CloneableSmartAsset
Returns the asset key that is used to track this asset for garbage collection.

Specified by:
getKey in interface CloneableSmartAsset
Returns:
the asset key that is used to track this asset for garbage collection.

getImage

public Image getImage()
getImage returns the image data that makes up this texture. If no image data has been set, this will return null.

Returns:
the image data that makes up the texture.

setWrap

public abstract void setWrap(Texture.WrapAxis axis,
                             Texture.WrapMode mode)
setWrap sets the wrap mode of this texture for a particular axis.

Parameters:
axis - the texture axis to define a wrapmode on.
mode - the wrap mode for the given axis of the texture.
Throws:
java.lang.IllegalArgumentException - if axis or mode are null or invalid for this type of texture

setWrap

public abstract void setWrap(Texture.WrapMode mode)
setWrap sets the wrap mode of this texture for all axis.

Parameters:
mode - the wrap mode for the given axis of the texture.
Throws:
java.lang.IllegalArgumentException - if mode is null or invalid for this type of texture

getWrap

public abstract Texture.WrapMode getWrap(Texture.WrapAxis axis)
getWrap returns the wrap mode for a given coordinate axis on this texture.

Parameters:
axis - the axis to return for
Returns:
the wrap mode of the texture.
Throws:
java.lang.IllegalArgumentException - if axis is null or invalid for this type of texture

getType

public abstract Texture.Type getType()

getName

public java.lang.String getName()

setName

public void setName(java.lang.String name)

getAnisotropicFilter

public int getAnisotropicFilter()
Returns:
the anisotropic filtering level for this texture. Default value is 1 (no anisotrophy), 2 means x2, 4 is x4, etc.

setAnisotropicFilter

public void setAnisotropicFilter(int level)
Parameters:
level - the anisotropic filtering level for this texture.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

createSimpleClone

@Deprecated
public Texture createSimpleClone(Texture rVal)
Deprecated. Use clone() instead.

Retrieve a basic clone of this Texture (ie, clone everything but the image data, which is shared)

Returns:
Texture

createSimpleClone

@Deprecated
public abstract Texture createSimpleClone()
Deprecated. Use clone() instead.


write

public void write(JmeExporter e)
           throws java.io.IOException
Specified by:
write in interface Savable
Throws:
java.io.IOException

read

public void read(JmeImporter e)
          throws java.io.IOException
Specified by:
read in interface Savable
Throws:
java.io.IOException