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 + selfIlluminationMapwhere
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
Modifier and Type | Field and Description |
---|---|
private ObjectProperty<Image> |
bumpMap
The bump map of this
PhongMaterial , which is a normal map stored
as a RGB Image . |
private boolean |
bumpMapDirty |
private ObjectProperty<Color> |
diffuseColor
The diffuse color of this
PhongMaterial . |
private boolean |
diffuseColorDirty |
private ObjectProperty<Image> |
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 ObjectProperty<Image> |
selfIlluminationMap
The self illumination map of this
PhongMaterial . |
private boolean |
selfIlluminationMapDirty |
private ObjectProperty<Color> |
specularColor
The specular color of this
PhongMaterial . |
private boolean |
specularColorDirty |
private ObjectProperty<Image> |
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. |
impl_dirtyProperty, isDirty
private boolean diffuseColorDirty
private boolean specularColorDirty
private boolean specularPowerDirty
private boolean diffuseMapDirty
private boolean specularMapDirty
private boolean bumpMapDirty
private boolean selfIlluminationMapDirty
private ObjectProperty<Color> diffuseColor
PhongMaterial
.private ObjectProperty<Color> specularColor
PhongMaterial
.private DoubleProperty specularPower
PhongMaterial
.private final AbstractNotifyListener platformImageChangeListener
private ObjectProperty<Image> diffuseMap
PhongMaterial
.private Image oldDiffuseMap
private ObjectProperty<Image> specularMap
PhongMaterial
.private Image oldSpecularMap
private ObjectProperty<Image> bumpMap
PhongMaterial
, which is a normal map stored
as a RGB Image
.private Image oldBumpMap
private ObjectProperty<Image> 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 ObjectProperty<Color> diffuseColorProperty()
public final void setSpecularColor(Color value)
public final Color getSpecularColor()
public final ObjectProperty<Color> specularColorProperty()
public final void setSpecularPower(double value)
public final double getSpecularPower()
public final DoubleProperty specularPowerProperty()
public final void setDiffuseMap(Image value)
public final Image getDiffuseMap()
public final ObjectProperty<Image> diffuseMapProperty()
public final void setSpecularMap(Image value)
public final Image getSpecularMap()
public final ObjectProperty<Image> specularMapProperty()
public final void setBumpMap(Image value)
public final Image getBumpMap()
public final ObjectProperty<Image> bumpMapProperty()
public final void setSelfIlluminationMap(Image value)
public final Image getSelfIlluminationMap()
public final ObjectProperty<Image> selfIlluminationMapProperty()
@Deprecated public NGPhongMaterial impl_getNGMaterial()
impl_getNGMaterial
in class Material
@Deprecated public void impl_updatePG()
impl_updatePG
in class Material
public java.lang.String toString()
toString
in class java.lang.Object