Aviatrix3D
2.1.0

org.j3d.aviatrix3d
Class TexCoordGeneration

java.lang.Object
  extended by org.j3d.aviatrix3d.SceneGraphObject
      extended by org.j3d.aviatrix3d.NodeComponent
          extended by org.j3d.aviatrix3d.TexCoordGeneration
All Implemented Interfaces:
java.lang.Comparable, ObjectRenderable, Renderable

public class TexCoordGeneration
extends NodeComponent
implements ObjectRenderable

Describes a texture's automatic texture coordinate generation properties per axis.

This class allows texture coordinates to be specified for each axis of an object separately. Only one instance of this class is needed per object as all axes can be specified.

Texture modes here directly correspond to the OpenGL constants of the same type. Either are acceptable as parameters. All parameters can be set using the setParameter(int,int,int,float[]) method. This takes 4 parameters, some of which are likely not to be used.

Internationalisation Resource Names

Version:
$Revision: 1.29 $
Author:
Justin Couch

Field Summary
static int MAP_EYE_LINEAR
          When the mode is set to MODE_GENERIC, generate coordinates for the given coordinate relative to a plane specified in the user's eye position coordinate system.
static int MAP_NORMALS
          When the mode is set to MODE_GENERIC, generate coordinates using the normals at the vertex.
static int MAP_OBJECT_LINEAR
          When the mode is set to MODE_GENERIC, generate coordinates for the given coordinate relative to a plane specified in the object's coordinate system.
static int MAP_REFLECTIONS
          When the mode is set to MODE_GENERIC, generate coordinates using the normals at the vertex.
static int MAP_SPHERICAL
          When the mode is set to MODE_GENERIC, generate coordinates for the given axis in a spherical shape for env mapping.
static int MODE_EYE_PLANE
          Generate coordinates for a reference plane that is relative to the user's eye position for the given axis.
static int MODE_GENERIC
          Coordinate reference plane is user defined.
static int MODE_OBJECT_PLANE
          Generate coordinates for a reference plane that is relative to the object for the given axis.
static int TEXTURE_Q
          Generate coordinates for a texture's Q coordinate
static int TEXTURE_R
          Generate coordinates for a texture's R coordinate
static int TEXTURE_S
          Generate coordinates for a texture's S coordinate
static int TEXTURE_T
          Generate coordinates for a texture's T coordinate
 
Fields inherited from class org.j3d.aviatrix3d.NodeComponent
lastParent, liveCount, parentList
 
Fields inherited from class org.j3d.aviatrix3d.SceneGraphObject
alive, LISTENER_SET_TIMING_ERR_PROP, updateHandler
 
Constructor Summary
TexCoordGeneration()
          Constructs a TexCoordGeneration with default values, which is to say, do nothing.
TexCoordGeneration(int axis, int mode, int parameter, float[] value)
          Create automatic coordinate generation for one axis with the given set of abilities.
 
Method Summary
 void applyTransform(float[] transformMtx)
          Apply transformation to the texture generation
 void clearParameter(int axis)
          Clear the parameter settings for a specific axis.
 int compareTo(java.lang.Object o)
          Compares this object with the specified object for order.
 int compareTo(TexCoordGeneration tcg)
          Compares this object with the specified object for order.
 boolean equals(java.lang.Object o)
          Compare this object for equality to the given object.
 boolean equals(TexCoordGeneration tcg)
          Compares this object with the specified object to check for equivalence.
 int getMode(int axis)
          Fetch the currently set mode value for the requested axis.
 void postRender(javax.media.opengl.GL gl)
          Restore all openGL state to the given drawable
 void render(javax.media.opengl.GL gl)
          Issue ogl commands needed for this component
 void setParameter(int axis, int mode, int parameter, float[] value)
          Setup one of the axis parameters.
 void setParameter(int axis, int mode, int parameter, int texgeparam, float[] value)
          Setup one of the axis parameters
 
Methods inherited from class org.j3d.aviatrix3d.NodeComponent
addParent, getParents, numParents, removeParent
 
Methods inherited from class org.j3d.aviatrix3d.SceneGraphObject
checkForCyclicChild, checkForCyclicParent, dataChanged, getAppUpdateWriteTimingMessage, getBoundsWriteTimingMessage, getDataWriteTimingMessage, getUserData, isLive, setLive, setUpdateHandler, setUserData
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TEXTURE_S

public static final int TEXTURE_S
Generate coordinates for a texture's S coordinate

See Also:
Constant Field Values

TEXTURE_T

public static final int TEXTURE_T
Generate coordinates for a texture's T coordinate

See Also:
Constant Field Values

TEXTURE_R

public static final int TEXTURE_R
Generate coordinates for a texture's R coordinate

See Also:
Constant Field Values

TEXTURE_Q

public static final int TEXTURE_Q
Generate coordinates for a texture's Q coordinate

See Also:
Constant Field Values

MODE_GENERIC

public static final int MODE_GENERIC
Coordinate reference plane is user defined. Additional information in the form of extra parameters (The MAP_* values) will need to be provided.

See Also:
Constant Field Values

MODE_OBJECT_PLANE

public static final int MODE_OBJECT_PLANE
Generate coordinates for a reference plane that is relative to the object for the given axis. No value needs to be specified for the param or value arguments.

See Also:
Constant Field Values

MODE_EYE_PLANE

