public class Material
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable
For convenience, several static final materials are defined in the class.
Modifier and Type | Field and Description |
---|---|
static Material |
BRONZE
A predefined material with the ambient, diffuse, specular, and shininess
characteristics of Bronze.
|
static Material |
GOLD
A predefined material with the ambient, diffuse, specular, and shininess
characteristics of Gold.
|
static Material |
SILVER
A predefined material with the ambient, diffuse, specular, and shininess
characteristics of Silver.
|
Constructor and Description |
---|
Material()
Creates a default material with a unique default name and default color
values.
|
Material(float[] ambient,
float[] diffuse,
float[] specular,
float[] emission,
float shininess)
Creates a material with the specified reflection, emission, and
shininess values.
|
Material(java.lang.String newName)
Creates a material with the specified name and the default values.
|
Material(java.lang.String name,
float[] ambient,
float[] diffuse,
float[] specular,
float[] emission,
float shininess)
Creates a material with the specified name and the specified reflection,
emission, and shininess values.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
clone()
Returns a new material object which is a clone of this material.
|
float[] |
getAmbient()
Returns an array containing values which are the same as the ambient
reflection coefficients of the material (that is, returns a clone of
this material's ambient reflection coefficient array).
|
float[] |
getDiffuse()
Returns an array containing values which are the same as the diffuse
reflection coefficients of the material (that is, returns a clone of
this material's diffuse reflection coefficient array).
|
float[] |
getEmission()
Returns an array containing values which are the same as the emission
coefficients of the material (that is, returns a clone of
this material's emission coefficient array).
|
java.lang.String |
getName()
Returns the name of this Material
|
float |
getShininess()
Returns the shininess value of the material.
|
float[] |
getSpecular()
Returns an array containing values which are the same as the specular
reflection coefficients of the material (that is, returns a clone of
this material's specular reflection coefficient array).
|
void |
setAmbient(float[] vals)
Sets the ambient reflection coefficients of this material.
|
void |
setDiffuse(float[] vals)
Sets the diffuse reflection coefficients of this material.
|
void |
setEmission(float[] vals)
Sets the emission coefficients of this material.
|
void |
setName(java.lang.String n)
Sets a new name for this material.
|
void |
setShininess(float newShininess)
Sets the glossiness value of the material.
|
void |
setSpecular(float[] vals)
Sets the specular reflection coefficients of this material.
|
java.lang.String |
toString()
Returns a printable representation of this Material.
|
public static final Material GOLD
public static final Material SILVER
public static final Material BRONZE
public Material()
public Material(java.lang.String newName)
public Material(float[] ambient, float[] diffuse, float[] specular, float[] emission, float shininess)
public Material(java.lang.String name, float[] ambient, float[] diffuse, float[] specular, float[] emission, float shininess)
public java.lang.Object clone()
clone
in class java.lang.Object
public java.lang.String getName()
public float[] getAmbient()
public float[] getDiffuse()
public float[] getSpecular()
public float[] getEmission()
public float getShininess()
public void setName(java.lang.String n)
public void setAmbient(float[] vals)
public void setDiffuse(float[] vals)
public void setSpecular(float[] vals)
public void setEmission(float[] vals)
public void setShininess(float newShininess)
public java.lang.String toString()
toString
in class java.lang.Object