| java.lang.Object javax.media.j3d.SceneGraphObject javax.media.j3d.NodeComponent javax.media.j3d.TexCoordGeneration
TexCoordGeneration | public class TexCoordGeneration extends NodeComponent (Code) | | The TexCoordGeneration object contains all parameters needed for
automatic texture coordinate generation. It is included as part
of an Appearance component object.
Texture coordinates determine which texel in the texture map is
assigned to a given vertex. Texture coordinates are interpolated
between vertices, similarly to how colors are interpolated between
two vertices of lines and polygons.
Texture coordinates consist of two, three or four coordinates.
These coordinates
are referred to as the S, T, R, and Q
coordinates.
2D textures use the S and T coordinates. 3D textures
use the S, T and R coordinates. The Q
coordinate, similar to the w coordinate of the (x, y, z, w)
object coordinates, is used to create homogeneous coordinates.
Rather than the programmer having to explicitly assign texture
coordinates, Java 3D can automatically generate the texture
coordinates to achieve texture mapping onto contours.
The TexCoordGeneration attributes specify the functions for automatically
generating texture coordinates. The texture attributes that can be
defined are:
- Texture format - defines whether the generated texture
coordinates are 2D, 3D, or 4D:
- TEXTURE_COORDINATE_2 - generates 2D texture coordinates
(S and T).
- TEXTURE_COORDINATE_3 - generates 3D texture coordinates
(S, T, and R).
- TEXTURE_COORDINATE_4 - generates 4D texture coordinates
(S, T, R, and Q).
- Texture generation mode - defines how the texture coordinates
are generated:
- OBJECT_LINEAR - texture coordinates are generated as a linear
function in object coordinates. The function used is:
g = p1xo + p2yo + p3zo + p4wo
where
g is the value computed for the coordinate.
p1 , p2 ,
p3 , and p4
are the plane equation coefficients (described below).
xo, yo, zo, and wo are
the object coordinates of the vertex.
- EYE_LINEAR - texture coordinates are generated as a linear
function in eye coordinates. The function used is:
g = p1'xe + p2'ye + p3'ze + p4'we
where
xe , ye ,
ze , and we are the eye
coordinates of the vertex.
p1' , p2' ,
p3' , and p4'
are the plane equation coefficients transformed into eye
coordinates.
- SPHERE_MAP - texture coordinates are generated using
spherical reflection mapping in eye coordinates. Used to simulate
the reflected image of a spherical environment onto a polygon.
- NORMAL_MAP - texture coordinates are generated to match
vertices' normals in eye coordinates. This is only available if
TextureCubeMap is available.
- REFLECTION_MAP - texture coordinates are generated to match
vertices' reflection vectors in eye coordinates. This is only available
if TextureCubeMap is available.
- Plane equation coefficients - defines the coefficients for the
plane equations used to generate the coordinates in the
OBJECT_LINEAR and EYE_LINEAR texture generation modes.
The coefficients define a reference plane in either object coordinates
or in eye coordinates, depending on the texture generation mode.
The equation coefficients are set by the setPlaneS ,
setPlaneT , setPlaneR , and setPlaneQ
methods for each of the S, T, R, and Q coordinate functions, respectively.
By default the equation coefficients are set as follows:
plane S = (1.0, 0.0, 0.0, 0.0)
plane T = (0.0, 1.0, 0.0, 0.0)
plane R = (0.0, 0.0, 0.0, 0.0)
plane Q = (0.0, 0.0, 0.0, 0.0)
Texture coordinate generation is enabled or disabled by the
setEnable method. When enabled, the specified
texture coordinate is computed according to the generating function
associated with the coordinate. When disabled, subsequent vertices
take the specified texture coordinate from the current set of
texture coordinates.
See Also: Canvas3D.queryProperties |
Field Summary | |
final public static int | ALLOW_ENABLE_READ Specifies that this TexCoordGeneration object allows reading its
enable flag. | final public static int | ALLOW_ENABLE_WRITE Specifies that this TexCoordGeneration object allows writing its
enable flag. | final public static int | ALLOW_FORMAT_READ Specifies that this TexCoordGeneration object allows reading its
format information. | final public static int | ALLOW_MODE_READ Specifies that this TexCoordGeneration object allows reading its
mode information. | final public static int | ALLOW_PLANE_READ Specifies that this TexCoordGeneration object allows reading its
planeS, planeR, and planeT component information. | final public static int | ALLOW_PLANE_WRITE Specifies that this TexCoordGeneration object allows writing its
planeS, planeR, and planeT component information. | final public static int | EYE_LINEAR Generates texture coordinates as a linear function in
eye coordinates. | final public static int | NORMAL_MAP Generates texture coordinates that match vertices' normals in
eye coordinates. | final public static int | OBJECT_LINEAR Generates texture coordinates as a linear function in
object coordinates. | final public static int | REFLECTION_MAP Generates texture coordinates that match vertices' reflection
vectors in eye coordinates. | final public static int | SPHERE_MAP Generates texture coordinates using a spherical reflection
mapping in eye coordinates. | final public static int | TEXTURE_COORDINATE_2 Generates 2D texture coordinates (S and T). | final public static int | TEXTURE_COORDINATE_3 Generates 3D texture coordinates (S, T, and R). | final public static int | TEXTURE_COORDINATE_4 Generates 4D texture coordinates (S, T, R, and Q). |
Constructor Summary | |
public | TexCoordGeneration() Constructs a TexCoordGeneration object with default parameters. | public | TexCoordGeneration(int genMode, int format) Constructs a TexCoordGeneration object with the specified genMode and
format. | public | TexCoordGeneration(int genMode, int format, Vector4f planeS) Constructs a TexCoordGeneration object with the specified genMode,
format, and the S coordinate plane equation. | public | TexCoordGeneration(int genMode, int format, Vector4f planeS, Vector4f planeT) Constructs a TexCoordGeneration object with the specified genMode,
format, and the S and T coordinate plane equations. | public | TexCoordGeneration(int genMode, int format, Vector4f planeS, Vector4f planeT, Vector4f planeR) Constructs a TexCoordGeneration object with the specified genMode,
format, and the S, T, and R coordinate plane equations. | public | TexCoordGeneration(int genMode, int format, Vector4f planeS, Vector4f planeT, Vector4f planeR, Vector4f planeQ) Constructs a TexCoordGeneration object with the specified genMode,
format, and the S, T, R, and Q coordinate plane equations. |
Method Summary | |
public NodeComponent | cloneNodeComponent() | void | createRetained() Creates a retained mode TexCoordGenerationRetained object that this
TexCoordGeneration component object will point to. | void | duplicateAttributes(NodeComponent originalNodeComponent, boolean forceDuplicate) Copies all node information from originalNodeComponent into
the current node. | public boolean | getEnable() Retrieves the state of the texCoordGeneration enable flag. | public int | getFormat() Retrieves the current TexCoordGeneration format. | public int | getGenMode() Retrieves the current TexCoordGeneration generation mode. | public void | getPlaneQ(Vector4f planeQ) Retrieves a copy of the plane equation used to
generate the Q coordinate. | public void | getPlaneR(Vector4f planeR) Retrieves a copy of the plane equation used to
generate the R coordinate. | public void | getPlaneS(Vector4f planeS) Retrieves a copy of the plane equation used to
generate the S coordinate. | public void | getPlaneT(Vector4f planeT) Retrieves a copy of the plane equation used to
generate the T coordinate. | public void | setEnable(boolean state) Enables or disables texture coordinate generation for this
appearance component object. | public void | setFormat(int format) Sets the TexCoordGeneration format to the specified value. | public void | setGenMode(int genMode) Sets the TexCoordGeneration generation mode to the specified value. | public void | setPlaneQ(Vector4f planeQ) Sets the Q coordinate plane equation. | public void | setPlaneR(Vector4f planeR) Sets the R coordinate plane equation. | public void | setPlaneS(Vector4f planeS) Sets the S coordinate plane equation. | public void | setPlaneT(Vector4f planeT) Sets the T coordinate plane equation. |
ALLOW_ENABLE_READ | final public static int ALLOW_ENABLE_READ(Code) | | Specifies that this TexCoordGeneration object allows reading its
enable flag.
|
ALLOW_ENABLE_WRITE | final public static int ALLOW_ENABLE_WRITE(Code) | | Specifies that this TexCoordGeneration object allows writing its
enable flag.
|
ALLOW_FORMAT_READ | final public static int ALLOW_FORMAT_READ(Code) | | Specifies that this TexCoordGeneration object allows reading its
format information.
|
ALLOW_MODE_READ | final public static int ALLOW_MODE_READ(Code) | | Specifies that this TexCoordGeneration object allows reading its
mode information.
|
ALLOW_PLANE_READ | final public static int ALLOW_PLANE_READ(Code) | | Specifies that this TexCoordGeneration object allows reading its
planeS, planeR, and planeT component information.
|
ALLOW_PLANE_WRITE | final public static int ALLOW_PLANE_WRITE(Code) | | Specifies that this TexCoordGeneration object allows writing its
planeS, planeR, and planeT component information.
since: Java 3D 1.3 |
SPHERE_MAP | final public static int SPHERE_MAP(Code) | | Generates texture coordinates using a spherical reflection
mapping in eye coordinates.
See Also: TexCoordGeneration.setGenMode |
TEXTURE_COORDINATE_4 | final public static int TEXTURE_COORDINATE_4(Code) | | Generates 4D texture coordinates (S, T, R, and Q).
See Also: TexCoordGeneration.setFormat since: Java 3D 1.3 |
TexCoordGeneration | public TexCoordGeneration()(Code) | | Constructs a TexCoordGeneration object with default parameters.
The default values are as follows:
enable flag : true
texture generation mode : OBJECT_LINEAR
format : TEXTURE_COORDINATE_2
plane S : (1,0,0,0)
plane T : (0,1,0,0)
plane R : (0,0,0,0)
plane Q : (0,0,0,0)
|
TexCoordGeneration | public TexCoordGeneration(int genMode, int format)(Code) | | Constructs a TexCoordGeneration object with the specified genMode and
format.
Defaults will be used for the rest of the state variables.
Parameters: genMode - texture generation mode, one of: OBJECT_LINEAR,EYE_LINEAR, SPHERE_MAP, NORMAL_MAP, or REFLECTION_MAP Parameters: format - texture format, one of: TEXTURE_COORDINATE_2,TEXTURE_COORDINATE_3, or TEXTURE_COORDINATE_4 See Also: Canvas3D.queryProperties |
TexCoordGeneration | public TexCoordGeneration(int genMode, int format, Vector4f planeS)(Code) | | Constructs a TexCoordGeneration object with the specified genMode,
format, and the S coordinate plane equation.
Defaults will be used for the rest of the state variables.
Parameters: genMode - texture generation mode, one of: OBJECT_LINEAR,EYE_LINEAR, SPHERE_MAP, NORMAL_MAP, or REFLECTION_MAP Parameters: format - texture format, one of: TEXTURE_COORDINATE_2,TEXTURE_COORDINATE_3 or TEXTURE_COORDINATE_4 Parameters: planeS - plane equation for the S coordinate See Also: Canvas3D.queryProperties |
TexCoordGeneration | public TexCoordGeneration(int genMode, int format, Vector4f planeS, Vector4f planeT)(Code) | | Constructs a TexCoordGeneration object with the specified genMode,
format, and the S and T coordinate plane equations.
Defaults will be used for the rest of the state variables.
Parameters: genMode - texture generation mode, one of: OBJECT_LINEAR,EYE_LINEAR, SPHERE_MAP, NORMAL_MAP, or REFLECTION_MAP Parameters: format - texture format, one of: TEXTURE_COORDINATE_2,TEXTURE_COORDINATE_3 or TEXTURE_COORDINATE_4 Parameters: planeS - plane equation for the S coordinate Parameters: planeT - plane equation for the T coordinate See Also: Canvas3D.queryProperties |
TexCoordGeneration | public TexCoordGeneration(int genMode, int format, Vector4f planeS, Vector4f planeT, Vector4f planeR)(Code) | | Constructs a TexCoordGeneration object with the specified genMode,
format, and the S, T, and R coordinate plane equations.
Parameters: genMode - texture generation mode, one of: OBJECT_LINEAR,EYE_LINEAR, SPHERE_MAP, NORMAL_MAP, or REFLECTION_MAP Parameters: format - texture format, one of: TEXTURE_COORDINATE_2,TEXTURE_COORDINATE_3 or TEXTURE_COORDINATE_4 Parameters: planeS - plane equation for the S coordinate Parameters: planeT - plane equation for the T coordinate Parameters: planeR - plane equation for the R coordinate See Also: Canvas3D.queryProperties |
TexCoordGeneration | public TexCoordGeneration(int genMode, int format, Vector4f planeS, Vector4f planeT, Vector4f planeR, Vector4f planeQ)(Code) | | Constructs a TexCoordGeneration object with the specified genMode,
format, and the S, T, R, and Q coordinate plane equations.
Parameters: genMode - texture generation mode, one of: OBJECT_LINEAR,EYE_LINEAR, SPHERE_MAP, NORMAL_MAP, or REFLECTION_MAP Parameters: format - texture format, one of: TEXTURE_COORDINATE_2,TEXTURE_COORDINATE_3 or TEXTURE_COORDINATE_4 Parameters: planeS - plane equation for the S coordinate Parameters: planeT - plane equation for the T coordinate Parameters: planeR - plane equation for the R coordinate Parameters: planeQ - plane equation for the Q coordinate See Also: Canvas3D.queryProperties since: Java 3D 1.3 |
createRetained | void createRetained()(Code) | | Creates a retained mode TexCoordGenerationRetained object that this
TexCoordGeneration component object will point to.
|
duplicateAttributes | void duplicateAttributes(NodeComponent originalNodeComponent, boolean forceDuplicate)(Code) | | Copies all node information from originalNodeComponent into
the current node. This method is called from the
duplicateNode method. This routine does
the actual duplication of all "local data" (any data defined in
this object).
Parameters: originalNodeComponent - the original node to duplicate. Parameters: forceDuplicate - when set to true , causes theduplicateOnCloneTree flag to be ignored. Whenfalse , the value of each node'sduplicateOnCloneTree variable determines whetherNodeComponent data is duplicated or copied. See Also: Node.cloneTree See Also: NodeComponent.setDuplicateOnCloneTree |
getEnable | public boolean getEnable()(Code) | | Retrieves the state of the texCoordGeneration enable flag.
true if texture coordinate generation is enabled,false if texture coordinate generation is disabled exception: CapabilityNotSetException - if appropriate capability isnot set and this object is part of live or compiled scene graph |
getFormat | public int getFormat()(Code) | | Retrieves the current TexCoordGeneration format.
the texture format exception: CapabilityNotSetException - if appropriate capability isnot set and this object is part of live or compiled scene graph |
getGenMode | public int getGenMode()(Code) | | Retrieves the current TexCoordGeneration generation mode.
the texture generation mode exception: CapabilityNotSetException - if appropriate capability isnot set and this object is part of live or compiled scene graph |
getPlaneQ | public void getPlaneQ(Vector4f planeQ)(Code) | | Retrieves a copy of the plane equation used to
generate the Q coordinate.
Parameters: planeQ - the Q coordinate plane equation exception: CapabilityNotSetException - if appropriate capability isnot set and this object is part of live or compiled scene graph since: Java 3D 1.3 |
getPlaneR | public void getPlaneR(Vector4f planeR)(Code) | | Retrieves a copy of the plane equation used to
generate the R coordinate.
Parameters: planeR - the R coordinate plane equation exception: CapabilityNotSetException - if appropriate capability isnot set and this object is part of live or compiled scene graph |
getPlaneS | public void getPlaneS(Vector4f planeS)(Code) | | Retrieves a copy of the plane equation used to
generate the S coordinate.
Parameters: planeS - the S coordinate plane equation exception: CapabilityNotSetException - if appropriate capability isnot set and this object is part of live or compiled scene graph |
getPlaneT | public void getPlaneT(Vector4f planeT)(Code) | | Retrieves a copy of the plane equation used to
generate the T coordinate.
Parameters: planeT - the T coordinate plane equation exception: CapabilityNotSetException - if appropriate capability isnot set and this object is part of live or compiled scene graph |
setEnable | public void setEnable(boolean state)(Code) | | Enables or disables texture coordinate generation for this
appearance component object.
Parameters: state - true or false to enable or disable texture coordinategeneration exception: CapabilityNotSetException - if appropriate capability isnot set and this object is part of live or compiled scene graph |
setFormat | public void setFormat(int format)(Code) | | Sets the TexCoordGeneration format to the specified value.
Parameters: format - texture format, one of: TEXTURE_COORDINATE_2,TEXTURE_COORDINATE_3 or TEXTURE_COORDINATE_4 exception: RestrictedAccessException - if the method is calledwhen this object is part of live or compiled scene graph. |
setGenMode | public void setGenMode(int genMode)(Code) | | Sets the TexCoordGeneration generation mode to the specified value.
Parameters: genMode - texture generation mode, one of: OBJECT_LINEAR,EYE_LINEAR, SPHERE_MAP, NORMAL_MAP, or REFLECTION_MAP. exception: RestrictedAccessException - if the method is calledwhen this object is part of live or compiled scene graph. exception: IllegalArgumentException - if genMode isa value other than OBJECT_LINEAR , EYE_LINEAR ,SPHERE_MAP , NORMAL_MAP , or REFLECTION_MAP . See Also: Canvas3D.queryProperties |
setPlaneQ | public void setPlaneQ(Vector4f planeQ)(Code) | | Sets the Q coordinate plane equation. This plane equation
is used to generate the Q coordinate in OBJECT_LINEAR and EYE_LINEAR
texture generation modes.
Parameters: planeQ - plane equation for the Q coordinate exception: CapabilityNotSetException - if appropriate capability is not set and this object is part of live or compiled scene graph since: Java 3D 1.3 |
setPlaneR | public void setPlaneR(Vector4f planeR)(Code) | | Sets the R coordinate plane equation. This plane equation
is used to generate the R coordinate in OBJECT_LINEAR and EYE_LINEAR
texture generation modes.
Parameters: planeR - plane equation for the R coordinate exception: CapabilityNotSetException - if appropriate capability is not set and this object is part of live or compiled scene graph |
setPlaneS | public void setPlaneS(Vector4f planeS)(Code) | | Sets the S coordinate plane equation. This plane equation
is used to generate the S coordinate in OBJECT_LINEAR and EYE_LINEAR
texture generation modes.
Parameters: planeS - plane equation for the S coordinate exception: CapabilityNotSetException - if appropriate capability is not set and this object is part of live or compiled scene graph |
setPlaneT | public void setPlaneT(Vector4f planeT)(Code) | | Sets the T coordinate plane equation. This plane equation
is used to generate the T coordinate in OBJECT_LINEAR and EYE_LINEAR
texture generation modes.
Parameters: planeT - plane equation for the T coordinate exception: CapabilityNotSetException - if appropriate capability is not set and this object is part of live or compiled scene graph |
Fields inherited from javax.media.j3d.NodeComponent | boolean forceDuplicate(Code)(Java Doc)
|
|
|