Class ColoringAttributes
Color
The setColor
methods set the current intrinsic red, green, and
blue color values of this ColoringAttributes component object.
This color is only used for unlit geometry. If lighting is enabled,
the material colors are used in the lighting equation to produce
the final color. When vertex colors are present in unlit
geometry, those vertex colors are used in place of this
ColoringAttributes color, unless the vertex colors are ignored.
There are two variations on the setColor
methods, one
that takes a Color3f and one that takes three floats. No alpha
value is allowed (it's automatically set to 1.0). The float values
range between 0.0 and 1.0, with 1.0 being full intensity of the
color. A color value of (1.0, 1.0, 1.0) is white.
Shading Model
The setShadeModel
method sets the shade model for this
ColoringAttributes component object. The shade model may be one of
the following:
- FASTEST - use the fastest available method for shading. This shading mode maps to whatever shading model the Java 3D implementor defines as the "fastest," which may be hardware-dependent.
- NICEST - use the nicest (highest quality) available method for shading. This shading mode maps to whatever shading model the Java 3D implementor defines as the "nicest," shading model, which may be hardware-dependent.
- SHADE_FLAT - use the flat shading model. This shading model does not interpolate color across the primitive. The primitive is drawn with a single color and the color of one vertex of the primitive is duplicated across all the vertices of the primitive.
- SHADE_GOURAUD - use the Gouraud (smooth) shading model. This shading model smoothly interpolates the color at each vertex across the primitive. The primitive is drawn with many different colors and the color at each vertex is treated individually. For lines, the colors along the line segment are interpolated between the vertex colors. This is the default shade model if no other is specified.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
Specifies that this ColoringAttributes object allows reading its color component information.static final int
Specifies that this ColoringAttributes object allows writing its color component information.static final int
Specifies that this ColoringAttributes object allows reading its shade model component information.static final int
Specifies that this ColoringAttributes object allows writing its shade model component information.static final int
Use the fastest available method for shading.static final int
Use the nicest available method for shading.static final int
Do not interpolate color across the primitive.static final int
Smoothly interpolate the color at each vertex across the primitive. -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a ColoringAttributes node with default parameters.ColoringAttributes
(float red, float green, float blue, int shadeModel) Construct ColoringAttributes object with specified values.ColoringAttributes
(javax.vecmath.Color3f color, int shadeModel) Construct ColoringAttributes object with specified values. -
Method Summary
Modifier and TypeMethodDescriptionDeprecated.replaced with cloneNodeComponent(boolean forceDuplicate)void
getColor
(javax.vecmath.Color3f color) Gets the intrinsic color of this ColoringAttributes component object.int
Gets the shade mode for this ColoringAttributes component object.void
setColor
(float r, float g, float b) Sets the intrinsic color of this ColoringAttributes component object.void
setColor
(javax.vecmath.Color3f color) Sets the intrinsic color of this ColoringAttributes component object.void
setShadeModel
(int shadeModel) Sets the shade mode for this ColoringAttributes component object.toString()
Returns a String representation of this ColoringAttributes object.Methods inherited from class javax.media.j3d.NodeComponent
cloneNodeComponent, duplicateNodeComponent, duplicateNodeComponent, getDuplicateOnCloneTree, setDuplicateOnCloneTree
Methods inherited from class javax.media.j3d.SceneGraphObject
clearCapability, clearCapabilityIsFrequent, duplicateSceneGraphObject, getCapability, getCapabilityIsFrequent, getName, getUserData, isCompiled, isLive, setCapability, setCapabilityIsFrequent, setName, setUserData, updateNodeReferences
-
Field Details
-
ALLOW_COLOR_READ
public static final int ALLOW_COLOR_READSpecifies that this ColoringAttributes object allows reading its color component information.- See Also:
-
ALLOW_COLOR_WRITE
public static final int ALLOW_COLOR_WRITESpecifies that this ColoringAttributes object allows writing its color component information.- See Also:
-
ALLOW_SHADE_MODEL_READ
public static final int ALLOW_SHADE_MODEL_READSpecifies that this ColoringAttributes object allows reading its shade model component information.- See Also:
-
ALLOW_SHADE_MODEL_WRITE
public static final int ALLOW_SHADE_MODEL_WRITESpecifies that this ColoringAttributes object allows writing its shade model component information.- See Also:
-
FASTEST
Use the fastest available method for shading.- See Also:
-
NICEST
Use the nicest available method for shading.- See Also:
-
SHADE_FLAT
Do not interpolate color across the primitive.- See Also:
-
SHADE_GOURAUD
Smoothly interpolate the color at each vertex across the primitive.- See Also:
-
-
Constructor Details
-
ColoringAttributes
public ColoringAttributes()Constructs a ColoringAttributes node with default parameters. The default values are as follows:-
color = white (1,1,1)
shade model = SHADE_GOURAUD
-
ColoringAttributes
public ColoringAttributes(javax.vecmath.Color3f color, int shadeModel) Construct ColoringAttributes object with specified values.- Parameters:
color
- the intrisic colorshadeModel
- the shade model used; one of FASTEST, NICEST, SHADE_FLAT, or SHADE_GOURAUD
-
ColoringAttributes
public ColoringAttributes(float red, float green, float blue, int shadeModel) Construct ColoringAttributes object with specified values.- Parameters:
red
- red component of the intrisic colorgreen
- green component of the intrisic colorblue
- blue component of the intrisic colorshadeModel
- the shade model used; one of FASTEST, NICEST, SHADE_FLAT, or SHADE_GOURAUD
-
-
Method Details
-
setColor
public void setColor(javax.vecmath.Color3f color) Sets the intrinsic color of this ColoringAttributes component object. This color is only used for unlit geometry; if lighting is enabled, then the material colors are used in the lighting equation to produce the final color. When vertex colors are present in unlit geometry, those vertex colors are used in place of this ColoringAttributes color unless the vertex colors are ignored.- Parameters:
color
- the color that is used when lighting is disabled or when material is null- Throws:
CapabilityNotSetException
- if appropriate capability is not set and this object is part of live or compiled scene graph- See Also:
-
setColor
public void setColor(float r, float g, float b) Sets the intrinsic color of this ColoringAttributes component object. This color is only used for unlit geometry; if lighting is enabled, then the material colors are used in the lighting equation to produce the final color. When vertex colors are present in unlit geometry, those vertex colors are used in place of this ColoringAttributes color unless the vertex colors are ignored.- Parameters:
r
- the red component of the colorg
- the green component of the colorb
- the blue component of the color- Throws:
CapabilityNotSetException
- if appropriate capability is not set and this object is part of live or compiled scene graph- See Also:
-
getColor
public void getColor(javax.vecmath.Color3f color) Gets the intrinsic color of this ColoringAttributes component object.- Parameters:
color
- the vector that will receive color- Throws:
CapabilityNotSetException
- if appropriate capability is not set and this object is part of live or compiled scene graph
-
setShadeModel
public void setShadeModel(int shadeModel) Sets the shade mode for this ColoringAttributes component object.- Parameters:
shadeModel
- the shade mode to be used; one of FASTEST, NICEST, SHADE_FLAT, or SHADE_GOURAUD- Throws:
CapabilityNotSetException
- if appropriate capability is not set and this object is part of live or compiled scene graph
-
getShadeModel
public int getShadeModel()Gets the shade mode for this ColoringAttributes component object.- Returns:
- shadeModel the shade mode
- Throws:
CapabilityNotSetException
- if appropriate capability is not set and this object is part of live or compiled scene graph
-
cloneNodeComponent
Deprecated.replaced with cloneNodeComponent(boolean forceDuplicate)- Overrides:
cloneNodeComponent
in classNodeComponent
-
toString
Returns a String representation of this ColoringAttributes object. If the scene graph is live only those values with their Capability read bit set will be displayed.- Overrides:
toString
in classSceneGraphObject
-