public class TexCoordGeneration extends NodeComponent
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:
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
, 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:
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.Canvas3D.queryProperties()
Modifier and Type | Field and Description |
---|---|
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 |
ALLOW_PLANE_WRITE
Specifies that this TexCoordGeneration object allows writing its
planeS, planeR, and planeT component information.
|
static int |
EYE_LINEAR
Generates texture coordinates as a linear function in
eye coordinates.
|
static int |
NORMAL_MAP
Generates texture coordinates that match vertices' normals in
eye coordinates.
|
static int |
OBJECT_LINEAR
Generates texture coordinates as a linear function in
object coordinates.
|
static int |
REFLECTION_MAP
Generates texture coordinates that match vertices' reflection
vectors in eye 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).
|
static int |
TEXTURE_COORDINATE_4
Generates 4D texture coordinates (S, T, R, and Q).
|
Constructor and Description |
---|
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.
|
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.
|
Modifier and Type | Method and Description |
---|---|
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 |
getPlaneQ(Vector4f planeQ)
Retrieves a copy of the plane equation used to
generate the Q coordinate.
|
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 |
setPlaneQ(Vector4f planeQ)
Sets the Q coordinate plane equation.
|
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.
|
cloneNodeComponent, duplicateNodeComponent, duplicateNodeComponent, getDuplicateOnCloneTree, setDuplicateOnCloneTree
clearCapability, clearCapabilityIsFrequent, duplicateSceneGraphObject, getCapability, getCapabilityIsFrequent, getName, getUserData, isCompiled, isLive, setCapability, setCapabilityIsFrequent, setName, setUserData, toString, updateNodeReferences
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 ALLOW_PLANE_WRITE
public static final int OBJECT_LINEAR
setGenMode(int)
,
Constant Field Valuespublic static final int EYE_LINEAR
setGenMode(int)
,
Constant Field Valuespublic static final int SPHERE_MAP
setGenMode(int)
,
Constant Field Valuespublic static final int NORMAL_MAP
setGenMode(int)
,
Canvas3D.queryProperties()
,
Constant Field Valuespublic static final int REFLECTION_MAP
setGenMode(int)
,
Canvas3D.queryProperties()
,
Constant Field Valuespublic static final int TEXTURE_COORDINATE_2
setFormat(int)
,
Constant Field Valuespublic static final int TEXTURE_COORDINATE_3
setFormat(int)
,
Constant Field Valuespublic static final int TEXTURE_COORDINATE_4
setFormat(int)
,
Constant Field Valuespublic TexCoordGeneration()
public TexCoordGeneration(int genMode, int format)
genMode
- texture generation mode, one of: OBJECT_LINEAR,
EYE_LINEAR, SPHERE_MAP, NORMAL_MAP, or REFLECTION_MAPformat
- texture format, one of: TEXTURE_COORDINATE_2,
TEXTURE_COORDINATE_3, or TEXTURE_COORDINATE_4Canvas3D.queryProperties()
public TexCoordGeneration(int genMode, int format, Vector4f planeS)
genMode
- texture generation mode, one of: OBJECT_LINEAR,
EYE_LINEAR, SPHERE_MAP, NORMAL_MAP, or REFLECTION_MAPformat
- texture format, one of: TEXTURE_COORDINATE_2,
TEXTURE_COORDINATE_3 or TEXTURE_COORDINATE_4planeS
- plane equation for the S coordinateCanvas3D.queryProperties()
public TexCoordGeneration(int genMode, int format, Vector4f planeS, Vector4f planeT)
genMode
- texture generation mode, one of: OBJECT_LINEAR,
EYE_LINEAR, SPHERE_MAP, NORMAL_MAP, or REFLECTION_MAPformat
- texture format, one of: TEXTURE_COORDINATE_2,
TEXTURE_COORDINATE_3 or TEXTURE_COORDINATE_4planeS
- plane equation for the S coordinateplaneT
- plane equation for the T coordinateCanvas3D.queryProperties()
public TexCoordGeneration(int genMode, int format, Vector4f planeS, Vector4f planeT, Vector4f planeR)
genMode
- texture generation mode, one of: OBJECT_LINEAR,
EYE_LINEAR, SPHERE_MAP, NORMAL_MAP, or REFLECTION_MAPformat
- texture format, one of: TEXTURE_COORDINATE_2,
TEXTURE_COORDINATE_3 or TEXTURE_COORDINATE_4planeS
- plane equation for the S coordinateplaneT
- plane equation for the T coordinateplaneR
- plane equation for the R coordinateCanvas3D.queryProperties()
public TexCoordGeneration(int genMode, int format, Vector4f planeS, Vector4f planeT, Vector4f planeR, Vector4f planeQ)
genMode
- texture generation mode, one of: OBJECT_LINEAR,
EYE_LINEAR, SPHERE_MAP, NORMAL_MAP, or REFLECTION_MAPformat
- texture format, one of: TEXTURE_COORDINATE_2,
TEXTURE_COORDINATE_3 or TEXTURE_COORDINATE_4planeS
- plane equation for the S coordinateplaneT
- plane equation for the T coordinateplaneR
- plane equation for the R coordinateplaneQ
- plane equation for the Q coordinateCanvas3D.queryProperties()
public void setEnable(boolean state)
state
- true or false to enable or disable texture coordinate
generationCapabilityNotSetException
- if appropriate capability is
not set and this object is part of live or compiled scene graphpublic boolean getEnable()
CapabilityNotSetException
- if appropriate capability is
not set and this object is part of live or compiled scene graphpublic void setFormat(int format)
format
- texture format, one of: TEXTURE_COORDINATE_2,
TEXTURE_COORDINATE_3 or TEXTURE_COORDINATE_4RestrictedAccessException
- if the method is called
when this object is part of live or compiled scene graph.public int getFormat()
CapabilityNotSetException
- if appropriate capability is
not set and this object is part of live or compiled scene graphpublic void setGenMode(int genMode)
genMode
- texture generation mode, one of: OBJECT_LINEAR,
EYE_LINEAR, SPHERE_MAP, NORMAL_MAP, or REFLECTION_MAP.RestrictedAccessException
- if the method is called
when this object is part of live or compiled scene graph.IllegalArgumentException
- if genMode
is
a value other than OBJECT_LINEAR
, EYE_LINEAR
,
SPHERE_MAP
, NORMAL_MAP
, or
REFLECTION_MAP
.Canvas3D.queryProperties()
public int getGenMode()
CapabilityNotSetException
- if appropriate capability is
not set and this object is part of live or compiled scene graphpublic void setPlaneS(Vector4f planeS)
planeS
- plane equation for the S coordinateCapabilityNotSetException
- if appropriate capability is
not set and this object is part of live or compiled scene graphpublic void getPlaneS(Vector4f planeS)
planeS
- the S coordinate plane equationCapabilityNotSetException
- if appropriate capability is
not set and this object is part of live or compiled scene graphpublic void setPlaneT(Vector4f planeT)
planeT
- plane equation for the T coordinateCapabilityNotSetException
- if appropriate capability is
not set and this object is part of live or compiled scene graphpublic void getPlaneT(Vector4f planeT)
planeT
- the T coordinate plane equationCapabilityNotSetException
- if appropriate capability is
not set and this object is part of live or compiled scene graphpublic void setPlaneR(Vector4f planeR)
planeR
- plane equation for the R coordinateCapabilityNotSetException
- if appropriate capability is
not set and this object is part of live or compiled scene graphpublic void getPlaneR(Vector4f planeR)
planeR
- the R coordinate plane equationCapabilityNotSetException
- if appropriate capability is
not set and this object is part of live or compiled scene graphpublic void setPlaneQ(Vector4f planeQ)
planeQ
- plane equation for the Q coordinateCapabilityNotSetException
- if appropriate capability is
not set and this object is part of live or compiled scene graphpublic void getPlaneQ(Vector4f planeQ)
planeQ
- the Q coordinate plane equationCapabilityNotSetException
- if appropriate capability is
not set and this object is part of live or compiled scene graphpublic NodeComponent cloneNodeComponent()
cloneNodeComponent
in class NodeComponent
Copyright © 2016–2022 SciJava. All rights reserved.