Class threedee.Material
A material.
Defined in: Material.js.
Constructor Attributes | Constructor Name and Description |
---|---|
threedee.Material(ambient, diffuse, emissive)
Constructs a new Material with the specified properties.
|
Field Attributes | Field Name and Description |
---|---|
<static> |
threedee.Material.DEFAULT
The default material.
|
Method Attributes | Method Name and Description |
---|---|
<static> |
threedee.Material.count()
Returns and resets the current instance counter.
|
<static> |
threedee.Material.fromJSON(data)
Creates a new material instance with the data read from the
specified JSON object (with keys 'a', 'd' and 'e').
|
Returns the ambient color.
|
|
Returns the diffuse color.
|
|
Returns the emissive color.
|
|
toJSON()
Converts the material into a JSON object with keys 'a', 'd' and 'e' and
returns it.
|
Class Detail
threedee.Material(ambient, diffuse, emissive)
Constructs a new Material with the specified properties.
- Parameters:
- {threedee.Color=} ambient
- Optional ambient color. Defaults to white.
- {threedee.Color=} diffuse
- Optional diffuse color. Defaults to white.
- {threedee.Color=} emissive
- Optional emissive color. Defaults to black.
Field Detail
<static>
threedee.Material.DEFAULT
The default material.
Method Detail
<static>
{number}
threedee.Material.count()
Returns and resets the current instance counter.
- Returns:
- {number} The number of created instances since the last call
<static>
{threedee.Material}
threedee.Material.fromJSON(data)
Creates a new material instance with the data read from the
specified JSON object (with keys 'a', 'd' and 'e'). Returns null if data
was empty.
- Parameters:
- {Object} data
- The material as JSON object
- Returns:
- {threedee.Material} The material object or null if data was empty
{threedee.Color}
getAmbient()
Returns the ambient color.
- Returns:
- {threedee.Color} The ambient color
{threedee.Color}
getDiffuse()
Returns the diffuse color.
- Returns:
- {threedee.Color} The diffuse color
{threedee.Color}
getEmissive()
Returns the emissive color.
- Returns:
- {threedee.Color} The emissive color
{Object}
toJSON()
Converts the material into a JSON object with keys 'a', 'd' and 'e' and
returns it.
- Returns:
- {Object} The material as a JSON object