javax.media.j3d
Class TextureAttributes

java.lang.Object
  |
  +--javax.media.j3d.SceneGraphObject
        |
        +--javax.media.j3d.NodeComponent
              |
              +--javax.media.j3d.TextureAttributes

public class TextureAttributes
extends NodeComponent

The TextureAttributes object defines attributes that apply to to texture mapping. The texture attributes include the following:

See Also:
Appearance

Field Summary
static int ALLOW_BLEND_COLOR_READ
          Specifies that this TextureAttributes object allows reading its texture blend color component information.
static int ALLOW_BLEND_COLOR_WRITE
          Specifies that this TextureAttributes object allows writing its texture blend color component information.
static int ALLOW_COLOR_TABLE_READ
          Specifies that this TextureAttributes object allows reading its texture color table component information.
static int ALLOW_COLOR_TABLE_WRITE
          Specifies that this TextureAttributes object allows writing its texture color table component information.
static int ALLOW_MODE_READ
          Specifies that this TextureAttributes object allows reading its texture mode component information and perspective correction mode.
static int ALLOW_MODE_WRITE
          Specifies that this TextureAttributes object allows writing its texture mode component information and perspective correction mode.
static int ALLOW_TRANSFORM_READ
          Specifies that this TextureAttributes object allows reading its texture transform component information.
static int ALLOW_TRANSFORM_WRITE
          Specifies that this TextureAttributes object allows writing its texture transform component information.
static int BLEND
          Blend the texture blend color with the object color.
static int DECAL
          Apply the texture color to the object as a decal.
static int FASTEST
          Use the fastest available method for perspective correction.
static int MODULATE
          Modulate the object color with the texture color.
static int NICEST
          Use the nicest (highest quality) available method for texture mapping perspective correction.
static int REPLACE
          Replace the object color with the texture color.
 
Constructor Summary
TextureAttributes()
          Constructs a TextureAttributes object with default parameters.
TextureAttributes(int textureMode, Transform3D transform, Color4f textureBlendColor, int perspCorrectionMode)
          Constructs a TextureAttributes object with the specified values.
 
Method Summary
 NodeComponent cloneNodeComponent()
          Deprecated. replaced with cloneNodeComponent(boolean forceDuplicate)
 int getNumTextureColorTableComponents()
          Retrieves the number of color components in the current texture color table.
 int getPerspectiveCorrectionMode()
          Gets perspective correction mode value.
 void getTextureBlendColor(Color4f textureBlendColor)
          Gets the texture blend color for this appearance component object.
 void getTextureColorTable(int[][] table)
          Retrieves the texture color table and copies it into the specified array.
 int getTextureColorTableSize()
          Retrieves the size of the current texture color table.
 int getTextureMode()
          Gets the texture mode parameter for this texture attributes object.
 void getTextureTransform(Transform3D transform)
          Retrieves a copy of the texture transform object.
 void setPerspectiveCorrectionMode(int mode)
          Sets perspective correction mode to be used for color and/or texture coordinate interpolation.
 void setTextureBlendColor(Color4f textureBlendColor)
          Sets the texture blend color for this texture attributes object.
 void setTextureBlendColor(float r, float g, float b, float a)
          Sets the texture blend color for this appearance component object.
 void setTextureColorTable(int[][] table)
          Sets the texture color table from the specified table.
 void setTextureMode(int textureMode)
          Sets the texture mode parameter for this appearance component object.
 void setTextureTransform(Transform3D transform)
          Sets the texture transform object used to transform texture coordinates.
 
Methods inherited from class javax.media.j3d.NodeComponent
cloneNodeComponent, duplicateNodeComponent, duplicateNodeComponent, getDuplicateOnCloneTree, setDuplicateOnCloneTree
 
Methods inherited from class javax.media.j3d.SceneGraphObject
clearCapability, duplicateSceneGraphObject, getCapability, getUserData, isCompiled, isLive, setCapability, setUserData, updateNodeReferences
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ALLOW_MODE_READ

public static final int ALLOW_MODE_READ
Specifies that this TextureAttributes object allows reading its texture mode component information and perspective correction mode.

ALLOW_MODE_WRITE

