|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.media.j3d.SceneGraphObject | +--javax.media.j3d.NodeComponent | +--javax.media.j3d.TexCoordGeneration
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 or three coordinates, depending on whether the texture is 2D or 3D, respectively. These coordinates are referred to as the S, T, and R coordinates. 2D textures use the S and T coordinates. 3D textures use all three 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:
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).
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.
The equation coefficients are set by the setPlaneS
,
setPlaneT
, and setPlaneR
methods for
each of the S, T, and R coordinate functions, respectively.
By default the equation coefficients are set as follows:
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.
Field Summary | |
static int |
ALLOW_ENABLE_READ
Specifies that this TexCoordGeneration object allows reading its enable flag. |
static int |
ALLOW_ENABLE_WRITE
Specifies that this TexCoordGeneration object allows writing its enable flag. |
static int |
ALLOW_FORMAT_READ
Specifies that this TexCoordGeneration object allows reading its format information. |
static int |
ALLOW_MODE_READ
Specifies that this TexCoordGeneration object allows reading its mode information. |
static int |
ALLOW_PLANE_READ
Specifies that this TexCoordGeneration object allows reading its planeS, planeR, and planeT component information. |
static int |
EYE_LINEAR
Generates texture coordinates as a linear function in eye coordinates. |
static int |
OBJECT_LINEAR
Generates texture coordinates as a linear function in object coordinates. |
static int |
SPHERE_MAP
Generates texture coordinates using a spherical reflection mapping in eye coordinates. |
static int |
TEXTURE_COORDINATE_2
Generates 2D texture coordinates (S and T). |
static int |
TEXTURE_COORDINATE_3
Generates 3D texture coordinates (S, T, and R). |
Constructor Summary | |
TexCoordGeneration()
Constructs a TexCoordGeneration object with default parameters. |
|
TexCoordGeneration(int genMode,
int format)
Constructs a TexCoordGeneration object with the specified genMode and format. |
|
TexCoordGeneration(int genMode,
int format,
Vector4f planeS)
Constructs a TexCoordGeneration object with the specified genMode, format, and the S coordinate plane equation. |
|
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. |
|
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. |
Method Summary | |
NodeComponent |
cloneNodeComponent()
Deprecated. replaced with cloneNodeComponent(boolean forceDuplicate) |
boolean |
getEnable()
Retrieves the state of the texCoordGeneration enable flag. |
int |
getFormat()
Retrieves the current TexCoordGeneration format. |
int |
getGenMode()
Retrieves the current TexCoordGeneration generation mode. |
void |
getPlaneR(Vector4f planeR)
Retrieves a copy of the plane equation used to generate the R coordinate. |
void |
getPlaneS(Vector4f planeS)
Retrieves a copy of the plane equation used to generate the S coordinate. |
void |
getPlaneT(Vector4f planeT)
Retrieves a copy of the plane equation used to generate the T coordinate. |
void |
setEnable(boolean state)
Enables or disables texture coordinate generation for this appearance component object. |
void |
setFormat(int format)
Sets the TexCoordGeneration format to the specified value. |
void |
setGenMode(int genMode)
Sets the TexCoordGeneration generation mode to the specified value. |
void |
setPlaneR(Vector4f planeR)
Sets the R coordinate plane equation. |
void |
setPlaneS(Vector4f planeS)
Sets the S coordinate plane equation. |
void |
setPlaneT(Vector4f planeT)
Sets the T coordinate plane equation. |
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 |
public static final int ALLOW_ENABLE_READ
public static final int ALLOW_ENABLE_WRITE
public static final int ALLOW_FORMAT_READ
public static final int ALLOW_MODE_READ
public static final int ALLOW_PLANE_READ
public static final int OBJECT_LINEAR
public static final int EYE_LINEAR
public static final int SPHERE_MAP
public static final int TEXTURE_COORDINATE_2
public static final int TEXTURE_COORDINATE_3
Constructor Detail |
public TexCoordGeneration()
public TexCoordGeneration(int genMode, int format)
genMode
- texture generation mode, one of: OBJECT_LINEAR,
EYE_LINEAR, or SPHERE_MAPformat
- texture format, one of: TEXTURE_COORDINATE_2
or TEXTURE_COORDINATE_3public TexCoordGeneration(int genMode, int format, Vector4f planeS)
genMode
- texture generation mode, one of: OBJECT_LINEAR,
EYE_LINEAR, or SPHERE_MAPformat
- texture format, one of: TEXTURE_COORDINATE_2
or TEXTURE_COORDINATE_3planeS
- plane equation for the S coordinatepublic TexCoordGeneration(int genMode, int format, Vector4f planeS, Vector4f planeT)
genMode
- texture generation mode, one of: OBJECT_LINEAR,
EYE_LINEAR, or SPHERE_MAPformat
- texture format, one of: TEXTURE_COORDINATE_2
or TEXTURE_COORDINATE_3planeS
- plane equation for the S coordinateplaneT
- plane equation for the T coordinatepublic TexCoordGeneration(int genMode, int format, Vector4f planeS, Vector4f planeT, Vector4f planeR)
genMode
- texture generation mode, one of: OBJECT_LINEAR,
EYE_LINEAR, or SPHERE_MAPformat
- texture format, one of: TEXTURE_COORDINATE_2
or TEXTURE_COORDINATE_3planeS
- plane equation for the S coordinateplaneT
- plane equation for the T coordinateplaneR
- plane equation for the R coordinateMethod Detail |
public void setEnable(boolean state)
state
- true or false to enable or disable texture coordinate
generationpublic boolean getEnable()
public void setFormat(int format)
format
- texture format, one of: TEXTURE_COORDINATE_2
or TEXTURE_COORDINATE_3public int getFormat()
public void setGenMode(int genMode)
genMode
- texture generation mode, one of: OBJECT_LINEAR,
EYE_LINEAR, or SPHERE_MAPpublic int getGenMode()
public void setPlaneS(Vector4f planeS)
planeS
- plane equation for the S coordinatepublic void getPlaneS(Vector4f planeS)
planeS
- the S coordinate plane equationpublic void setPlaneT(Vector4f planeT)
planeT
- plane equation for the T coordinatepublic void getPlaneT(Vector4f planeT)
planeT
- the T coordinate plane equationpublic void setPlaneR(Vector4f planeR)
planeR
- plane equation for the R coordinatepublic void getPlaneR(Vector4f planeR)
planeR
- the R coordinate plane equationpublic NodeComponent cloneNodeComponent()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |