public class Material extends NodeComponent
null,
lighting is disabled for all nodes that use that Appearance object.
The properties that can be set for a Material object are:
| Modifier and Type | Field | Description |
|---|---|---|
static int |
ALLOW_COMPONENT_READ |
For material object, specifies that Material allows reading
individual component field information.
|
static int |
ALLOW_COMPONENT_WRITE |
For material object, specifies that Material allows reading
individual component field information.
|
static int |
AMBIENT |
Specifies that per-vertex colors replace the ambient material color.
|
static int |
AMBIENT_AND_DIFFUSE |
Specifies that per-vertex colors replace both the ambient and the
diffuse material color.
|
static int |
DIFFUSE |
Specifies that per-vertex colors replace the diffuse material color.
|
static int |
EMISSIVE |
Specifies that per-vertex colors replace the emissive material color.
|
static int |
SPECULAR |
Specifies that per-vertex colors replace the specular material color.
|
| Constructor | Description |
|---|---|
Material() |
Constructs and initializes a Material object using default parameters.
|
Material(javax.vecmath.Color3f ambientColor,
javax.vecmath.Color3f emissiveColor,
javax.vecmath.Color3f diffuseColor,
javax.vecmath.Color3f specularColor,
float shininess) |
Constructs and initializes a new material object using the specified
parameters.
|
| Modifier and Type | Method | Description |
|---|---|---|
NodeComponent |
cloneNodeComponent() |
Deprecated.
replaced with cloneNodeComponent(boolean forceDuplicate)
|
void |
getAmbientColor(javax.vecmath.Color3f color) |
Retrieves this material's ambient color.
|
int |
getColorTarget() |
Retrieves the current color target for this material.
|
void |
getDiffuseColor(javax.vecmath.Color3f color) |
Retrieves this material's diffuse color.
|
void |
getEmissiveColor(javax.vecmath.Color3f color) |
Retrieves this material's emissive color and stores it in the
argument provided.
|
boolean |
getLightingEnable() |
Retrieves the state of the lighting enable flag.
|
float |
getShininess() |
Retrieves this material's shininess.
|
void |
getSpecularColor(javax.vecmath.Color3f color) |
Retrieves this material's specular color.
|
void |
setAmbientColor(float r,
float g,
float b) |
Sets this material's ambient color.
|
void |
setAmbientColor(javax.vecmath.Color3f color) |
Sets this material's ambient color.
|
void |
setColorTarget(int colorTarget) |
Sets the color target for per-vertex colors.
|
void |
setDiffuseColor(float r,
float g,
float b) |
Sets this material's diffuse color.
|
void |
setDiffuseColor(float r,
float g,
float b,
float a) |
Sets this material's diffuse color plus alpha.
|
void |
setDiffuseColor(javax.vecmath.Color3f color) |
Sets this material's diffuse color.
|
void |
setEmissiveColor(float r,
float g,
float b) |
Sets this material's emissive color.
|
void |
setEmissiveColor(javax.vecmath.Color3f color) |
Sets this material's emissive color.
|
void |
setLightingEnable(boolean state) |
Enables or disables lighting for this appearance component object.
|
void |
setShininess(float shininess) |
Sets this material's shininess.
|
void |
setSpecularColor(float r,
float g,
float b) |
Sets this material's specular color.
|
void |
setSpecularColor(javax.vecmath.Color3f color) |
Sets this material's specular color.
|
java.lang.String |
toString() |
Returns a String representation of this Materials values.
|
cloneNodeComponent, duplicateNodeComponent, duplicateNodeComponent, getDuplicateOnCloneTree, setDuplicateOnCloneTreeclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitclearCapability, clearCapabilityIsFrequent, duplicateSceneGraphObject, getCapability, getCapabilityIsFrequent, getName, getUserData, isCompiled, isLive, setCapability, setCapabilityIsFrequent, setName, setUserData, updateNodeReferencespublic static final int ALLOW_COMPONENT_READ
public static final int ALLOW_COMPONENT_WRITE
@Native public static final int AMBIENT
setColorTarget(int),
Constant Field Values@Native public static final int EMISSIVE
setColorTarget(int),
Constant Field Values@Native public static final int DIFFUSE
setColorTarget(int),
Constant Field Values@Native public static final int SPECULAR
setColorTarget(int),
Constant Field Values@Native public static final int AMBIENT_AND_DIFFUSE
setColorTarget(int),
Constant Field Valuespublic Material()
public Material(javax.vecmath.Color3f ambientColor,
javax.vecmath.Color3f emissiveColor,
javax.vecmath.Color3f diffuseColor,
javax.vecmath.Color3f specularColor,
float shininess)
ambientColor - the material's ambient coloremissiveColor - the material's emissive colordiffuseColor - the material's diffuse color when illuminated by a
lightspecularColor - the material's specular color when illuminated
to generate a highlightshininess - 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.public void setAmbientColor(javax.vecmath.Color3f color)
color - the material's ambient colorCapabilityNotSetException - if appropriate capability is
not set and this object is part of live or compiled scene graphRenderingAttributes.setIgnoreVertexColors(boolean),
setColorTarget(int)public void setAmbientColor(float r,
float g,
float b)
r - the new ambient color's red componentg - the new ambient color's green componentb - the new ambient color's blue componentCapabilityNotSetException - if appropriate capability is
not set and this object is part of live or compiled scene graphRenderingAttributes.setIgnoreVertexColors(boolean),
setColorTarget(int)public void getAmbientColor(javax.vecmath.Color3f color)
color - that will contain the material's ambient colorCapabilityNotSetException - if appropriate capability is
not set and this object is part of live or compiled scene graphpublic void setEmissiveColor(javax.vecmath.Color3f color)
color - the new emissive colorCapabilityNotSetException - if appropriate capability is
not set and this object is part of live or compiled scene graphRenderingAttributes.setIgnoreVertexColors(boolean),
setColorTarget(int)public void setEmissiveColor(float r,
float g,
float b)
r - the new emissive color's red componentg - the new emissive color's green componentb - the new emissive color's blue componentCapabilityNotSetException - if appropriate capability is
not set and this object is part of live or compiled scene graphRenderingAttributes.setIgnoreVertexColors(boolean),
setColorTarget(int)public void getEmissiveColor(javax.vecmath.Color3f color)
color - the vector that will receive this material's emissive colorCapabilityNotSetException - if appropriate capability is
not set and this object is part of live or compiled scene graphpublic void setDiffuseColor(javax.vecmath.Color3f color)
color - the new diffuse colorCapabilityNotSetException - if appropriate capability is
not set and this object is part of live or compiled scene graphRenderingAttributes.setIgnoreVertexColors(boolean),
setColorTarget(int)public void setDiffuseColor(float r,
float g,
float b)
r - the new diffuse color's red componentg - the new diffuse color's green componentb - the new diffuse color's blue componentCapabilityNotSetException - if appropriate capability is
not set and this object is part of live or compiled scene graphRenderingAttributes.setIgnoreVertexColors(boolean),
setColorTarget(int)public void setDiffuseColor(float r,
float g,
float b,
float a)
r - the new diffuse color's red componentg - the new diffuse color's green componentb - the new diffuse color's blue componenta - the alpha component used to set transparencyCapabilityNotSetException - if appropriate capability is
not set and this object is part of live or compiled scene graphRenderingAttributes.setIgnoreVertexColors(boolean),
setColorTarget(int)public void getDiffuseColor(javax.vecmath.Color3f color)
color - the vector that will receive this material's diffuse colorCapabilityNotSetException - if appropriate capability is
not set and this object is part of live or compiled scene graphpublic void setSpecularColor(javax.vecmath.Color3f color)
color - the new specular colorCapabilityNotSetException - if appropriate capability is
not set and this object is part of live or compiled scene graphRenderingAttributes.setIgnoreVertexColors(boolean),
setColorTarget(int)public void setSpecularColor(float r,
float g,
float b)
r - the new specular color's red componentg - the new specular color's green componentb - the new specular color's blue componentCapabilityNotSetException - if appropriate capability is
not set and this object is part of live or compiled scene graphRenderingAttributes.setIgnoreVertexColors(boolean),
setColorTarget(int)public void getSpecularColor(javax.vecmath.Color3f color)
color - the vector that will receive this material's specular colorCapabilityNotSetException - if appropriate capability is
not set and this object is part of live or compiled scene graphpublic void setShininess(float shininess)
shininess - the material's shininessCapabilityNotSetException - if appropriate capability is
not set and this object is part of live or compiled scene graphpublic float getShininess()
CapabilityNotSetException - if appropriate capability is
not set and this object is part of live or compiled scene graphpublic void setLightingEnable(boolean state)
state - true or false to enable or disable lightingCapabilityNotSetException - if appropriate capability is
not set and this object is part of live or compiled scene graphpublic boolean getLightingEnable()
CapabilityNotSetException - if appropriate capability is
not set and this object is part of live or compiled scene graphpublic void setColorTarget(int colorTarget)
colorTarget - one of: AMBIENT, EMISSIVE, DIFFUSE, SPECULAR, or
AMBIENT_AND_DIFFUSE.CapabilityNotSetException - if appropriate capability is
not set and this object is part of live or compiled scene graphRenderingAttributes.setIgnoreVertexColors(boolean),
ColorInterpolatorpublic int getColorTarget()
CapabilityNotSetException - if appropriate capability is
not set and this object is part of live or compiled scene graphpublic java.lang.String toString()
toString in class SceneGraphObjectpublic NodeComponent cloneNodeComponent()
cloneNodeComponent in class NodeComponentCopyright 1996-2008 Sun Microsystems, Inc. All Rights Reserved. Use is subject to license terms.