public static final int ALLOW_MODE_WRITE
Specifies that this TextureAttributes object allows writing its texture mode component information and perspective correction mode.

ALLOW_BLEND_COLOR_READ

public static final int ALLOW_BLEND_COLOR_READ
Specifies that this TextureAttributes object allows reading its texture blend color component information.

ALLOW_BLEND_COLOR_WRITE

public static final int ALLOW_BLEND_COLOR_WRITE
Specifies that this TextureAttributes object allows writing its texture blend color component information.

ALLOW_TRANSFORM_READ

public static final int ALLOW_TRANSFORM_READ
Specifies that this TextureAttributes object allows reading its texture transform component information.

ALLOW_TRANSFORM_WRITE

public static final int ALLOW_TRANSFORM_WRITE
Specifies that this TextureAttributes object allows writing its texture transform component information.

ALLOW_COLOR_TABLE_READ

public static final int ALLOW_COLOR_TABLE_READ
Specifies that this TextureAttributes object allows reading its texture color table component information.
Since:
Java 3D 1.2

ALLOW_COLOR_TABLE_WRITE

public static final int ALLOW_COLOR_TABLE_WRITE
Specifies that this TextureAttributes object allows writing its texture color table component information.
Since:
Java 3D 1.2

FASTEST

public static final int FASTEST
Use the fastest available method for perspective correction.

NICEST

public static final int NICEST
Use the nicest (highest quality) available method for texture mapping perspective correction.

MODULATE

public static final int MODULATE
Modulate the object color with the texture color.

DECAL

public static final int DECAL
Apply the texture color to the object as a decal.

BLEND

public static final int BLEND
Blend the texture blend color with the object color.

REPLACE

public static final int REPLACE
Replace the object color with the texture color.
Constructor Detail

TextureAttributes

public TextureAttributes()
Constructs a TextureAttributes object with default parameters. The default values are as follows:

TextureAttributes

public TextureAttributes(int textureMode,
                         Transform3D transform,
                         Color4f textureBlendColor,
                         int perspCorrectionMode)
Constructs a TextureAttributes object with the specified values.
Parameters:
textureMode - the texture mode; one of MODULATE, DECAL, BLEND, or REPLACE
transform - the transform object, used to transform texture coordinates
textureBlendColor - the texture blend color, used when the texture mode is BLEND
perspCorrectionMode - the perspective correction mode to be used for color and/or texture coordinate interpolation; one of NICEST or FASTEST
Throws:
java.lang.IllegalArgumentException - if textureMode is a value other than MODULATE, DECAL, BLEND, or REPLACE
java.lang.IllegalArgumentException - if mode value is other than FASTEST or NICEST.
Method Detail

setTextureMode

public void setTextureMode(int textureMode)
Sets the texture mode parameter for this appearance component object.
Parameters:
textureMode - the texture mode, one of: MODULATE, DECAL, BLEND, or REPLACE
Throws:
java.lang.IllegalArgumentException - if textureMode is a value other than MODULATE, DECAL, BLEND, or REPLACE

getTextureMode

public int getTextureMode()
Gets the texture mode parameter for this texture attributes object.
Returns:
textureMode the texture mode
Throws:
CapabilityNotSetException - if appropriate capability is not set and this object is part of live or compiled scene graph

setTextureBlendColor

public void setTextureBlendColor(Color4f textureBlendColor)
Sets the texture blend color for this texture attributes object.
Parameters:
textureBlendColor - the texture blend color used when the mode is BLEND
Throws:
CapabilityNotSetException - if appropriate capability is not set and this object is part of live or compiled scene graph

setTextureBlendColor

public void setTextureBlendColor(float r,
                                 float g,
                                 float b,
                                 float a)
Sets the texture blend color for this appearance component object. This color is used when the mode is BLEND.
Parameters:
r - the red component of the color
g - the green component of the color
b - the blue component of the color
a - the alpha component of the color
Throws:
CapabilityNotSetException - if appropriate capability is not set and this object is part of live or compiled scene graph

getTextureBlendColor

