public class PhongMaterial extends Material
PhongMaterial class provides definitions of properties that
represent a Phong shaded material. It describes the interaction of
light with the surface of the Mesh it is applied to. The PhongMaterial
reflects light in terms of a diffuse and specular component together with
an ambient and a self illumination term. The color of a point on a geometric
surface is mathematical function of these four components.
The color is computed by the following equation:
for each ambient light source i {
ambient += lightColor[i]
}
for each point light source i {
diffuse += (L[i] . N) * lightColor[i]
specular += ((R[i] . V) ^ (specularPower * intensity(specularMap))) * lightColor[i]
}
color = (ambient + diffuse) * diffuseColor * diffuseMap
+ specular * specularColor * specularMap
+ selfIlluminationMap
where
lightColor[i] is the color of light source i,L[i] is the vector from the surface to light source i,N is the normal vector (taking into the account the bumpMap if present),R[i] is the normalized reflection vector for L[i] about the surface normal,V is the normalized view vector.AmbientLight,
PointLight| Type | Property and Description |
|---|---|
ObjectProperty<Image> |
bumpMap
The bump map of this
PhongMaterial, which is a normal map stored
as a RGB Image. |
ObjectProperty<Color> |
diffuseColor
The diffuse color of this
PhongMaterial. |
ObjectProperty<Image> |
diffuseMap
The diffuse map of this
PhongMaterial. |
ObjectProperty<Image> |
selfIlluminationMap
The self illumination map of this
PhongMaterial. |
ObjectProperty<Color> |
specularColor
The specular color of this
PhongMaterial. |
ObjectProperty<Image> |
specularMap
The specular map of this
PhongMaterial. |
DoubleProperty |
specularPower
The specular power of this
PhongMaterial. |
| Constructor and Description |
|---|
PhongMaterial()
Creates a new instance of
PhongMaterial class with a default
Color.WHITE diffuseColor property. |
PhongMaterial(Color diffuseColor)
Creates a new instance of
PhongMaterial class using the specified
color for its diffuseColor property. |
PhongMaterial(Color diffuseColor,
Image diffuseMap,
Image specularMap,
Image bumpMap,
Image selfIlluminationMap)
Creates a new instance of
PhongMaterial class using the specified
colors and images for its diffuseColor properties. |
| Modifier and Type | Method and Description |
|---|---|
ObjectProperty<Image> |
bumpMapProperty()
The bump map of this
PhongMaterial, which is a normal map stored
as a RGB Image. |
ObjectProperty<Color> |
diffuseColorProperty()
The diffuse color of this
PhongMaterial. |
ObjectProperty<Image> |
diffuseMapProperty()
The diffuse map of this
PhongMaterial. |
Image |
getBumpMap()
Gets the value of the property bumpMap.
|
Color |
getDiffuseColor()
Gets the value of the property diffuseColor.
|
Image |
getDiffuseMap()
Gets the value of the property diffuseMap.
|
Image |
getSelfIlluminationMap()
Gets the value of the property selfIlluminationMap.
|
Color |
getSpecularColor()
Gets the value of the property specularColor.
|
Image |
getSpecularMap()
Gets the value of the property specularMap.
|
double |
getSpecularPower()
Gets the value of the property specularPower.
|
ObjectProperty<Image> |
selfIlluminationMapProperty()
The self illumination map of this
PhongMaterial. |
void |
setBumpMap(Image value)
Sets the value of the property bumpMap.
|
void |
setDiffuseColor(Color value)
Sets the value of the property diffuseColor.
|
void |
setDiffuseMap(Image value)
Sets the value of the property diffuseMap.
|
void |
setSelfIlluminationMap(Image value)
Sets the value of the property selfIlluminationMap.
|
void |
setSpecularColor(Color value)
Sets the value of the property specularColor.
|
void |
setSpecularMap(Image value)
Sets the value of the property specularMap.
|
void |
setSpecularPower(double value)
Sets the value of the property specularPower.
|
ObjectProperty<Color> |
specularColorProperty()
The specular color of this
PhongMaterial. |
ObjectProperty<Image> |
specularMapProperty()
The specular map of this
PhongMaterial. |
DoubleProperty |
specularPowerProperty()
The specular power of this
PhongMaterial. |
String |
toString() |
public final ObjectProperty<Color> diffuseColorProperty
PhongMaterial.getDiffuseColor(),
setDiffuseColor(Color)public final ObjectProperty<Color> specularColorProperty
PhongMaterial.getSpecularColor(),
setSpecularColor(Color)public final DoubleProperty specularPowerProperty
PhongMaterial.getSpecularPower(),
setSpecularPower(double)public final ObjectProperty<Image> diffuseMapProperty
PhongMaterial.getDiffuseMap(),
setDiffuseMap(Image)public final ObjectProperty<Image> specularMapProperty
PhongMaterial.getSpecularMap(),
setSpecularMap(Image)public final ObjectProperty<Image> bumpMapProperty
PhongMaterial, which is a normal map stored
as a RGB Image.getBumpMap(),
setBumpMap(Image)public final ObjectProperty<Image> selfIlluminationMapProperty
PhongMaterial.getSelfIlluminationMap(),
setSelfIlluminationMap(Image)public PhongMaterial()
PhongMaterial class with a default
Color.WHITE diffuseColor property.public PhongMaterial(Color diffuseColor)
PhongMaterial class using the specified
color for its diffuseColor property.diffuseColor - the color of the diffuseColor propertypublic PhongMaterial(Color diffuseColor, Image diffuseMap, Image specularMap, Image bumpMap, Image selfIlluminationMap)
PhongMaterial class using the specified
colors and images for its diffuseColor properties.diffuseColor - the color of the diffuseColor propertydiffuseMap - the image of the diffuseMap propertyspecularMap - the image of the specularMap propertybumpMap - the image of the bumpMap propertyselfIlluminationMap - the image of the selfIlluminationMap propertypublic final void setDiffuseColor(Color value)
PhongMaterial.public final Color getDiffuseColor()
PhongMaterial.public final ObjectProperty<Color> diffuseColorProperty()
PhongMaterial.getDiffuseColor(),
setDiffuseColor(Color)public final void setSpecularColor(Color value)
PhongMaterial.public final Color getSpecularColor()
PhongMaterial.public final ObjectProperty<Color> specularColorProperty()
PhongMaterial.getSpecularColor(),
setSpecularColor(Color)public final void setSpecularPower(double value)
PhongMaterial.public final double getSpecularPower()
PhongMaterial.public final DoubleProperty specularPowerProperty()
PhongMaterial.getSpecularPower(),
setSpecularPower(double)public final void setDiffuseMap(Image value)
PhongMaterial.public final Image getDiffuseMap()
PhongMaterial.public final ObjectProperty<Image> diffuseMapProperty()
PhongMaterial.getDiffuseMap(),
setDiffuseMap(Image)public final void setSpecularMap(Image value)
PhongMaterial.public final Image getSpecularMap()
PhongMaterial.public final ObjectProperty<Image> specularMapProperty()
PhongMaterial.getSpecularMap(),
setSpecularMap(Image)public final void setBumpMap(Image value)
PhongMaterial, which is a normal map stored
as a RGB Image.public final Image getBumpMap()
PhongMaterial, which is a normal map stored
as a RGB Image.public final ObjectProperty<Image> bumpMapProperty()
PhongMaterial, which is a normal map stored
as a RGB Image.getBumpMap(),
setBumpMap(Image)public final void setSelfIlluminationMap(Image value)
PhongMaterial.public final Image getSelfIlluminationMap()
PhongMaterial.public final ObjectProperty<Image> selfIlluminationMapProperty()
PhongMaterial.getSelfIlluminationMap(),
setSelfIlluminationMap(Image)Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.