Class c3dl.Material
c3dl.Material contains values which describe the behaviour of an object when light
illuminates it. A material can be applied to an object which will make the object appear
to be compose of something rough, shiny, metalic, etc. An object may also emit light, in
which case a light is not required to be in the scene for the object to be colored/lit.
Defined in: material.js.
| Constructor Attributes | Constructor Name and Description |
|---|---|
| Method Attributes | Method Name and Description |
|---|---|
|
Get how much ambient light this material reflects.
|
|
|
getCopy()
Get a deep copy of this object.
|
|
|
Get how much diffuse light this material reflects.
|
|
|
Get the color this material emits.
|
|
|
getName()
Get the name of this material.
|
|
|
Get how shiny this material is.
|
|
|
Get how much specular light this material reflects.
|
|
|
setAmbient(color)
Set how much ambient light this material reflects.
|
|
|
setDiffuse(color)
Set how much diffuse light this material reflects.
|
|
|
setEmission(color)
Set how much light this material should emit.
|
|
|
setName(name)
Set a new name for this material.
|
|
|
setShininess(shine)
Set how shiny this material is.
|
|
|
setSpecular(color)
Set how much specular light this material reflects.
|
|
|
toString()
Get a string representation of this object.
|
Method Detail
{Array}
getAmbient()
Get how much ambient light this material reflects.
- Returns:
- {Array} Three float values in the range 0 - 1 in the order RGB.
{c3dl.Material}
getCopy()
Get a deep copy of this object.
- Returns:
- {c3dl.Material} a deep copy of this object.
{Array}
getDiffuse()
Get how much diffuse light this material reflects.
- Returns:
- {Array} Three float values in the range 0 - 1 in the order RGB.
{Array}
getEmission()
Get the color this material emits.
- Returns:
- {Array} Three float values in the range 0 - 1 in the order RGB.
{String}
getName()
Get the name of this material.
- Returns:
- {String} name of this material.
{float}
getShininess()
Get how shiny this material is.
- Returns:
- {float}
{Array}
getSpecular()
Get how much specular light this material reflects.
- Returns:
- {Array} Three float values in the range 0 - 1 in the order RGB.
setAmbient(color)
Set how much ambient light this material reflects.
- Parameters:
- {Array} color
- Three float values in the range 0 - 1 in the order RGB.
setDiffuse(color)
Set how much diffuse light this material reflects.
- Parameters:
- {Array} color
- Three float values in the range 0 - 1 in the order RGB.
setEmission(color)
Set how much light this material should emit.
Examples of objects emitting their own light include
real world lights,
glow-in-the-dark objects,
any objects which should not appear black in absence of lights
- Parameters:
- {Array} color
- Three float values in the range 0 - 1 in the order RGB.
setName(name)
Set a new name for this material.
The default name for materials is "unnamed".
- Parameters:
- {String} name
- New name of the material.
setShininess(shine)
Set how shiny this material is.
- Parameters:
- {float} shine
setSpecular(color)
Set how much specular light this material reflects.
- Parameters:
- {Array} color
- Three float values in the range 0 - 1 in the order RGB.
{String}
toString()
Get a string representation of this object.
- Returns:
- {String} A string of all the variables and their values seperated by <br />.