public void getTextureBlendColor(Color4f textureBlendColor)
Gets the texture blend color for this appearance component object.
Parameters:
textureBlendColor - the vector that will receive the texture blend color used when the mode is BLEND
Throws:
CapabilityNotSetException - if appropriate capability is not set and this object is part of live or compiled scene graph

setTextureTransform

public void setTextureTransform(Transform3D transform)
Sets the texture transform object used to transform texture coordinates. A copy of the specified Transform3D object is stored in this TextureAttributes object.
Parameters:
transform - the new transform object
Throws:
CapabilityNotSetException - if the method is called when this object is part of live or compiled scene graph.

getTextureTransform

public void getTextureTransform(Transform3D transform)
Retrieves a copy of the texture transform object.
Parameters:
transform - the transform object that will receive the current texture transform
Throws:
CapabilityNotSetException - if the method is called when this object is part of live or compiled scene graph.

setPerspectiveCorrectionMode

public void setPerspectiveCorrectionMode(int mode)
Sets perspective correction mode to be used for color and/or texture coordinate interpolation. A value of NICEST indicates that perspective correction should be performed and that the highest quality method should be used. A value of FASTEST indicates that the most efficient perspective correction method should be used.
Parameters:
mode - one of NICEST or FASTEST The default value is NICEST.
Throws:
CapabilityNotSetException - if appropriate capability is not set and this object is part of live or compiled scene graph
java.lang.IllegalArgumentException - if mode value is other than FASTEST or NICEST.

getPerspectiveCorrectionMode

public int getPerspectiveCorrectionMode()
Gets perspective correction mode value.
Returns:
mode the value of perspective correction mode
Throws:
CapabilityNotSetException - if appropriate capability is not set and this object is part of live or compiled scene graph

setTextureColorTable

public void setTextureColorTable(int[][] table)
Sets the texture color table from the specified table. The individual integer array elements are copied. The array is indexed first by color component (r, g, b, and a, respectively) and then by color value; table.length defines the number of color components and table[0].length defines the texture color table size. If the table is non-null, the number of color components must either be 3, for rgb data, or 4, for rgba data. The size of each array for each color component must be the same and must be a power of 2. If table is null or if the texture color table size is 0, the texture color table is disabled. If the texture color table size is greater than the device-dependent maximum texture color table size for a particular Canvas3D, the texture color table is ignored for that canvas.

When enabled, the texture color table is applied after the texture filtering operation and before texture application. Each of the r, g, b, and a components are clamped to the range [0,1], multiplied by textureColorTableSize-1, and rounded to the nearest integer. The resulting value for each component is then used as an index into the respective table for that component. If the texture color table contains 3 components, alpha is passed through unmodified.

Parameters:
table - the new texture color table
Throws:
java.lang.IllegalArgumentException - if table.length is not 3 or 4, or if the arrays for each component are not all the same length, or if the texture color table size is not a power of 2
CapabilityNotSetException - if appropriate capability is not set and this object is part of live or compiled scene graph
Since:
Java 3D 1.2
See Also:
Canvas3D.queryProperties()

getTextureColorTable

public void getTextureColorTable(int[][] table)
Retrieves the texture color table and copies it into the specified array. If the current texture color table is null, no values are copied.
Parameters:
table - the array that will receive a copy of the texture color table from this TextureAttributes object. The array must be allocated by the caller and must be large enough to hold the entire table (that is, int[numTextureColorTableComponents][textureColorTableSize]).
Throws:
CapabilityNotSetException - if appropriate capability is not set and this object is part of live or compiled scene graph
Since:
Java 3D 1.2

getNumTextureColorTableComponents

public int getNumTextureColorTableComponents()
Retrieves the number of color components in the current texture color table. A value of 0 is returned if the texture color table is null.
Returns:
the number of color components in the texture color table, or 0 if the table is null
Since:
Java 3D 1.2

getTextureColorTableSize

public int getTextureColorTableSize()
Retrieves the size of the current texture color table. A value of 0 is returned if the texture color table is null.
Returns:
the size of the texture color table, or 0 if the table is null
Since:
Java 3D 1.2

cloneNodeComponent

public NodeComponent cloneNodeComponent()
Deprecated. replaced with cloneNodeComponent(boolean forceDuplicate)

Overrides:
cloneNodeComponent in class NodeComponent