Class GLGE.Material
Extends
GLGE.Animatable.
The Material class creates materials to be applied to objects in the graphics engine
Defined in: glge.js.
Constructor Attributes | Constructor Name and Description |
---|---|
Method Attributes | Method Name and Description |
---|---|
addMaterialLayer(layer)
Add a new layer to the material
|
|
addTexture(image)
Adds a new texture to this material
|
|
getAlpha()
Gets the alpha of the material
|
|
getColor()
Gets the current base color of the material
|
|
getEmit()
Gets the amount this material emits
|
|
Gets all the materials layers
|
|
Gets the materials reflectivity
|
|
Gets the shininess of the material
|
|
Gets the specular of the material
|
|
Gets the current base specular color of the material
|
|
setAlpha(value)
Sets the alpha of the material
|
|
setColor(r, g, b)
Sets the base colour of the material
|
|
setEmit(value)
Sets how much the material should emit
|
|
setReflectivity(value)
Sets reflectivity of the material
|
|
setShininess(value)
Sets the shininess of the material
|
|
setSpecular(value)
Sets the specular of the material
|
|
setSpecularColor(r, g, b)
Sets the base specular colour of the material
|
- Methods borrowed from class GLGE.Animatable:
- animate, getAnimation, getFrameRate, setAnimation, setFrameRate
Method Detail
{Number}
addMaterialLayer(layer)
Add a new layer to the material
- Parameters:
- {MaterialLayer} layer
- The material layer to add to the material
- Returns:
- {Number} index of the added layer
{Number}
addTexture(image)
Adds a new texture to this material
- Parameters:
- {String} image
- URL of the image to be used by the texture
- Returns:
- {Number} index of the new texture
{Number}
getAlpha()
Gets the alpha of the material
- Returns:
- {Number} The current alpha of the material
{[r|g|b]}
getColor()
Gets the current base color of the material
- Returns:
- {[r|g|b]} The current base color
{Number}
getEmit()
Gets the amount this material emits
- Returns:
- {Number} The emit value for the material
{GLGE.MaterialLayer[]}
getLayers()
Gets all the materials layers
- Returns:
- {GLGE.MaterialLayer[]} all of the layers contained within this material
{Number}
getReflectivity()
Gets the materials reflectivity
- Returns:
- {Number} The reflectivity of the material
{Number}
getShininess()
Gets the shininess of the material
- Returns:
- {Number} The current shininess of the material
{Number}
getSpecular()
Gets the specular of the material
- Returns:
- {Number} The current specular of the material
{[r|g|b]}
getSpecularColor()
Gets the current base specular color of the material
- Returns:
- {[r|g|b]} The current base specular color
setAlpha(value)
Sets the alpha of the material
- Parameters:
- {Number} value
- how much alpha
setColor(r, g, b)
Sets the base colour of the material
- Parameters:
- {Number} r
- The new red level 0-1
- {Number} g
- The new green level 0-1
- {Number} b
- The new blue level 0-1
setEmit(value)
Sets how much the material should emit
- Parameters:
- {Number} value
- how much to emit (0-1)
setReflectivity(value)
Sets reflectivity of the material
- Parameters:
- {Number} value
- how much to reflect (0-1)
setShininess(value)
Sets the shininess of the material
- Parameters:
- {Number} value
- how much shine
setSpecular(value)
Sets the specular of the material
- Parameters:
- {Number} value
- how much specular
setSpecularColor(r, g, b)
Sets the base specular colour of the material
- Parameters:
- {Number} r
- The new red level 0-1
- {Number} g
- The new green level 0-1
- {Number} b
- The new blue level 0-1