public static final int MODE_EYE_PLANE
Generate coordinates for a reference plane that is relative to the user's eye position for the given axis. No value needs to be specified for the param or value arguments.

See Also:
Constant Field Values

MAP_OBJECT_LINEAR

public static final int MAP_OBJECT_LINEAR
When the mode is set to MODE_GENERIC, generate coordinates for the given coordinate relative to a plane specified in the object's coordinate system.

See Also:
Constant Field Values

MAP_EYE_LINEAR

public static final int MAP_EYE_LINEAR
When the mode is set to MODE_GENERIC, generate coordinates for the given coordinate relative to a plane specified in the user's eye position coordinate system.

See Also:
Constant Field Values

MAP_SPHERICAL

public static final int MAP_SPHERICAL
When the mode is set to MODE_GENERIC, generate coordinates for the given axis in a spherical shape for env mapping.

See Also:
Constant Field Values

MAP_NORMALS

public static final int MAP_NORMALS
When the mode is set to MODE_GENERIC, generate coordinates using the normals at the vertex. Used mostly in cubic environment mapping.

See Also:
Constant Field Values

MAP_REFLECTIONS

public static final int MAP_REFLECTIONS
When the mode is set to MODE_GENERIC, generate coordinates using the normals at the vertex. Used mostly in cubic environment mapping.

See Also:
Constant Field Values
Constructor Detail

TexCoordGeneration

public TexCoordGeneration()
Constructs a TexCoordGeneration with default values, which is to say, do nothing.


TexCoordGeneration

public TexCoordGeneration(int axis,
                          int mode,
                          int parameter,
                          float[] value)
Create automatic coordinate generation for one axis with the given set of abilities.

Throws:
java.lang.IllegalArgumentException - Invalid axis, mode or parameter
Method Detail

render

public void render(javax.media.opengl.GL gl)
Issue ogl commands needed for this component

Specified by:
render in interface ObjectRenderable
Parameters:
gl - The gl context to draw with

postRender

public void postRender(javax.media.opengl.GL gl)
Restore all openGL state to the given drawable

Specified by:
postRender in interface ObjectRenderable
Parameters:
gl - The gl context to draw with

compareTo

public int compareTo(java.lang.Object o)
              throws java.lang.ClassCastException
Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
o - The object to be compared
Returns:
-1, 0 or 1 depending on order
Throws:
java.lang.ClassCastException - The specified object's type prevents it from being compared to this Object

equals

public boolean equals(java.lang.Object o)
Compare this object for equality to the given object.

Specified by:
equals in interface Renderable
Overrides:
equals in class java.lang.Object
Parameters:
o - The object to be compared
Returns:
True if these represent the same values

applyTransform

public void applyTransform(float[] transformMtx)
                    throws InvalidWriteTimingException
Apply transformation to the texture generation

Parameters:
transformMtx - 4 by 4 matrix that transforms
Throws:
InvalidWriteTimingException - An attempt was made to write outside of the NodeUpdateListener data changed callback method

getMode

public int getMode(int axis)
Fetch the currently set mode value for the requested axis.

Parameters:
axis - One of the TEXTURE_x values
Returns:
The current mode value (one of MODE_x)

clearParameter

public void clearParameter(int axis)
                    throws InvalidWriteTimingException
Clear the parameter settings for a specific axis. This will disable coordinate generation on this axis.

Parameters:
axis - One of the TEXTURE_x values
Throws:
InvalidWriteTimingException - An attempt was made to write outside of the NodeUpdateListener data changed callback method

setParameter

public void setParameter(int axis,
                         int mode,
                         int parameter,
                         int texgeparam,
                         float[] value)
                  throws InvalidWriteTimingException
Setup one of the axis parameters

Parameters:
axis - One of the TEXTURE_x values
mode - One of the MODE_x values
parameter - One of the MAP_x values when the mode is set to MODE_GENERIC, otherwise ignored
texgeparam - The symbolic name of the texture coordinate generation function. One of MODE_GENERIC, MODE_OBJECT_PLANE, or MODE_EYE_PLANE.
value - Optional values, dependent on the parameter type
Throws:
java.lang.IllegalArgumentException - The either the mode or parameter is invalid
InvalidWriteTimingException - An attempt was made to write outside of the NodeUpdateListener data changed callback method

setParameter

public void setParameter(int axis,
                         int mode,
                         int parameter,
                         float[] value)
                  throws InvalidWriteTimingException
Setup one of the axis parameters.

Parameters:
axis - One of the TEXTURE_x values
mode - One of the MODE_x values
parameter - One of the MAP_x values when the mode is set to MODE_GENERIC, otherwise ignored
value - Optional values, dependent on the parameter type
Throws:
java.lang.IllegalArgumentException - The either the mode or parameter is invalid
InvalidWriteTimingException - An attempt was made to write outside of the NodeUpdateListener data changed callback method

compareTo

public int compareTo(TexCoordGeneration tcg)
Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

Parameters:
tcg - The generator instance to be compared
Returns:
-1, 0 or 1 depending on order

equals

public boolean equals(TexCoordGeneration tcg)
Compares this object with the specified object to check for equivalence.

Parameters:
tcg - The texture unit instance to be compared
Returns:
true if the objects represent identical values

Aviatrix3D
2.1.0

Latest Info from http://aviatrix3d.j3d.org/
Copyright © 2003 - 2009 j3d.org