| java.lang.Object javax.media.j3d.SceneGraphObject javax.media.j3d.NodeComponent javax.media.j3d.Material
Material | public class Material extends NodeComponent (Code) | | The Material object defines the appearance of an object under
illumination.
If the Material object in an Appearance object is null ,
lighting is disabled for all nodes that use that Appearance object.
The properties that can be set for a Material object are:
- Ambient color - the ambient RGB color reflected off the surface
of the material. The range of values is 0.0 to 1.0. The default ambient
color is (0.2, 0.2, 0.2).
- Diffuse color - the RGB color of the material when illuminated.
The range of values is 0.0 to 1.0. The default diffuse color is
(1.0, 1.0, 1.0).
- Specular color - the RGB specular color of the material (highlights).
The range of values is 0.0 to 1.0. The default specular color
is (1.0, 1.0, 1.0).
- Emissive color - the RGB color of the light the material emits, if
any. The range of values is 0.0 to 1.0. The default emissive
color is (0.0, 0.0, 0.0).
- Shininess - the material's shininess, in the range [1.0, 128.0]
with 1.0 being not shiny and 128.0 being very shiny. Values outside
this range are clamped. The default value for the material's
shininess is 64.
- Color target - the material color target for per-vertex colors,
one of: AMBIENT, EMISSIVE, DIFFUSE, SPECULAR, or AMBIENT_AND_DIFFUSE.
The default target is DIFFUSE.
The Material object also enables or disables lighting.
|
Field Summary | |
final public static int | ALLOW_COMPONENT_READ For material object, specifies that Material allows reading
individual component field information. | final public static int | ALLOW_COMPONENT_WRITE For material object, specifies that Material allows reading
individual component field information. | final public static int | AMBIENT Specifies that per-vertex colors replace the ambient material color. | final public static int | AMBIENT_AND_DIFFUSE Specifies that per-vertex colors replace both the ambient and the
diffuse material color. | final public static int | DIFFUSE Specifies that per-vertex colors replace the diffuse material color. | final public static int | EMISSIVE Specifies that per-vertex colors replace the emissive material color. | final public static int | SPECULAR Specifies that per-vertex colors replace the specular material color. |
Constructor Summary | |
public | Material() Constructs and initializes a Material object using default parameters. | public | Material(Color3f ambientColor, Color3f emissiveColor, Color3f diffuseColor, Color3f specularColor, float shininess) Constructs and initializes a new material object using the specified
parameters. |
Method Summary | |
public NodeComponent | cloneNodeComponent() | void | createRetained() Creates a retained mode MaterialRetained object that this
Material component object will point to. | void | duplicateAttributes(NodeComponent originalNodeComponent, boolean forceDuplicate) Copies all node information from originalNodeComponent into
the current node. | public void | getAmbientColor(Color3f color) Retrieves this material's ambient color. | public int | getColorTarget() Retrieves the current color target for this material. | public void | getDiffuseColor(Color3f color) Retrieves this material's diffuse color. | public void | getEmissiveColor(Color3f color) Retrieves this material's emissive color and stores it in the
argument provided. | public boolean | getLightingEnable() Retrieves the state of the lighting enable flag. | public float | getShininess() Retrieves this material's shininess. | public void | getSpecularColor(Color3f color) Retrieves this material's specular color. | public void | setAmbientColor(Color3f color) Sets this material's ambient color.
This specifies how much ambient light is reflected by
the surface.
The ambient color in this Material object may be overridden by
per-vertex colors in some cases. | public void | setAmbientColor(float r, float g, float b) Sets this material's ambient color.
This specifies how much ambient light is reflected by
the surface. | public void | setColorTarget(int colorTarget) Sets the color target for per-vertex colors. | public void | setDiffuseColor(Color3f color) Sets this material's diffuse color.
This is the color of the material when illuminated by a light source.
The diffuse color in this Material object may be overridden by
per-vertex colors in some cases. | public void | setDiffuseColor(float r, float g, float b) Sets this material's diffuse color.
This is the color of the material when illuminated by a light source.
The diffuse color in this Material object may be overridden by
per-vertex colors in some cases. | public void | setDiffuseColor(float r, float g, float b, float a) Sets this material's diffuse color plus alpha.
This is the color of the material when illuminated by a light source.
The diffuse color in this Material object may be overridden by
per-vertex colors in some cases. | public void | setEmissiveColor(Color3f color) Sets this material's emissive color.
This is the color of light, if any, that the material emits.
The emissive color in this Material object may be overridden by
per-vertex colors in some cases. | public void | setEmissiveColor(float r, float g, float b) Sets this material's emissive color.
This is the color of light, if any, that the material emits.
The emissive color in this Material object may be overridden by
per-vertex colors in some cases. | public void | setLightingEnable(boolean state) Enables or disables lighting for this appearance component object. | public void | setShininess(float shininess) Sets this material's shininess.
This specifies a material specular scattering exponent, or
shininess. | public void | setSpecularColor(Color3f color) Sets this material's specular color.
This is the specular highlight color of the material.
The specular color in this Material object may be overridden by
per-vertex colors in some cases. | public void | setSpecularColor(float r, float g, float b) Sets this material's specular color.
This is the specular highlight color of the material.
The specular color in this Material object may be overridden by
per-vertex colors in some cases. | public String | toString() Returns a String representation of this Materials values. |
ALLOW_COMPONENT_READ | final public static int ALLOW_COMPONENT_READ(Code) | | For material object, specifies that Material allows reading
individual component field information.
|
ALLOW_COMPONENT_WRITE | final public static int ALLOW_COMPONENT_WRITE(Code) | | For material object, specifies that Material allows reading
individual component field information.
|
AMBIENT | final public static int AMBIENT(Code) | | Specifies that per-vertex colors replace the ambient material color.
See Also: Material.setColorTarget since: Java 3D 1.3 |
AMBIENT_AND_DIFFUSE | final public static int AMBIENT_AND_DIFFUSE(Code) | | Specifies that per-vertex colors replace both the ambient and the
diffuse material color.
See Also: Material.setColorTarget since: Java 3D 1.3 |
DIFFUSE | final public static int DIFFUSE(Code) | | Specifies that per-vertex colors replace the diffuse material color.
This is the default target.
See Also: Material.setColorTarget since: Java 3D 1.3 |
EMISSIVE | final public static int EMISSIVE(Code) | | Specifies that per-vertex colors replace the emissive material color.
See Also: Material.setColorTarget since: Java 3D 1.3 |
SPECULAR | final public static int SPECULAR(Code) | | Specifies that per-vertex colors replace the specular material color.
See Also: Material.setColorTarget since: Java 3D 1.3 |
Material | public Material()(Code) | | Constructs and initializes a Material object using default parameters.
The default values are as follows:
lighting enable : true
ambient color : (0.2, 0.2, 0.2)
emmisive color : (0.0, 0.0, 0.0)
diffuse color : (1.0, 1.0, 1.0)
specular color : (1.0, 1.0, 1.0)
shininess : 64
color target : DIFFUSE
|
Material | public Material(Color3f ambientColor, Color3f emissiveColor, Color3f diffuseColor, Color3f specularColor, float shininess)(Code) | | Constructs and initializes a new material object using the specified
parameters. Lighting is enabled by default.
Parameters: ambientColor - the material's ambient color Parameters: emissiveColor - the material's emissive color Parameters: diffuseColor - the material's diffuse color when illuminated by alight Parameters: specularColor - the material's specular color when illuminatedto generate a highlight Parameters: shininess - the material's shininess in therange [1.0, 128.0] with 1.0 being not shiny and 128.0 being very shiny.Values outside this range are clamped. |
createRetained | void createRetained()(Code) | | Creates a retained mode MaterialRetained object that this
Material 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 |
getAmbientColor | public void getAmbientColor(Color3f color)(Code) | | Retrieves this material's ambient color.
Parameters: color - that will contain the material's ambient color exception: CapabilityNotSetException - if appropriate capability isnot set and this object is part of live or compiled scene graph |
getColorTarget | public int getColorTarget()(Code) | | Retrieves the current color target for this material.
one of: AMBIENT, EMISSIVE, DIFFUSE, SPECULAR, orAMBIENT_AND_DIFFUSE. exception: CapabilityNotSetException - if appropriate capability isnot set and this object is part of live or compiled scene graph since: Java 3D 1.3 |
getDiffuseColor | public void getDiffuseColor(Color3f color)(Code) | | Retrieves this material's diffuse color.
Parameters: color - the vector that will receive this material's diffuse color exception: CapabilityNotSetException - if appropriate capability isnot set and this object is part of live or compiled scene graph |
getEmissiveColor | public void getEmissiveColor(Color3f color)(Code) | | Retrieves this material's emissive color and stores it in the
argument provided.
Parameters: color - the vector that will receive this material's emissive color exception: CapabilityNotSetException - if appropriate capability isnot set and this object is part of live or compiled scene graph |
getLightingEnable | public boolean getLightingEnable()(Code) | | Retrieves the state of the lighting enable flag.
true if lighting is enabled, false if lighting is disabled exception: CapabilityNotSetException - if appropriate capability is not set and this object is part of live or compiled scene graph |
getShininess | public float getShininess()(Code) | | Retrieves this material's shininess.
the material's shininess exception: CapabilityNotSetException - if appropriate capability isnot set and this object is part of live or compiled scene graph |
getSpecularColor | public void getSpecularColor(Color3f color)(Code) | | Retrieves this material's specular color.
Parameters: color - the vector that will receive this material's specular color exception: CapabilityNotSetException - if appropriate capability isnot set and this object is part of live or compiled scene graph |
setAmbientColor | public void setAmbientColor(Color3f color)(Code) | | Sets this material's ambient color.
This specifies how much ambient light is reflected by
the surface.
The ambient color in this Material object may be overridden by
per-vertex colors in some cases. If vertex colors are present
in the geometry, and lighting is enabled, and the colorTarget
is either AMBIENT or AMBIENT_AND_DIFFUSE, and vertex colors are
not being ignored, then the vertex colors are used in place of
this Material's ambient color in the lighting equation.
Parameters: color - the material's ambient color exception: CapabilityNotSetException - if appropriate capability isnot set and this object is part of live or compiled scene graph See Also: RenderingAttributes.setIgnoreVertexColors See Also: Material.setColorTarget |
setAmbientColor | public void setAmbientColor(float r, float g, float b)(Code) | | Sets this material's ambient color.
This specifies how much ambient light is reflected by
the surface.
The ambient color in this Material object may be overridden by
per-vertex colors in some cases. If vertex colors are present
in the geometry, and lighting is enabled, and the colorTarget
is either AMBIENT or AMBIENT_AND_DIFFUSE, and vertex colors are
not being ignored, then the vertex colors are used in place of
this Material's ambient color in the lighting equation.
Parameters: r - the new ambient color's red component Parameters: g - the new ambient color's green component Parameters: b - the new ambient color's blue component exception: CapabilityNotSetException - if appropriate capability isnot set and this object is part of live or compiled scene graph See Also: RenderingAttributes.setIgnoreVertexColors See Also: Material.setColorTarget |
setColorTarget | public void setColorTarget(int colorTarget)(Code) | | Sets the color target for per-vertex colors. When lighting is
enabled and per-vertex colors are present (and not ignored) in
the geometry for a given Shape3D node, those per-vertex colors
are used in place of the specified material color(s) for this
Material object. The color target is ignored when lighting is
disabled or when per-vertex colors are not used.
The ColorInterpolator behavior also uses the color target to
determine which color in the associated Material is modified.
The default target is DIFFUSE.
Parameters: colorTarget - one of: AMBIENT, EMISSIVE, DIFFUSE, SPECULAR, orAMBIENT_AND_DIFFUSE. exception: CapabilityNotSetException - if appropriate capability isnot set and this object is part of live or compiled scene graph See Also: RenderingAttributes.setIgnoreVertexColors See Also: ColorInterpolator since: Java 3D 1.3 |
setDiffuseColor | public void setDiffuseColor(Color3f color)(Code) | | Sets this material's diffuse color.
This is the color of the material when illuminated by a light source.
The diffuse color in this Material object may be overridden by
per-vertex colors in some cases. If vertex colors are present
in the geometry, and lighting is enabled, and the colorTarget
is either DIFFUSE or AMBIENT_AND_DIFFUSE, and vertex colors are
not being ignored, then the vertex colors are used in place of
this Material's diffuse color in the lighting equation.
Parameters: color - the new diffuse color exception: CapabilityNotSetException - if appropriate capability isnot set and this object is part of live or compiled scene graph See Also: RenderingAttributes.setIgnoreVertexColors See Also: Material.setColorTarget |
setDiffuseColor | public void setDiffuseColor(float r, float g, float b)(Code) | | Sets this material's diffuse color.
This is the color of the material when illuminated by a light source.
The diffuse color in this Material object may be overridden by
per-vertex colors in some cases. If vertex colors are present
in the geometry, and lighting is enabled, and the colorTarget
is either DIFFUSE or AMBIENT_AND_DIFFUSE, and vertex colors are
not being ignored, then the vertex colors are used in place of
this Material's diffuse color in the lighting equation.
Parameters: r - the new diffuse color's red component Parameters: g - the new diffuse color's green component Parameters: b - the new diffuse color's blue component exception: CapabilityNotSetException - if appropriate capability isnot set and this object is part of live or compiled scene graph See Also: RenderingAttributes.setIgnoreVertexColors See Also: Material.setColorTarget |
setDiffuseColor | public void setDiffuseColor(float r, float g, float b, float a)(Code) | | Sets this material's diffuse color plus alpha.
This is the color of the material when illuminated by a light source.
The diffuse color in this Material object may be overridden by
per-vertex colors in some cases. If vertex colors are present
in the geometry, and lighting is enabled, and the colorTarget
is either DIFFUSE or AMBIENT_AND_DIFFUSE, and vertex colors are
not being ignored, then the vertex colors are used in place of
this Material's diffuse color in the lighting equation.
Parameters: r - the new diffuse color's red component Parameters: g - the new diffuse color's green component Parameters: b - the new diffuse color's blue component Parameters: a - the alpha component used to set transparency exception: CapabilityNotSetException - if appropriate capability isnot set and this object is part of live or compiled scene graph See Also: RenderingAttributes.setIgnoreVertexColors See Also: Material.setColorTarget |
setEmissiveColor | public void setEmissiveColor(Color3f color)(Code) | | Sets this material's emissive color.
This is the color of light, if any, that the material emits.
The emissive color in this Material object may be overridden by
per-vertex colors in some cases. If vertex colors are present
in the geometry, and lighting is enabled, and the colorTarget
is EMISSIVE, and vertex colors are
not being ignored, then the vertex colors are used in place of
this Material's emissive color in the lighting equation.
Parameters: color - the new emissive color exception: CapabilityNotSetException - if appropriate capability isnot set and this object is part of live or compiled scene graph See Also: RenderingAttributes.setIgnoreVertexColors See Also: Material.setColorTarget |
setEmissiveColor | public void setEmissiveColor(float r, float g, float b)(Code) | | Sets this material's emissive color.
This is the color of light, if any, that the material emits.
The emissive color in this Material object may be overridden by
per-vertex colors in some cases. If vertex colors are present
in the geometry, and lighting is enabled, and the colorTarget
is EMISSIVE, and vertex colors are
not being ignored, then the vertex colors are used in place of
this Material's emissive color in the lighting equation.
Parameters: r - the new emissive color's red component Parameters: g - the new emissive color's green component Parameters: b - the new emissive color's blue component exception: CapabilityNotSetException - if appropriate capability isnot set and this object is part of live or compiled scene graph See Also: RenderingAttributes.setIgnoreVertexColors See Also: Material.setColorTarget |
setLightingEnable | public void setLightingEnable(boolean state)(Code) | | Enables or disables lighting for this appearance component object.
Parameters: state - true or false to enable or disable lighting exception: CapabilityNotSetException - if appropriate capability is not set and this object is part of live or compiled scene graph |
setShininess | public void setShininess(float shininess)(Code) | | Sets this material's shininess.
This specifies a material specular scattering exponent, or
shininess. It takes a floating point number in the range [1.0, 128.0]
with 1.0 being not shiny and 128.0 being very shiny.
Values outside this range are clamped.
Parameters: shininess - the material's shininess exception: CapabilityNotSetException - if appropriate capability isnot set and this object is part of live or compiled scene graph |
setSpecularColor | public void setSpecularColor(Color3f color)(Code) | | Sets this material's specular color.
This is the specular highlight color of the material.
The specular color in this Material object may be overridden by
per-vertex colors in some cases. If vertex colors are present
in the geometry, and lighting is enabled, and the colorTarget
is SPECULAR, and vertex colors are
not being ignored, then the vertex colors are used in place of
this Material's specular color in the lighting equation.
Parameters: color - the new specular color exception: CapabilityNotSetException - if appropriate capability isnot set and this object is part of live or compiled scene graph See Also: RenderingAttributes.setIgnoreVertexColors See Also: Material.setColorTarget |
setSpecularColor | public void setSpecularColor(float r, float g, float b)(Code) | | Sets this material's specular color.
This is the specular highlight color of the material.
The specular color in this Material object may be overridden by
per-vertex colors in some cases. If vertex colors are present
in the geometry, and lighting is enabled, and the colorTarget
is SPECULAR, and vertex colors are
not being ignored, then the vertex colors are used in place of
this Material's specular color in the lighting equation.
Parameters: r - the new specular color's red component Parameters: g - the new specular color's green component Parameters: b - the new specular color's blue component exception: CapabilityNotSetException - if appropriate capability isnot set and this object is part of live or compiled scene graph See Also: RenderingAttributes.setIgnoreVertexColors See Also: Material.setColorTarget |
toString | public String toString()(Code) | | Returns a String representation of this Materials values.
If the scene graph is live only those values with their
Capability read bit set will be displayed.
|
Fields inherited from javax.media.j3d.NodeComponent | boolean forceDuplicate(Code)(Java Doc)
|
|
|