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 |
---|---|
<any> |
bumpMap
The bump map of this
PhongMaterial , which is a normal map stored
as a RGB Image . |
<any> |
diffuseColor
The diffuse color of this
PhongMaterial . |
<any> |
diffuseMap
The diffuse map of this
PhongMaterial . |
<any> |
selfIlluminationMap
The self illumination map of this
PhongMaterial . |
<any> |
specularColor
The specular color of this
PhongMaterial . |
<any> |
specularMap
The specular map of this
PhongMaterial . |
DoubleProperty |
specularPower
The specular power of this
PhongMaterial . |
dirtyProperty
Modifier and Type | Field and Description |
---|---|
private <any> |
bumpMap
The bump map of this
PhongMaterial , which is a normal map stored
as a RGB Image . |
private boolean |
bumpMapDirty |
private <any> |
diffuseColor
The diffuse color of this
PhongMaterial . |
private boolean |
diffuseColorDirty |
private <any> |
diffuseMap
The diffuse map of this
PhongMaterial . |
private boolean |
diffuseMapDirty |
private Image |
oldBumpMap |
private Image |
oldDiffuseMap |
private Image |
oldSelfIlluminationMap |
private Image |
oldSpecularMap |
private NGPhongMaterial |
peer
The peer node created by the graphics Toolkit/Pipeline implementation
|
private AbstractNotifyListener |
platformImageChangeListener |
private <any> |
selfIlluminationMap
The self illumination map of this
PhongMaterial . |
private boolean |
selfIlluminationMapDirty |
private <any> |
specularColor
The specular color of this
PhongMaterial . |
private boolean |
specularColorDirty |
private <any> |
specularMap
The specular map of this
PhongMaterial . |
private boolean |
specularMapDirty |
private DoubleProperty |
specularPower
The specular power of this
PhongMaterial . |
private boolean |
specularPowerDirty |
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 |
---|---|
<any> |
bumpMapProperty()
The bump map of this
PhongMaterial , which is a normal map stored
as a RGB Image . |
<any> |
diffuseColorProperty()
The diffuse color of this
PhongMaterial . |
<any> |
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.
|
(package private) NGPhongMaterial |
getNGMaterial() |
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.
|
<any> |
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.
|
(package private) void |
setDirty(boolean value) |
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.
|
<any> |
specularColorProperty()
The specular color of this
PhongMaterial . |
<any> |
specularMapProperty()
The specular map of this
PhongMaterial . |
DoubleProperty |
specularPowerProperty()
The specular power of this
PhongMaterial . |
java.lang.String |
toString() |
(package private) void |
updatePG() |
dirtyProperty, isDirty
public final <any> diffuseColorProperty
PhongMaterial
.getDiffuseColor()
,
setDiffuseColor(Color)
public final <any> specularColorProperty
PhongMaterial
.getSpecularColor()
,
setSpecularColor(Color)
public final DoubleProperty specularPowerProperty
PhongMaterial
.getSpecularPower()
,
setSpecularPower(double)
public final <any> diffuseMapProperty
PhongMaterial
.getDiffuseMap()
,
setDiffuseMap(Image)
public final <any> specularMapProperty
PhongMaterial
.getSpecularMap()
,
setSpecularMap(Image)
public final <any> bumpMapProperty
PhongMaterial
, which is a normal map stored
as a RGB Image
.getBumpMap()
,
setBumpMap(Image)
public final <any> selfIlluminationMapProperty
PhongMaterial
.private boolean diffuseColorDirty
private boolean specularColorDirty
private boolean specularPowerDirty
private boolean diffuseMapDirty
private boolean specularMapDirty
private boolean bumpMapDirty
private boolean selfIlluminationMapDirty
private <any> diffuseColor
PhongMaterial
.private <any> specularColor
PhongMaterial
.private DoubleProperty specularPower
PhongMaterial
.private final AbstractNotifyListener platformImageChangeListener
private <any> diffuseMap
PhongMaterial
.private Image oldDiffuseMap
private <any> specularMap
PhongMaterial
.private Image oldSpecularMap
private <any> bumpMap
PhongMaterial
, which is a normal map stored
as a RGB Image
.private Image oldBumpMap
private <any> selfIlluminationMap
PhongMaterial
.private Image oldSelfIlluminationMap
private NGPhongMaterial peer
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)
public final Color getDiffuseColor()
public final <any> diffuseColorProperty()
PhongMaterial
.getDiffuseColor()
,
setDiffuseColor(Color)
public final void setSpecularColor(Color value)
public final Color getSpecularColor()
public final <any> specularColorProperty()
PhongMaterial
.getSpecularColor()
,
setSpecularColor(Color)
public final void setSpecularPower(double value)
public final double getSpecularPower()
public final DoubleProperty specularPowerProperty()
PhongMaterial
.getSpecularPower()
,
setSpecularPower(double)
public final void setDiffuseMap(Image value)
public final Image getDiffuseMap()
public final <any> diffuseMapProperty()
PhongMaterial
.getDiffuseMap()
,
setDiffuseMap(Image)
public final void setSpecularMap(Image value)
public final Image getSpecularMap()
public final <any> specularMapProperty()
PhongMaterial
.getSpecularMap()
,
setSpecularMap(Image)
public final void setBumpMap(Image value)
public final Image getBumpMap()
public final <any> bumpMapProperty()
PhongMaterial
, which is a normal map stored
as a RGB Image
.getBumpMap()
,
setBumpMap(Image)
public final void setSelfIlluminationMap(Image value)
public final Image getSelfIlluminationMap()
public final <any> selfIlluminationMapProperty()
PhongMaterial
.NGPhongMaterial getNGMaterial()
getNGMaterial
in class Material
public java.lang.String toString()
toString
in class java.lang.Object